# Smiles String Parsing

> Use when when you have a raw list of SMILES strings in a file and need to prepare them as input for CFM-ID in silico spectrum generation to create pseudo SMILES-spectrum training pairs.

- Skill: `holobiomicslab/smiles-string-parsing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add holobiomicslab/smiles-string-parsing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/holobiomicslab/smiles-string-parsing/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: CC-BY-4.0
- Author: HolobiomicsLab (https://skillmd.com/u/holobiomicslab)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/holobiomicslab/smiles-string-parsing

---


# SMILES-string-parsing

## Summary

Parse and load SMILES strings from input files to prepare molecular structure notations for downstream in silico spectrum generation and model training. This skill validates that raw SMILES lists are correctly formatted and ready for CFM-ID fragmentation prediction.

## When to use

When you have a raw list of SMILES strings in a file and need to prepare them as input for CFM-ID in silico spectrum generation to create pseudo SMILES-spectrum training pairs. Use this skill as the first step in a pseudo-data generation pipeline where SMILES strings must be parsed before being paired with computationally predicted spectra.

## When NOT to use

- Input is already a set of spectrum-SMILES pairs; skip directly to training.
- SMILES strings have already been validated and indexed in a prior workflow step.
- Your input is already in a molecular graph or fingerprint format; this skill is for raw SMILES text only.

## Inputs

- Text file containing raw SMILES strings (one per line)
- SMILES list file (format: plain text, one SMILES notation per line)

## Outputs

- Parsed SMILES string list (in-memory or serialized)
- Indexed SMILES data structure ready for CFM-ID invocation
- Count of valid SMILES strings (for validation)

## How to apply

Load the SMILES strings from the input file using Python 3.7, ensuring each line contains a valid SMILES notation. Validate that each parsed SMILES string is well-formed and non-empty. Store the parsed SMILES strings in a data structure (e.g., list or array) indexed sequentially for correlation with CFM-ID outputs. The rationale is that CFM-ID requires valid SMILES input and will fail or produce spurious results if malformed strings are passed; pre-parsing catches errors early. After parsing, confirm the count of SMILES strings matches the input file line count as a sanity check.

## Related tools

- **CFM-ID** (Consumes parsed SMILES strings to generate in silico mass spectra with fragmentation patterns for each molecule)
- **Python 3.7** (Host language for loading and validating SMILES strings from input files)

## Evaluation signals

- All lines from the input file are successfully parsed without exceptions.
- Each parsed SMILES string is non-empty and contains only valid SMILES characters (C, H, N, O, rings, bonds, branch notation, etc.).
- The count of parsed SMILES strings matches the expected input file line count (or documented subset if filtering was applied).
- The indexed SMILES list can be iterated sequentially and each entry is correctly mapped to its input line position for later pairing with CFM-ID spectra.
- Downstream CFM-ID invocation completes without errors when passed the parsed SMILES list.

## Limitations

- The skill does not validate chemical feasibility or stereochemistry correctness; it only checks syntactic SMILES format validity.
- If the input file contains duplicate SMILES strings, this skill will not deduplicate unless explicitly configured to do so; duplicates will be parsed and later generate redundant pseudo-pairs.
- Large SMILES lists (e.g., >100k strings) may require streaming or chunking in memory-constrained environments.
- The skill assumes SMILES strings are one per line in plaintext; other formats (e.g., CSV columns, JSON) require custom parsing logic not covered here.

## Evidence

- [other] Load a list of SMILES strings from the input file: "Load a list of SMILES strings from the input file."
- [other] For each SMILES string, invoke CFM-ID to generate in silico mass spectra: "For each SMILES string, invoke CFM-ID to generate in silico mass spectra with fragmentation patterns."
- [readme] For Training, we use 30k+ pseudo smiles-spectrum pairs generated by cfmid: "For Training, we use 30k+ pseudo smiles-specturm pairs generated by cfmid"

