parse_reaction
Convert reaction files (CDXML, CDX, RXN, CSV) into a structured JSON descriptor with roles, SMILES, and conditions for downstream analysis.
Instructions
Parse reaction files into a semantic JSON descriptor.
Extracts every species with canonical SMILES, role classification (using Schneider fingerprint scoring for reactant/reagent binary, plus curated database for semantic roles like base/solvent/catalyst), display names, equivalents, mass data, and adducts. Produces a single JSON source of truth suitable for summarize_reaction, render_scheme, or LCMS analysis.
Provide at least one file path. Multiple may be combined (e.g. cdxml + csv) to merge structural data with ELN metadata.
Args: cdxml: Path to a .cdxml reaction file. cdx: Path to a .cdx reaction file (converted internally). csv: Path to a Findmolecule ELN CSV export. rxn: Path to a .rxn file. input_dir: Directory containing experiment files (auto-discovers cdxml/cdx/csv/rxn by experiment ID). output_path: If given, write the result JSON to this file and return {ok, output_path} instead of the full dict.
Returns: Reaction descriptor dict with keys: version, experiment, input_files, reaction_smiles, reaction_class, species (list with role, smiles, formula, mw, etc.), conditions, and eln_data. When output_path is provided, returns {ok, output_path} instead.
Safety override: Parse a reaction and atomically publish its JSON descriptor.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cdx | No | ||
| csv | No | ||
| rxn | No | ||
| cdxml | No | ||
| input_dir | No | ||
| output_path | No |