vibesketch.naming.opsin

Structures from names through OPSIN, an optional route (#94).

OPSIN, the Open Parser for Systematic IUPAC Nomenclature (D. M. Lowe, P. T. Corbett, P. Murray-Rust and R. C. Glen, “Chemical Name to Structure: OPSIN, an Open Source Solution”, J. Chem. Inf. Model. 51 (2011) 739-753, doi:10.1021/ci100384d), reads systematic, CAS-style and many trivial names.

It is the [opsin] extra: the OPSIN command-line jar as the py2opsin package ships it, run on a Java runtime the user already has. The jar is run directly, the names on its standard input and the SMILES read from its output, one line per name, so no file is written; the wrapper’s own function, which writes a temporary file into the working directory, is not used. OPSIN works offline: nothing is looked up on the network.

Module Attributes

MAX_NAME

The longest name passed to OPSIN.

TIMEOUT

How long one OPSIN run may take, in seconds; the first run starts the Java VM.

Functions

install_hint()

opsin_available()

Whether the OPSIN jar and a Java runtime are both there.

read_name(name)

OPSIN's structure for name; raises OpsinUnavailable without OPSIN or Java.

Classes

OpsinResult(name, smiles[, reason])

OPSIN's SMILES for a name, or why it could not read the name.

Exceptions

OpsinUnavailable

OPSIN or a Java runtime to run it on is missing.

class vibesketch.naming.opsin.OpsinResult(name, smiles, reason=None)[source]

Bases: object

OPSIN’s SMILES for a name, or why it could not read the name.

Parameters:
  • name (str)

  • smiles (str | None)

  • reason (str | None)

name: str
smiles: str | None
reason: str | None = None
exception vibesketch.naming.opsin.OpsinUnavailable[source]

Bases: RuntimeError

OPSIN or a Java runtime to run it on is missing.

vibesketch.naming.opsin.install_hint()[source]
Return type:

str

vibesketch.naming.opsin.opsin_available()[source]

Whether the OPSIN jar and a Java runtime are both there.

Return type:

bool

vibesketch.naming.opsin.read_name(name)[source]

OPSIN’s structure for name; raises OpsinUnavailable without OPSIN or Java.

Parameters:

name (str)

Return type:

OpsinResult