Smiles sdf parsing
Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/smiles-sdf-parsing
Use when you have a natural product molecule or compound library provided as SMILES strings, InChI strings, or SDF files, and you need to convert them into an in-memory molecular representation (RDKit Mol object) suitable for fingerprinting, property prediction, or other cheminformatic operations.From its SKILL.md
npx -y skills add HolobiomicsLab/asb-skill-collections --skill smiles-sdf-parsingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.0 KB, 891 tokens by cl100k_base, as published. Nobody here has run it
SMILES/SDF Parsing
Summary
Parse molecular structure representations in SMILES or SDF format and load them into an RDKit molecule object for downstream cheminformatic analysis. This is a foundational step for any workflow that accepts chemical structure input and needs to operate on molecular graphs.
When to use
You have a natural product molecule or compound library provided as SMILES strings, InChI strings, or SDF files, and you need to convert them into an in-memory molecular representation (RDKit Mol object) suitable for fingerprinting, property prediction, or other cheminformatic operations.
When NOT to use
- Input is already an RDKit Mol object or other in-memory molecular representation.
- You are working with protein sequences or genomic data rather than small-molecule chemistry.
- The molecular structure is malformed or incomplete and cannot be unambiguously interpreted as a valid chemical graph.
Inputs
- SMILES string
- InChI string
- SDF file
- Molecule structure in chemical format
Outputs
- RDKit Mol object
- Molecule supplier iterator (for SDF input)
How to apply
Use RDKit's Chem module to parse the input: call Chem.MolFromSmiles() for SMILES strings or Chem.MolFromInchi() for InChI strings to produce a Mol object. For SDF files, use Chem.SDMolSupplier() to iterate over all molecules in the file. Validate that the returned Mol object is not None before proceeding; a None return indicates the parser could not interpret the structure and the input should be checked for formatting errors or chemical validity.
Related tools
- RDKit (Parses SMILES, InChI, and SDF strings/files into Mol objects for cheminformatic operations) — https://www.rdkit.org
- biosynfoni (Accepts RDKit Mol objects parsed from SMILES/SDF and computes biosynformatic fingerprints) — https://github.com/lucinamay/biosynfoni
Examples
from rdkit import Chem
smi = 'CCO'
mol = Chem.MolFromSmiles(smi)
print(mol.GetNumAtoms())
Evaluation signals
- Returned RDKit Mol object is not None and has a valid atomic connectivity graph.
- Mol object has correct atom count, bond types, and stereochemistry matching the input structure.
- When iterated over an SDF file, all molecules are successfully parsed without errors.
- Round-trip conversion (SMILES → Mol → SMILES) produces chemically equivalent structures.
- No warnings or exceptions are raised during parsing of chemically valid input.
Limitations
- Parser will return None if the input SMILES or InChI string is malformed or represents an invalid chemical structure.
- SDF files may contain metadata or properties that are not automatically extracted into the Mol object; use GetProp() or other RDKit accessors to retrieve them.
- Some stereochemical and charge specifications may be ambiguous in SMILES and require explicit annotation or validation against expected chemical rules.
- Large SDF files may require streaming (SDMolSupplier with lazy loading) to avoid memory exhaustion.
Evidence
- [readme] Convert a SMILES string to a fingerprint: from biosynfoni import Biosynfoni from rdkit import Chem smi = <SMILES> mol = Chem.MolFromSmiles(smi): "mol = Chem.MolFromSmiles(smi)"
- [readme] Create a fingerprint from a SMILES string: biosynfoni <SMILES> Create a fingerprint from an InChI string: biosynfoni <InChI> Write the fingerprints of all molecules in an SDF file to a CSV file: biosynfoni <molecule_supplier.sdf>: "Create a fingerprint from a SMILES string: biosynfoni <SMILES> Create a fingerprint from an InChI string: biosynfoni <InChI> Write the fingerprints of all molecules in an SDF file to a CSV file:"
- [other] Load a natural-product molecule structure from SMILES or SDF input using the biosynfoni API.: "Load a natural-product molecule structure from SMILES or SDF input using the biosynfoni API"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.