Skip to content

skearnes/rdkit-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rdkit-utils Build Status

Cheminformatics utilities based on the RDKit

Highlights

High-level molecule reading and writing

Read and write multiple molecule file formats using the same interface. The MolReader class automatically perceives conformers and can optionally remove salts.

from rdkit_utils.serial import MolReader, MolWriter

# read a gzipped SDF file
reader = MolReader()
with reader.open('molecules.sdf.gz') as mols:
    for mol in mols:
        ...

# read SMILES
reader = MolReader()
with reader.open('molecules.smi') as mols:
    for mol in mols:
        ...
        
# read from a file-like object
with open('molecules.sdf') as f:
    for mol in MolReader(f, mol_format='sdf'):
        ...

# write to gzipped SDF
writer = MolWriter()
with writer.open('molecules.sdf.gz') as f:
    f.write(mols)

Conformer generation

Generate conformers with minimization prior to pruning. The ConformerGenerator class starts with a pool of conformers and prunes out conformers within an RMSD threshold.

from rdkit_utils import conformers, serial

reader = serial.MolReader()
mols = reader.open('molecules.sdf')

engine = conformers.ConformerGenerator(max_conformers=10)
expanded = []
for mol in mols:
    expanded.append(engine.generate_conformers(mol))
    ...