Cheminformatics Tutorials - Herong's Tutorial Examples - v2.01, by Herong Yang
SDMolSupplier/SDWriter for SDF Files
This section provides a tutorial example on how to use rdkit.Chem.rdmolfiles.SDMolSupplier(f) and rdkit.Chem.rdmolfiles.SDWriter(f) methods to handle SDF files with multiple molecules.
There are two main classes that handle SDF (or SD) molecule files:
1. rdkit.Chem.rdmolfiles.SDMolSupplier - Class providing operations to read multiple molecules from a SDF file. It offers the following main methods:
2. rdkit.Chem.rdmolfiles.SDWriter - Class providing operations to write multiple molecules to a SDF file. It offers the following main methods:
Here is an example session of using these two classes:
from rdkit import Chem ms = ['O=C(O)c2cc1ccc(Cl)n1cn2', 'c1ccc2c(c1)ncn3cccc23', 'c1ccc3c(c1)cc2ccncn23'] ms = list(map(Chem.MolFromSmiles, ms)) w = Chem.SDWriter("molecules.sdf") for m in ms: w.write(m) w.close() r = Chem.SDMolSupplier("molecules.sdf") for m in r: print(m.GetNumAtoms()) r.reset() while not r.atEnd(): m = next(r) print(m.GetNumBonds()) r.reset()
Table of Contents
SMILES (Simplified Molecular-Input Line-Entry System)
Open Babel: The Open Source Chemistry Toolbox
Using Open Babel Command: "obabel"
Generating SVG Pictures with Open Babel
Substructure Search with Open Babel
Similarity Search with Open Babel
Fingerprint Index for Fastsearch with Open Babel
Stereochemistry with Open Babel
Command Line Tools Provided by Open Babel
RDKit: Open-Source Cheminformatics Software
rdkit.Chem.rdchem - The Core Module
►rdkit.Chem.rdmolfiles - Molecular File Module
What Is rdkit.Chem.rdmolfiles Module
MolFromSmiles/MolToSmiles for SMILES Format
MolFromMolBlock/MolToMolBlock for Mol Block
SmilesMolSupplier/SDWriter for SMILES Files
►SDMolSupplier/SDWriter for SDF Files
rdkit.Chem.rdDepictor - Compute 2D Coordinates
rdkit.Chem.Draw - Handle Molecule Images
Molecule Substructure Search with RDKit
rdkit.Chem.rdmolops - Molecule Operations
Daylight Fingerprint Generator in RDKit
Morgan Fingerprint Generator in RDKit
RDKit Performance on Substructure Search
Introduction to Molecular Fingerprints
OCSR (Optical Chemical Structure Recognition)
AlphaFold - Protein Structure Prediction