Getting Started¶
This is a small introduction to help you get started with Chemaxon Python API. For a thorough documentation, go to the API Reference. A more detailed list of examples can be found in the Python API examples project.
Molecule import¶
You can easily import molecules from various formats. You can either specify the format yourself,
or if you do not specify any format, the function will recognize the format automatically.
The import_mol function returns a chemaxon.molecule.Molecule object on success.
Bulk import from file:
Bulk export to a file:
Molecule export¶
You can also export molecules into various formats. You can need to specifiy the format in this case.
The export_mol function returns a str object on success, which contains the molecule in the specified format.
Export to file (even multiple molecules):
Molecule display¶
The molecule can be exported to a svg file string:
Calculations¶
Once you have a molecule, you can calculate various properties of it.
This function returns a chemaxon.calculations.logp.LogPResult object, which contains the calculated logP value,
and the logP values of the individual atoms.
You can also calculate logp using the default parameter values:
Fingerprint calculations¶
Chemaxon has a number of functions that you can use to generate fingerprints.
These functions return chemaxon.fingerprints.fingerprint.Fingerprint objects. You can get the fingerprints
in bytes or in binary string format.
You can also calculate pharmacophore fingerprints:
This method returns a FloatVectorFingerprint, which contains a float array.
You can also calculate Tanimoto Dissimilarity for the fingerprints:
Structure standardization¶
Standardization in python works similar to our other tools.
See more information about standardization in general: Standardizer Introduction
and the list of available standardizer actions.
Standardizer can be configured via action strings:
Or via xml configuration:
Structure checker¶
For the concept of Structure Checker in general see Structure Checker User's Guide.
Built-in checkers and fixers are available from Chemaxon Python API, custom implementations are not supported yet.
Structure fixer keeps the input molecule unchanged and returns an object containing the result molecule and a flag indicating if the fix was successful.
The following example shows the configuration and usage of structure checker via action strings:
Action strings can be specified as list as well:
Using xml files structure checker creation changes as follows:
Molecule Search¶
Searching a query molecule on a target molecule is supported by the MoleculeSearch class. For a detailed documentation of our search engine see our search documentation. For now second generation search engine functionalities/ semantics is not supported .Search type and standardization config can be specified optionally with default values substructure and general aromatization:
Standardizer can be specified with Standardizer object as well:
Search is executed with the
find_hit method, that has mandatory arguments query and target molecules and optional argument return_colored_hit with default value False. Result of this method is a SearchHit object if there is a hit and None otherwise. This hit object has a hit_indexes and a colored_hit fields. The later is None if hit coloring was switched off.Searching on a list of molecules¶
MoleculeSearch class also supports searching of a list of molecules. In this case search is multithreaded but no fingerprint screening is executed before the search.
The result will contain a
SearchHit object for every input target structure in the same order as the targets were specified, being None if there is no hit for the given target.As with
find_hit method the return_colored_hit option can be specified if colored hit is also required.