Skip to main content

PyOPSIN

This is a Python wrapper for the OPSIN (Open Parser for Systematic IUPAC Nomenclature) package, which allows you to generate SMILES and CML form the standardized IUPAC names for organic molecules. The original OPSIN package was written in Java, but this wrapper allows you to use OPSIN functionality directly from Python.

Installation

PyOPSIN requires Java 8+. The first time you create a PyOpsin() instance, it downloads the latest OPSIN CLI JAR (opsin-cli-*-jar-with-dependencies.jar) from the official OPSIN GitHub releases.

pip install pyopsin

From a source checkout:

pip install -e .

The JAR is cached under ~/.cache/pyopsin/ on Unix and %LOCALAPPDATA%\pyopsin on Windows. Override the cache directory with the PYOPSIN_JAR_DIR environment variable. You can also pass a local JAR with PyOpsin(path="/path/to/opsin-cli.jar").

Usage

Here's an example of how to use the PyOPSIN to generate SMILES string using the IUPAC name for a molecule:

from pyopsin import PyOpsin

# create an PyOpsin object
opsin = PyOpsin()

# generate the SMILES string from an IUPAC name for a molecule
name = "2,4,6-trinitrotoluene"
smiles = opsin.to_smiles(name)

# print the SMILES string
print(smiles)

This should output the following SMILES string:

["[N+](=O)([O-])C1=C(C)C(=CC(=C1)[N+](=O)[O-])[N+](=O)[O-]"]

Here is another example of how to invoke parallel processing to process a list of IUPAC names:

names = ["2,4,6-trinitrotoluene", "cycloheptene"]
smiles = opsin.to_smiles(names, num_workers=2)
print(smiles)

This should output the following SMILES strings:

["[N+](=O)([O-])C1=C(C)C(=CC(=C1)[N+](=O)[O-])[N+](=O)[O-]", "C1=CCCCCC1"]

Acknowledgments

The OPSIN Python wrapper is built on top of the OPSIN package, which was developed by the Centre for Molecular Informatics at the University of Cambridge. We would like to thank the developers of OPSIN for creating such a powerful and useful tool.

Metadata

Release files for pyopsin 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyopsin 1.0.0
File Size Uploaded
pyopsin-1.0.0.tar.gz 12.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyopsin 1.0.0
File Interpreter ABI Platform
pyopsin-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.3 MB

Release files / pyopsin-1.0.0.tar.gz

Download URL pyopsin-1.0.0.tar.gz
Size 12.2 MB
Tags Source
SHA-256 checksum
How to use checksums
74b0d48358009934064a7f0477647a76e3f6482a5d49df098a6b881d8eb59751
BLAKE2b-256 checksum
How to use checksums
fda47c97910a2a4170adcbf8a7d1d1bc7a368b628ada6cffb56aa104f92c61cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / pyopsin-1.0.0-py3-none-any.whl

Download URL pyopsin-1.0.0-py3-none-any.whl
Size 12.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
73c9cc0599eda8feb98c910f0442df673592d8b2236098f3e47c5b509f4ef8a6
BLAKE2b-256 checksum
How to use checksums
1739c095bf24b3598414b71dad2561dd002fcd7874db3f18cf9d1a95bc16cde7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.0 This release

2 release files

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page