Skip to main content

Python wrapper for CDK molecular descriptors and fingerprints

Project description

License: MIT

CDK Python wrapper

Python wrapper to ease the calculation of CDK molecular descriptors and fingerprints.

Installation

From source:

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

with pip:

pip install CDK-pywrapper

Get started

from CDK_pywrapper import CDK
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",
  # cisplatin
  "N.N.Cl[Pt]Cl"
]
mols = [Chem.AddHs(Chem.MolFromSmiles(smiles)) for smiles in smiles_list]

cdk = CDK()
print(cdk.calculate(mols))

The above calculates 222 molecular descriptors (23 1D and 200 2D).

The additional 65 three-dimensional (3D) descriptors may be obtained with the following: :warning: Molecules are required to have conformers for 3D descriptors to be calculated.

from rdkit.Chem import AllChem

for mol in mols:
    _ = AllChem.EmbedMolecule(mol)

cdk = CDK(ignore_3D=False)
print(cdk.calculate(mols))

To obtain molecular fingerprint, one can used the following:

from CDK_pywrapper import CDK, FPType
cdk = CDK(fingerprint=.PubchemFP)
print(cdk.calculate(mols))

The following fingerprints can be calculated:

FPType Fingerprint name
FP CDK fingerprint
ExtFP Extended CDK fingerprint (includes 25 bits for ring features and isotopic masses)
EStateFP Electrotopological state fingerprint (79 bits)
GraphFP CDK fingerprinter ignoring bond orders
MACCSFP Public MACCS fingerprint
PubchemFP PubChem substructure fingerprint
SubFP Fingerprint describing 307 substructures
KRFP Klekota-Roth fingerprint
AP2DFP Atom pair 2D fingerprint as implemented in PaDEL
HybridFP CDK fingerprint ignoring aromaticity
LingoFP LINGO fingerprint
SPFP Fingerprint based on the shortest paths between two atoms
SigFP Signature fingerprint
CircFP Circular fingerprint

Documentation

class CDK(ignore_3D=True, fingerprint=None, nbits=1024, depth=6):

Constructor of a CDK calculator for molecular descriptors or fingerprints

Parameters:

  • ignore_3D : bool Should 3D molecular descriptors be calculated (default: False). Ignored if a fingerprint is set.
  • fingerprint : FPType
    Type of fingerprint to calculate (default: None). If None, calculate descriptors.
  • nbits : int
    Number of bits in the fingerprint.
  • depth : int
    Depth of the fingerprint.


```python def calculate(mols, show_banner=True, njobs=1, chunksize=1000): ```

Default method to calculate CDK molecular descriptors and fingerprints.

Parameters:

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

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

cdk_pywrapper-0.1.1.tar.gz (43.2 MB view details)

Uploaded Source

Built Distribution

cdk_pywrapper-0.1.1-py3-none-any.whl (43.2 MB view details)

Uploaded Python 3

File details

Details for the file cdk_pywrapper-0.1.1.tar.gz.

File metadata

  • Download URL: cdk_pywrapper-0.1.1.tar.gz
  • Upload date:
  • Size: 43.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for cdk_pywrapper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 299da2bddf429b6a521a28ea9b3a591d0dbf626fa37073bc356ef6b3ab025a1b
MD5 90e3b3556be904cb663b64b8886de1d2
BLAKE2b-256 f54738666a2f86104f956f33904a1eddb2c7e61ce6d1fa7342c2a430824255b6

See more details on using hashes here.

File details

Details for the file cdk_pywrapper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cdk_pywrapper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 43.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for cdk_pywrapper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b09de9da4283f8cccb28fa2789e6c7f459a91b147847aefb7093c33c3ca4a17
MD5 0cfab0e48efedc9228add36e9f7582c6
BLAKE2b-256 31f46525d0a74ce671169daea382918381466fd895b13791bec2a30b7d3a72f8

See more details on using hashes here.

Supported by

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