Simple Python interface to OPSIN: Open Parser for Systematic IUPAC nomenclature
Project description
py2opsin
Simple Python interface to OPSIN: Open Parser for Systematic IUPAC nomenclature
Online Documentation
Click here to read the documentation
Installation
py2opsin
can be installed with pip install py2opsin
. It has zero dependencies and should work inside any environment running modern Python.
Usage
Command-line arguments available in OPSIN
can be passed through to py2opsin
:
from py2opsin import py2opsin
>> smiles_string = py2opsin(
chemical_name = "ethane",
output_format = "SMILES",
)
smiles_str = "CC"
>> py2opsin(
chemical_name: str or list of strings,
output_format: str = "SMILES",
allow_acid = False,
allow_radicals = True,
allow_bad_stereo = False,
wildcard_radicals = False,
jar_fpath = "/path/to/opsin.jar",
)
The result is returned as a Python string, or False if an unexpected error occurs when calling OPSIN. If a list of IUPAC names is provided, a list if returned.
Arguments: chemical_name (str): IUPAC name of chemical as a Python string, or a list of strings. output_format (str, optional): One of "SMILES", "CML", "InChI", "StdInChI", or "StdInChIKey". Defaults to "SMILES". allow_acid (bool, optional): Allow interpretation of acids. Defaults to False. allow_radicals (bool, optional): Enable radical interpretation. Defaults to False. allow_bad_stereo (bool, optional): Allow OPSIN to ignore uninterpreatable stereochem. Defaults to False. wildcard_radicals (bool, optional): Output radicals as wildcards. Defaults to False. jar_fpath (str, optional): Filepath to OPSIN jar file. Defaults to "opsin-cli-2.7.0-jar-with-dependencies.jar" which is distributed with py2opsin.
License
OPSIN
and py2opsin
are both distributed under the MIT license.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for py2opsin-1.0.0rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5aa7a1c444991cdb554069503938a8983d3c844e5cbef67cc29026108c6efd2 |
|
MD5 | 02b7a03a6baa70d77f7bf09fec6f9cce |
|
BLAKE2b-256 | 74e136f8e4d8c98cbea53b241eae6f34afedc4f00eaf3cacda166002bc4cbe07 |