File Formats & Conversion
Convert between SMILES, SDF, and PDB formats with RDKit for cheminformatics workflows.
Format conversion lets you move molecules between SMILES, SDF, and PDB so each stage of a workflow gets the representation it expects. Careful parsing — checking for None, sanitizing, and preserving provenance — is what most affects whether a batch runs clean or silently drops records.
Parse molecules
SDF to SMILES
SMILES to SDF
PDB hygiene
- Use
Chem.MolFromPDBFile("structure.pdb", removeHs=False, sanitize=True). - Strip waters/ions before minimization if they are not needed.
- Ensure residue/atom names are preserved before exporting back to PDB.
Validation tips
- Always check for
Noneafter parsing; skip invalid records rather than crashing the batch. - Normalize tautomers if your downstream model expects a canonical form.
- Record provenance: store the source file path in
mol.SetProp("source", path).
Was this page helpful?