Cheminformatics Tutorials - Herong's Tutorial Examples - v2.01, by Herong Yang
SmilesMolSupplier/SDWriter for SMILES Files
This section provides a tutorial example on how to use rdkit.Chem.rdmolfiles.SmilesMolSupplier(f) and rdkit.Chem.rdmolfiles.SDWriter(f) methods to handle SMILES files with multiple molecules.
There are two main classes that handle SMILES molecule files:
1. rdkit.Chem.rdmolfiles.SmilesMolSupplier - Class providing operations to read multiple molecules from a SMILES file. It offers the following main methods:
2. rdkit.Chem.rdmolfiles.SmilesWriter - Class providing operations to write multiple molecules to a SMILES 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.SmilesWriter("molecules.smi") for m in ms: w.write(m) w.close() r = Chem.SmilesMolSupplier("molecules.smi") for m in r: print(m.GetNumAtoms()) r.reset() m = next(r) while m: print(m.GetNumBonds()) m = next(r) 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