Skip to main content

A Python library calculating molecular descriptors.

Project description

ChemoPy2

A Python library calculating molecular descriptors.

💪 Getting Started

from chemopy import ChemoPy
from rdkit import Chem

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",
]
# Ensure hydrogens are explicit
mols = [Chem.AddHs(Chem.MolFromSmiles(smiles)) for smiles in smiles_list]

cmp = ChemoPy()
print(cmp.calculate(mols))

The above calculates 632 two-dimensional (2D) molecular descriptors.

The additional 552 three-dimensional (3D) molecular descriptors can be computed as follows:
:warning: Molecules are required to have conformers for descriptors to be calculated.

from rdkit.Chem import AllChem

# Ensure molecules have 3D conformations
for mol in mols:
    _ = AllChem.EmbedMolecule(mol)

cmp = ChemoPy(ignore_3D=False)
print(cmp.calculate(mols))

To obtain 11 2D molecular fingerprints with default folding size, one can use the following:

from chemopy import Fingerprint

for mol in mols:
    print(Fingerprint.get_all_fps(mol))

Other methods of the Fingerprint submodule allow to change folding size and depth of the compatible fingerprints.

Currently, only one 3D fingerprint may be obtained with the following:

from chemopy import Fingerprint3D

for mol in mols:
    print(Fingerprint3D.get_all_fps(mol))

Conveniently, the calculation of molecular descriptors and fingerprints can be coupled:

# 2D molecular descriptors and fingerprints
cmp =  ChemoPy(include_fps=True)
print(cmp.calculate(mols))

# 2D and 3D molecular descriptors and fingerprints
cmp =  ChemoPy(ignore_3D=False, include_fps=True)
print(cmp.calculate(mols))

Finally, details on either one or all molecular descriptors can be obtained like so:

# Obtain details about Thara
print(cmp.get_details('Thara'))

# Obtain details for all descriptors and fingerprints
print(cmp.get_details())

🚀 Installation

ChemoPy requires OpenMOPAC and OpenBabel to be installed.

conda install openbabel mopac -c conda-forge

The most recent release can be installed from PyPI with:

$ pip install chemopy2

The most recent code and data can be installed directly from GitHub with:

$ pip install git+https://github.com/OlivierBeq/chemopy.git

👐 Contributing

Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See CONTRIBUTING.md for more information on getting involved.

👋 Attribution

📖 Citation

  1. Cao et al., ChemoPy: freely available python package for computational biology and chemoinformatics. Bioinformatics 2013; 29(8), 1092–1094. doi:10.1093/bioinformatics/btt105

🍪 Cookiecutter

This package was created with @audreyfeldroy's cookiecutter package using @cthoyt's cookiecutter-snekpack template.

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

chemopy2-1.1.0.tar.gz (112.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chemopy2-1.1.0-py3-none-any.whl (92.6 kB view details)

Uploaded Python 3

File details

Details for the file chemopy2-1.1.0.tar.gz.

File metadata

  • Download URL: chemopy2-1.1.0.tar.gz
  • Upload date:
  • Size: 112.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for chemopy2-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c83242235fbe7e04ee1cc122b0631b2371a6f7002e665aaa7237862b7c6bdcf1
MD5 0dd5adf32826212b1f012b547003c12e
BLAKE2b-256 fd8b2c5e72d991f786b234d9976a4414184dd0f39d9a0248f0af785f552a9c44

See more details on using hashes here.

File details

Details for the file chemopy2-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: chemopy2-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 92.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for chemopy2-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 449320a2a91a92806e8ff77eeae1b74d0e04409f3a02d781955edf15485c3ebf
MD5 10d958f823526c89f8ae14535d8d1770
BLAKE2b-256 827ae8cc7093596b5c7098260eb7961a8ca75cf527f9a4f02415d1c782535dde

See more details on using hashes here.

Supported by

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