Python wrapper for Mold2 descriptors
Project description
Mold² Python Wrapper
A simple and reliable Python wrapper for calculating Mold² molecular descriptors. This library automates the process of downloading, installing, and running the Mold² executables for seamless integration into your cheminformatics workflows.
✨ Features
- Automated Installation: Automatically downloads and sets up the correct Mold² executables for your operating system (Windows or Linux).
- Simple API: A clean and easy-to-use interface for calculating descriptors from RDKit molecule objects.
- Parallel Processing: Calculate descriptors for large datasets quickly using built-in support for multiprocessing.
- Data Handling: Returns descriptors in a convenient Pandas DataFrame, ready for analysis.
- Descriptor Information: Easily access details and descriptions for all 777 Mold² descriptors.
✍️ Copyright and Citation Notice
Mold² Software
Mold² is a product designed and produced by the National Center for Toxicological Research (NCTR). FDA and NCTR retain ownership of this product. This Python wrapper is the work of Olivier J. M. Béquignon and is not affiliated with the original authors.
Citing
If you use this wrapper in your research, please cite the original Mold² publication in addition to this software package:
-
Original Mold² Paper:
Hong, H., Xie, Q., Ge, W., Qian, F., Fang, H., Shi, L., Su, Z., Perkins, R., & Tong, W. (2008). Mold², Molecular Descriptors from 2D Structures for Chemoinformatics and Toxicoinformatics. Journal of Chemical Information and Modeling, 48(7), 1337–1344. DOI: 10.1021/ci800038f
-
This Wrapper:
Please refer to the
CITATION.cfffile for details on how to cite this library.
🛠️ Requirements
- Python 3.11+
- RDKit
📦 Installation
You can install the wrapper from PyPI:
pip install mold2-pywrapper
💡 Usage
Here is a basic example of how to calculate Mold² descriptors for a list of molecules.
from rdkit import Chem
from Mold2_pywrapper import Mold2
# A list of SMILES strings
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"
]
# Convert SMILES to RDKit molecule objects
mols = [Chem.MolFromSmiles(smiles) for smiles in smiles_list]
# Instantiate the Mold2 calculator
# This will automatically download the executables on first run.
mold2 = Mold2()
# Calculate descriptors
descriptors_df = mold2.calculate(mols)
print(descriptors_df.head())
⚙️ Working with Pre-Downloaded Executables
If you have already downloaded the Mold² ZIP file from the FDA website, you can install the executables directly from the file:
path_to_zipfile = 'path/to/your/Mold2-Executable-File.zip'
mold2 = Mold2.from_executable(path_to_zipfile)
# The executables are now installed for future use.
# You can now instantiate Mold2() normally.
🔍 Getting descriptors details
You can retrieve the description for any of the 777 descriptors by its index or get a dictionary of all of them.
# Get details for a single descriptor
print(mold2.descriptor_detail(15))
# Output: rotatable bond fraction
# Get details for all descriptors
all_descriptors = mold2.descriptor_details()
print(all_descriptors['D001'])
# Output: number of 6-membered aromatic rings (only carbon atoms)
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
📚 API Documentation
def calculate(mols, show_banner=True, njobs=1, chunksize=1000):
Calculates Mold2 molecular 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.DataFrame
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
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mold2_pywrapper-0.3.0.tar.gz.
File metadata
- Download URL: mold2_pywrapper-0.3.0.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39d8a5fa7ea55e8d9b67d4b60bf42ec75e47f5a27bc06c9028c9d9c175749e8
|
|
| MD5 |
1b9ebcfd3a85c1fc343d769c89d9c8f3
|
|
| BLAKE2b-256 |
7b1793e951c1e915ebc70373db7a8db6f8953886f6cbceb4c8b3e9eb2d948858
|
File details
Details for the file mold2_pywrapper-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mold2_pywrapper-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5452cd30d76883436e59391b2915313b23db2fa8afd198e44b046d9e6577d758
|
|
| MD5 |
4efb28a4150fe263a3ac915d1ecac293
|
|
| BLAKE2b-256 |
331ffaef39db72249bb52a914d9b312ba65f76a4606203c761103f2c39781d62
|