Chemical Structure Validation & Syntax Checking
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution.
Summary
Validates raw SMILES strings for correct chemical syntax and parsability using RDKit before downstream processing. This skill ensures that only chemically valid structures enter the curation pipeline, preventing silent failures in canonicalization and coordinate generation.
When to use
Applied immediately after loading raw SMILES strings from external databases or user input during the 2_curating workflow stage, before attempting canonicalization or 2D/3D coordinate generation. Use this skill when you have ungoverned or heterogeneous SMILES from multiple sources and cannot assume they are well-formed.
When NOT to use
- Input SMILES have already been validated by a trusted upstream source (e.g., ChEMBL or PubChem curated downloads with integrity checks).
- You are only analyzing structure-activity relationships and do not need 3D coordinates; invalid SMILES may still carry semantic information in some contexts.
- The workflow step is 3_analyzing or later; structure validation should have occurred during 2_curating.
Inputs
- Raw SMILES strings (TSV or CSV format, e.g., interim/tables/0_original/structure/smiles.tsv.gz)
- Pandas DataFrame or iterable of SMILES strings
Outputs
- Validated SMILES (subset of input passing syntax checks)
- Rejected SMILES list with error messages
- Boolean validation flags per input record
How to apply
Parse each SMILES string into an RDKit molecule object using RDKit's SMILES parser and evaluate whether the parse succeeds without exception. Invalid SMILES will fail to create a valid mol object; catch these failures and flag or remove them before proceeding. This is a prerequisite for later steps (canonicalization, stereocounting, coordinate generation) because RDKit requires a valid mol object to compute molecular properties and representations. The rationale is that garbage SMILES early in the pipeline propagate errors throughout the curation, reducing the final yield of usable 2D/3D structure records.
Related tools
Examples
from rdkit import Chem; valid_mols = [Chem.MolFromSmiles(smi) for smi in smiles_list]; valid_smiles = [smi for smi, mol in zip(smiles_list, valid_mols) if mol is not None]
Evaluation signals
- Percentage of input SMILES that parse successfully (yield rate); expect >90% for curated sources, <80% for raw databases.
- Absence of downstream RDKit errors during canonicalization and coordinate generation; all records that passed validation should proceed without parse failures.
- Comparison of valid SMILES count to final 2D/3D record count; a large drop suggests late-stage filtering issues unrelated to syntax.
- Manual spot-check of rejected SMILES for known malformations (e.g., mismatched brackets, invalid atom symbols, disconnected fragments).
- Cross-validation: re-parse all 'valid' SMILES in a second pass to confirm consistency.
Limitations
- RDKit's SMILES parser is permissive and may accept non-standard or ambiguous SMILES that are syntactically valid but chemically nonsensical (e.g., hypervalent atoms). Syntax validation does not guarantee chemical correctness.
- No stereochemical validation at this stage; that is handled separately by stereocounting.py. Invalid stereochemistry (e.g., [C@@H] on a non-stereogenic center) may pass syntax checks.
- Tautomeric and resonance ambiguities are not resolved by syntax checking; canonicalization with RDKit's MolToSmiles(kekulize=False) occurs in a later step.
- SMILES with isotope labels, radical charges, or rare bond types may parse but cause issues in later 3D coordinate generation; syntax validation alone cannot catch these.
Evidence
- [methods] Parse each SMILES string into RDKit molecule objects and validate chemical syntax.: "Parse each SMILES string into RDKit molecule objects and validate chemical syntax."
- [methods] The LOTUS processor employs Python with RDKit-based tools (smiles.py, sanitizing.py, stereocounting.py) as part of the 2_curating workflow stage to process and standardize molecular structures.: "The LOTUS processor employs Python with RDKit-based tools (smiles.py, sanitizing.py, stereocounting.py) as part of the 2_curating workflow stage to process and standardize molecular structures"
- [methods] Load raw SMILES strings from interim/tables/0_original/structure/smiles.tsv.gz using pandas.: "Load raw SMILES strings from interim/tables/0_original/structure/smiles.tsv.gz using pandas."
1---2name: chemical-structure-validation-syntax3description: Use when applied immediately after loading raw SMILES strings from external databases or user input during the 2_curating workflow stage, before attempting canonicalization or 2D/3D coordinate generation.4license: CC-BY-4.05---67# Chemical Structure Validation & Syntax Checking89> **License: restricted** — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->10## Summary1112Validates raw SMILES strings for correct chemical syntax and parsability using RDKit before downstream processing. This skill ensures that only chemically valid structures enter the curation pipeline, preventing silent failures in canonicalization and coordinate generation.1314## When to use1516Applied immediately after loading raw SMILES strings from external databases or user input during the 2_curating workflow stage, before attempting canonicalization or 2D/3D coordinate generation. Use this skill when you have ungoverned or heterogeneous SMILES from multiple sources and cannot assume they are well-formed.1718## When NOT to use1920- Input SMILES have already been validated by a trusted upstream source (e.g., ChEMBL or PubChem curated downloads with integrity checks).21- You are only analyzing structure-activity relationships and do not need 3D coordinates; invalid SMILES may still carry semantic information in some contexts.22- The workflow step is 3_analyzing or later; structure validation should have occurred during 2_curating.2324## Inputs2526- Raw SMILES strings (TSV or CSV format, e.g., interim/tables/0_original/structure/smiles.tsv.gz)27- Pandas DataFrame or iterable of SMILES strings2829## Outputs3031- Validated SMILES (subset of input passing syntax checks)32- Rejected SMILES list with error messages33- Boolean validation flags per input record3435## How to apply3637Parse each SMILES string into an RDKit molecule object using RDKit's SMILES parser and evaluate whether the parse succeeds without exception. Invalid SMILES will fail to create a valid mol object; catch these failures and flag or remove them before proceeding. This is a prerequisite for later steps (canonicalization, stereocounting, coordinate generation) because RDKit requires a valid mol object to compute molecular properties and representations. The rationale is that garbage SMILES early in the pipeline propagate errors throughout the curation, reducing the final yield of usable 2D/3D structure records.3839## Related tools4041- **RDKit** (Parse and validate SMILES syntax; raise exceptions for malformed input.) — https://www.rdkit.org42- **smiles.py** (LOTUS processor module that wraps RDKit validation as part of structure curation.) — https://github.com/lotusnprod/lotus-processor43- **Python 3** (Runtime environment for RDKit and error handling.)4445## Examples4647```48from rdkit import Chem; valid_mols = [Chem.MolFromSmiles(smi) for smi in smiles_list]; valid_smiles = [smi for smi, mol in zip(smiles_list, valid_mols) if mol is not None]49```5051## Evaluation signals5253- Percentage of input SMILES that parse successfully (yield rate); expect >90% for curated sources, <80% for raw databases.54- Absence of downstream RDKit errors during canonicalization and coordinate generation; all records that passed validation should proceed without parse failures.55- Comparison of valid SMILES count to final 2D/3D record count; a large drop suggests late-stage filtering issues unrelated to syntax.56- Manual spot-check of rejected SMILES for known malformations (e.g., mismatched brackets, invalid atom symbols, disconnected fragments).57- Cross-validation: re-parse all 'valid' SMILES in a second pass to confirm consistency.5859## Limitations6061- RDKit's SMILES parser is permissive and may accept non-standard or ambiguous SMILES that are syntactically valid but chemically nonsensical (e.g., hypervalent atoms). Syntax validation does not guarantee chemical correctness.62- No stereochemical validation at this stage; that is handled separately by stereocounting.py. Invalid stereochemistry (e.g., [C@@H] on a non-stereogenic center) may pass syntax checks.63- Tautomeric and resonance ambiguities are not resolved by syntax checking; canonicalization with RDKit's MolToSmiles(kekulize=False) occurs in a later step.64- SMILES with isotope labels, radical charges, or rare bond types may parse but cause issues in later 3D coordinate generation; syntax validation alone cannot catch these.6566## Evidence6768- [methods] Parse each SMILES string into RDKit molecule objects and validate chemical syntax.: "Parse each SMILES string into RDKit molecule objects and validate chemical syntax."69- [methods] The LOTUS processor employs Python with RDKit-based tools (smiles.py, sanitizing.py, stereocounting.py) as part of the 2_curating workflow stage to process and standardize molecular structures.: "The LOTUS processor employs Python with RDKit-based tools (smiles.py, sanitizing.py, stereocounting.py) as part of the 2_curating workflow stage to process and standardize molecular structures"70- [methods] Load raw SMILES strings from interim/tables/0_original/structure/smiles.tsv.gz using pandas.: "Load raw SMILES strings from interim/tables/0_original/structure/smiles.tsv.gz using pandas."