Platform wheels for RDKit - a comprehensive cheminformatics and machine-learning library with Python bindings
npx @tessl/cli install tessl/pypi-rdkit@2024.9.0RDKit is a comprehensive cheminformatics and machine-learning library written in C++ with Python bindings. This package provides platform-specific wheels for easy installation across Linux, macOS, and Windows, containing compiled dynamic libraries and Python interfaces for molecular manipulation, chemical analysis, and machine learning applications in computational chemistry and drug discovery.
pip install rdkitimport rdkitCore chemistry functionality:
from rdkit import ChemCommon specific imports:
from rdkit.Chem import AllChem, Descriptors, Descriptors3D
from rdkit.Chem import ChemicalFeatures, Draw
from rdkit import RDConfigfrom rdkit import Chem
from rdkit.Chem import Descriptors, AllChem, Draw
# Create a molecule from SMILES
smiles = "CCO" # Ethanol
mol = Chem.MolFromSmiles(smiles)
# Calculate molecular descriptors
mw = Descriptors.MolWt(mol)
logp = Descriptors.MolLogP(mol)
print(f"Molecular Weight: {mw:.2f}")
print(f"LogP: {logp:.2f}")
# Generate 2D coordinates and create an image
AllChem.Compute2DCoords(mol)
img = Draw.MolToImage(mol, size=(300, 300))
img.save("molecule.png")
# Convert to MOL block format
mol_block = Chem.MolToMolBlock(mol)
print(mol_block)RDKit's architecture centers around the Mol object, which represents molecular structures and serves as the foundation for all cheminformatics operations:
This design enables RDKit to serve as the foundational cheminformatics library for Python, providing essential molecular manipulation capabilities for computational chemistry, drug discovery, and chemical data analysis applications.
Fundamental molecular representation, manipulation, and I/O operations. Includes molecule creation from various formats, basic property access, and format conversions.
def MolFromSmiles(smiles: str, sanitize: bool = True) -> Mol: ...
def MolToSmiles(mol: Mol, **kwargs) -> str: ...
def MolFromMolBlock(molblock: str, **kwargs) -> Mol: ...
def MolToMolBlock(mol: Mol, **kwargs) -> str: ...Calculation of 2D molecular descriptors for characterizing chemical properties. Includes 217+ descriptors covering molecular weight, logP, topological indices, and structural features.
def MolWt(mol: Mol) -> float: ...
def MolLogP(mol: Mol) -> float: ...
def NumHDonors(mol: Mol) -> int: ...
def NumHAcceptors(mol: Mol) -> int: ...
def CalcMolDescriptors(mol: Mol) -> dict: ...3D conformer generation, molecular embedding, and 3D descriptor calculations for spatial molecular analysis.
def EmbedMolecule(mol: Mol, **kwargs) -> int: ...
def Compute2DCoords(mol: Mol) -> None: ...
def CalcMolDescriptors3D(mol: Mol) -> dict: ...2D molecular structure rendering and image generation with customizable display options for creating publication-quality molecular graphics.
def MolToImage(mol: Mol, size: tuple = (300, 300), **kwargs): ...
def ReactionToImage(reaction, **kwargs): ...Pharmacophore and chemical feature detection for identifying functional groups, binding sites, and molecular patterns.
def BuildFeatureFactory(fdefName: str): ...RDDataDir: str # Path to RDKit data directory containing databases and definitionsRDKit includes extensive chemical data resources accessed through the RDDataDir configuration:
class Mol:
"""Core molecular representation object"""
def GetNumAtoms() -> int: ...
def GetNumBonds() -> int: ...
def GetAtoms() -> list: ...
def GetBonds() -> list: ...
def GetPropsAsDict() -> dict: ...
class Atom:
"""Individual atom representation"""
def GetAtomicNum() -> int: ...
def GetSymbol() -> str: ...
def GetIdx() -> int: ...
class Bond:
"""Chemical bond representation"""
def GetBondType() -> BondType: ...
def GetBeginAtomIdx() -> int: ...
def GetEndAtomIdx() -> int: ...
class BondType:
"""Enumeration of chemical bond types"""
SINGLE: int = 1
DOUBLE: int = 2
TRIPLE: int = 3
AROMATIC: int = 4