Chemical-Converters
Remember, chemistry is not just about reactions; it's about connections. Let's build those connections together! 💫
Library for translating chemical names
Table of Contents
Introduction
Chemical-Converters serves as a foundational showcase of our technological capabilities within the chemical domain. The available models, which could be used in this library, represent our entry-level offerings, designed to provide a glimpse into the potential applications of our advanced solutions. For access to our comprehensive suite of larger and more precise models, we invite interested parties to e ngage directly with us.
Developed by the brilliant minds at Knowledgator, the library showcases the abilities of our chemical transformer models. Whether you're working on a research project, studying for an exam, or just exploring the chemical universe, Chemical-Converters is your go-to tool 🛠.
Models
The models` architecture is based on Google MT5 with certain modification to support different inputs and outputs. All available models are presented in the table:
| Model | Accuracy | Size(MB) | Task |
|---|---|---|---|
| SMILES2IUPAC-canonical-small | 75% | 24 | SMILES to IUPAC |
| SMILES2IUPAC-canonical-base | 86.9% | 180 | SMILES to IUPAC |
| IUPAC2SMILES-canonical-small | 88.9% | 24 | IUPAC to SMILES |
| IUPAC2SMILES-canonical-base | 93.7% | 180 | IUPAC to SMILES |
also, you can check the most resent models within the library:
from chemicalconverters import NamesConverter
print(NamesConverter.available_models())
{'knowledgator/SMILES2IUPAC-canonical-small': 'Small model for converting canonical SMILES to IUPAC with accuracy 75%, does not support isomeric or isotopic SMILES', 'knowledgator/SMILES2IUPAC-canonical-base': 'Medium model for converting canonical SMILES to IUPAC with accuracy 87%, does not support isomeric or isotopic SMILES', 'knowledgator/IUPAC2SMILES-canonical-small': 'Small model for converting IUPAC to canonical SMILES with accuracy 89%, does not support isomeric or isotopic SMILES', 'knowledgator/IUPAC2SMILES-canonical-base': 'Medium model for converting IUPAC to canonical SMILES with accuracy 94%, does not support isomeric or isotopic SMILES'}
Quickstart
Firstly, install the library:
pip install chemical-converters
SMILES to IUPAC
You can choose pretrained model from table in the section "Models", but we recommend to use model "knowledgator/SMILES2IUPAC-canonical-base".
! Preferred IUPAC style
To choose the preferred IUPAC style, place style tokens before your SMILES sequence.
| Style Token | Description |
|---|---|
<BASE> |
The most known name of the substance, sometimes is the mixture of traditional and systematic style |
<SYST> |
The totally systematic style without trivial names |
<TRAD> |
The style is based on trivial names of the parts of substances |
To perform simple translation, follow the example:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/SMILES2IUPAC-canonical-base")
print(converter.smiles_to_iupac('CCO'))
print(converter.smiles_to_iupac(['<SYST>CCO', '<TRAD>CCO', '<BASE>CCO']))
['ethanol']
['ethanol', 'ethanol', 'ethanol']
Processing in batches:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/SMILES2IUPAC-canonical-base")
print(converter.smiles_to_iupac(["<BASE>C=CC=C" for _ in range(10)], num_beams=1,
process_in_batch=True, batch_size=1000))
['buta-1,3-diene', 'buta-1,3-diene'...]
Validation SMILES to IUPAC translations
It's possible to validate the translations by reverse translation into IUPAC and calculating Tanimoto similarity of two molecules fingerprints.
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/SMILES2IUPAC-canonical-base")
print(converter.smiles_to_iupac('CCO', validate=True))
['ethanol'] 1.0
The larger is Tanimoto similarity, the more is probability, that the prediction was correct.
You can also process validation manually:
from chemicalconverters import NamesConverter
validation_model = NamesConverter(model_name="knowledgator/IUPAC2SMILES-canonical-base")
print(NamesConverter.validate_iupac(input_sequence='CCO', predicted_sequence='ethanol', validation_model=validation_model))
1.0
!Note validation was not implemented in processing in batches.
IUPAC to SMILES
You can choose pretrained model from table in the section "Models", but we recommend to use model "knowledgator/IUPAC2SMILES-canonical-base".
To perform simple translation, follow the example:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/IUPAC2SMILES-canonical-base")
print(converter.iupac_to_smiles('ethanol'))
print(converter.iupac_to_smiles(['ethanol', 'ethanol', 'ethanol']))
['CCO']
['CCO', 'CCO', 'CCO']
Processing in batches:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/IUPAC2SMILES-canonical-base")
print(converter.iupac_to_smiles(["buta-1,3-diene" for _ in range(10)], num_beams=1,
process_in_batch=True, batch_size=1000))
['<SYST>C=CC=C', '<SYST>C=CC=C'...]
Our models also predict IUPAC styles from the table:
| Style Token | Description |
|---|---|
<BASE> |
The most known name of the substance, sometimes is the mixture of traditional and systematic style |
<SYST> |
The totally systematic style without trivial names |
<TRAD> |
The style is based on trivial names of the parts of substances |
Citation
Coming soon.
Metadata
Release files for chemical-converters 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chemical_converters-0.1.2.tar.gz | 59.7 kB | Without provenance | Details for chemical_converters-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chemical_converters-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for chemical_converters-0.1.2-py3-none-any.whl |
Total release size: 81.3 kB
Release files / chemical_converters-0.1.2.tar.gz
| Download URL | chemical_converters-0.1.2.tar.gz |
|---|---|
| Size | 59.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
181eb6e864276a3a601933914496d4fbe05a97720dc2d6fccdb38e0d191ea59f
|
|
BLAKE2b-256 checksum How to use checksums |
b503d042b0fe87980cbcb74694eb040bae630f8695450c837811965256983dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / chemical_converters-0.1.2-py3-none-any.whl
| Download URL | chemical_converters-0.1.2-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e711df939d39f3d191640b16c759f29fa7cdf6abf5729509f3d7459621e38ccf
|
|
BLAKE2b-256 checksum How to use checksums |
c1217555e05e692545d6199a7bee2bcff6179f7b3654eb3f97fc243f8a9ce00f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Security for chemical-converters 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.