Skip to main content

Python wrapper for Mold2 descriptors

Project description

License: MIT

Mold² Python wrapper

Python wrapper to ease the calculation of Mold2 molecular descriptors.

Copyright notice

Mold2 is a product designed and produced by the National Center for Toxicological Research (NCTR).
FDA and NCTR retain ownership of this product.

Olivier J. M. Béquignon is neither the copyright holder of Mold2 nor responsible for it.

Only the Python wrapper is the work of Olivier J. M. Béquignon.

Installation

From source:

git clone https://github.com/OlivierBeq/Mold2_pywrapper.git
pip install ./Mold2_pywrapper

with pip:

pip install mold2-pywrapper

Get started

from Mold2_pywrapper import Mold2

smiles_list = [
    # erlotinib
    "n1cnc(c2cc(c(cc12)OCCOC)OCCOC)Nc1cc(ccc1)C#C",
    # midecamycin
    "CCC(=O)O[C@@H]1CC(=O)O[C@@H](C/C=C/C=C/[C@@H]([C@@H](C[C@@H]([C@@H]([C@H]1OC)O[C@H]2[C@@H]([C@H]([C@@H]([C@H](O2)C)O[C@H]3C[C@@]([C@H]([C@@H](O3)C)OC(=O)CC)(C)O)N(C)C)O)CC=O)C)O)C",
    # selenofolate
    "C1=CC(=CC=C1C(=O)NC(CCC(=O)OCC[Se]C#N)C(=O)O)NCC2=CN=C3C(=N2)C(=O)NC(=N3)N",
    # cisplatin
    "N.N.Cl[Pt]Cl"
]
mols = [Chem.MolFromSmiles(smiles) for smiles in smiles_list]

mold2 = Mold2()
print(mold2.calculate(mols))

Instantiating a Mold2 object ensures that the executables for your platform are accessible. If this is not the case, an attempt to download them from the website of the FDA is made.

Should one have downloaded the original ZIP file available from the website of the FDA, the executables can be installed using the following:

path_to_zipfile = '...'  # Replace by the path to the ZIP file on your machine
mold2 = Mold2.from_executable(path_to_zipfile)
print(mold2.calculate(mols))

Executables will be installed for future use. From then on, default instanciation may be carried out:

mold2 = Mold2()
print(mold2.calculate(mols))

Details about descriptors

Any detail about the 777 Mold2 descriptors can be obtained either for a single descriptor, by providing its index:

print(mold2.descriptor_detail(15))
# rotatable bond fraction

Or for all at once:

print(mold2.descriptor_details())
# {"D001": "number of 6-membered aromatic rings (only carbon atoms)",
#  "D002": "number of 03-membered rings",
#  ...
#  }

Documentation

def calculate(mols, show_banner=True, njobs=1, chunksize=100):

Default method to calculate Mold2 descriptors. If executables have not previously been downloaded, attempts to download and install them.

Parameters

  • mols : Iterable[Chem.Mol]
    RDKit molecule objects for which to obtain Mold2 descriptors.
  • show_banner : bool
    Displays default notice about Mold2 descriptors.
  • njobs : int
    Maximum number of simultaneous processes.
  • chunksize : int
    Maximum number of molecules each process is charged of.
  • return_type : pd.DataFramce
    Pandas DataFrame containing Mold2 molecular descriptors.

def descriptor_detail(index):

Obtain detils about one descriptor.

Parameters

  • index : int
    Index of the descriptor.
  • return_type : str
    Description of the descriptor.

def descriptor_details():

Obtain details about all descriptors.

Parameters

  • return_type : dict
    Mapping of molecular descriptors with their details.

def from_executable(zipfile_path):

Install executables and instantiate a Mold2 calculator.

Parameters

  • zipfile_path : str
    Path to the user-downloaded ZIP file containing Mold2 executables.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mold2_pywrapper-0.0.1.dev0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

mold2_pywrapper-0.0.1.dev0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file mold2_pywrapper-0.0.1.dev0.tar.gz.

File metadata

  • Download URL: mold2_pywrapper-0.0.1.dev0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for mold2_pywrapper-0.0.1.dev0.tar.gz
Algorithm Hash digest
SHA256 74c7cb3abc7593167d94b3e889743e3acf942c8956a8451a79c72b1375af271b
MD5 955ce87a88763d98d3ee448c8cf54f24
BLAKE2b-256 5f791dc890df46851abcf3db968d97b8655169cb99d32143790a1bf6365c8956

See more details on using hashes here.

File details

Details for the file mold2_pywrapper-0.0.1.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for mold2_pywrapper-0.0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fe27d4eb5cbbbb0097b3bd265bc35e1bfb125d85fa405d0141a11e41f18abc6
MD5 27eddf9c8ed64bbc596af1414b84d446
BLAKE2b-256 332a941a0a5b40cab4d28d9232d08e71f5abf4a84dc3e77eeee297606a5a9f02

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page