Command Line Interface¶
The RetroCast CLI provides a unified interface for standardizing, scoring, and analyzing retrosynthesis predictions.
Two modes of operation
Project Mode Structured workflow for reproducible benchmarking of multiple models
Ad-Hoc Mode
Direct commands for processing individual files without configuration
Installation¶
Verify installation:
Ad-Hoc Workflow¶
When to use ad-hoc mode
Use these commands to process single files immediately without setting up a project directory. Great for:
- Quick experiments
- One-off evaluations
- Testing new adapters
adapt - Convert Raw Predictions¶
Convert raw output from a supported model into the standardized RetroCast format.
retrocast adapt \
--input raw_predictions.json.gz \
--adapter aizynth \ # (1)!
--output standardized_routes.json.gz \
--benchmark benchmark.json.gz # (2)!
- See available adapters with
retrocast list-adapters - Optional: Ensures target IDs match exactly
Supported adapters: aizynth, dms, retrostar, synplanner, syntheseus, askcos, retrochimera, dreamretro, multistepttl, synllama, paroutes
score-file - Evaluate Routes¶
Evaluate standardized routes against a stock file.
retrocast score-file \
--benchmark benchmark.json.gz \
--routes standardized_routes.json.gz \
--stock stock_smiles.txt \ # (1)!
--output scores.json.gz \
--model-name "My-Experiment"
- Text file with one canonical SMILES per line
Output: JSON file with boolean flags (is_solved, matches_ground_truth, etc.)
create-benchmark - Generate Benchmarks¶
Generate a benchmark definition file from a simple list of SMILES strings.
retrocast create-benchmark \
--input targets.txt \ # (1)!
--name "custom-benchmark" \
--stock-name "zinc-stock" \
--output custom-benchmark.json.gz
- Text file or CSV with SMILES strings
Project Workflow¶
Recommended for research
For large-scale evaluations, use project mode for:
- Reproducible benchmarking
- Multiple models comparison
- Cryptographic audit trail
- Automated manifest tracking
init - Initialize Project¶
Generate a default configuration file and directory structure:
Creates:
retrocast-config.yaml- Model configurationdata/directory structure
Configuration¶
Edit retrocast-config.yaml to register your models:
models:
dms-explorer: # (1)!
adapter: dms # (2)!
raw_results_filename: predictions.json # (3)!
sampling: # (4)!
strategy: top-k
k: 50
- Model identifier (used in CLI commands)
- Adapter type (see
retrocast list-adapters) - Expected filename in
data/2-raw/<model>/<benchmark>/ - Optional: Limit routes per target
Advanced configuration
The Pipeline¶
graph LR
A[data/2-raw/] --> B[ingest]
B --> C[data/3-processed/]
C --> D[score]
D --> E[data/4-scored/]
E --> F[analyze]
F --> G[data/5-results/]
ingest - Standardize Routes¶
Transforms raw model outputs into standardized Route objects.
- Optional: Hashes the model name for blind review
Input: data/2-raw/<model>/<dataset>/<raw_results_filename>
Output: data/3-processed/<model>/<dataset>/routes.json.gz
Operations:
- Parse raw format via adapter
- Canonicalize SMILES
- Deduplicate routes
- Apply sampling strategy (if configured)
score - Evaluate Routes¶
Evaluates processed routes against benchmark stock.
- Optional: Override default benchmark stock
Input: data/3-processed/<model>/<dataset>/routes.json.gz
Output: data/4-scored/<model>/<dataset>/<stock>/scores.json.gz
Annotations added:
is_solved- All leaves in stockmatches_ground_truth- Route matches referencelength- Number of stepsis_convergent- Contains convergent reactions
analyze - Generate Reports¶
Aggregates scores into statistical reports with confidence intervals.
retrocast analyze \
--model dms-explorer \
--dataset paroutes-n1 \
--make-plots \ # (1)!
--top-k 1 5 10 50 # (2)!
- Generates interactive HTML visualizations
- Customizes K values (default: 1, 3, 5, 10, 20, 50, 100)
Input: data/4-scored/<model>/<dataset>/<stock>/scores.json.gz
Output: data/5-results/<dataset>/<model>/
report.md- Statistical summary*.html- Interactive plots (if--make-plots)
Metrics computed:
- Overall Solvability with 95% CI (bootstrap)
- Top-K accuracy (K ∈ {1, 3, 5, 10, ...})
- Stratified performance by route length
- Ground truth match rate
Verification & Auditing¶
Cryptographic audit trail
RetroCast generates a manifest.json for every file it creates, tracking:
- Input file SHA256 hashes
- Command parameters
- Output file hashes
- Timestamp and RetroCast version
verify - Check Data Integrity¶
Verify the integrity of your data pipeline:
- Optional: Recursively verify entire dependency graph
Verification modes:
Verifies that the file on disk matches the SHA256 hash in its manifest.
What it detects:
Data corruption
Manual file tampering
Out-of-order execution
Hash mismatches
Helper Commands¶
list - Show Configured Models¶
Lists all models in retrocast-config.yaml:
Output:
Configured models:
- dms-explorer (adapter: dms)
- aizynthfinder-mcts (adapter: aizynth)
- retro-star (adapter: retrostar)
list-adapters - Show Available Adapters¶
Lists all built-in adapters:
Output:
Available adapters:
- aizynth: AiZynthFinder (bipartite graph)
- dms: DirectMultiStep (recursive dict)
- retrostar: Retro* (precursor map)
- synplanner: SynPlanner (bipartite graph)
- syntheseus: Syntheseus (bipartite graph)
- askcos: ASKCOS (custom format)
- retrochimera: RetroChimera (precursor map)
- dreamretro: DreamRetro (precursor map)
- multistepttl: MultiStepTTL (custom format)
- synllama: SynLlama (precursor map)
- paroutes: PaRoutes (reference format)
info - Show Model Details¶
Display configuration details for a specific model:
Output:
Model: dms-explorer
Adapter: dms
Raw results filename: predictions.json
Sampling:
Strategy: top-k
K: 50
Command Reference¶
Quick Lookup¶
| Command | Purpose | Input | Output |
|---|---|---|---|
init |
Initialize project | - | retrocast-config.yaml |
adapt |
Convert raw → standardized | Raw predictions | Route objects |
score-file |
Evaluate routes | Routes + stock | Scored routes |
create-benchmark |
Generate benchmark | SMILES list | Benchmark JSON |
ingest |
Standardize (project mode) | data/2-raw/ |
data/3-processed/ |
score |
Evaluate (project mode) | data/3-processed/ |
data/4-scored/ |
analyze |
Generate report | data/4-scored/ |
data/5-results/ |
verify |
Audit integrity | Manifest files | Validation report |
list |
Show models | retrocast-config.yaml |
Model list |
list-adapters |
Show adapters | - | Adapter list |
info |
Show model config | Model name | Config details |