科研 Skill
逆合成路线规划
retrosynthesis-route-planning
Generates candidate retrosynthesis routes for a target SMILES using AiZynthFinder’s template-based search. Use before literature or expert route review.
SKILL.md
Retrosynthesis Route Planning
Purpose
Given a target molecule, propose one or more candidate synthetic routes back to purchasable (or otherwise available) starting materials. This skill wraps AiZynthFinder, an open-source Monte Carlo tree search (MCTS) retrosynthesis tool that combines a neural one-step retrosynthesis policy with a stock of known building blocks to find routes automatically, without requiring a chemist to hand-enumerate disconnections.
This skill generates candidate routes. It does not judge whether a route is
good, safe, or scalable — pass its output to review-routes (deterministic
evidence review against literature precedent) or to a human expert before
acting on it.
When to Use This Skill
- A target molecule (drug candidate, ligand, probe, material precursor) needs candidate synthesis routes and no known route is on hand.
- Comparing several algorithmically proposed routes by number of steps, route score, or availability of starting materials.
- Pre-screening synthesizability for a virtual library before committing wet-lab resources (e.g., as a quick "can this be made from stock reagents in <=5 steps" filter during hit triage).
- Feeding candidate routes into
review-routesfor evidence-based vetting, or intosearch-reactionsto check whether proposed steps have literature precedent.
When Not to Use This Skill
- When a known, literature-verified route already exists — search for it with
search-reactionsor the primary literature instead of re-deriving one. - For multi-component materials, polymers, or biologics without a well-defined small-molecule target graph — AiZynthFinder operates on single organic molecules expressible as SMILES.
- As a final answer for "how do I make this" without expert review — see Limitations below.
Prerequisites
-
Python 3.9–3.11 (check current support in the AiZynthFinder release notes — supported versions change between releases).
-
pip install aizynthfinder(also installsrdkit,pandas, and the search engine itself). A GPU is not required; the expansion policy runs on CPU but a search can take tens of seconds to a few minutes per target. -
Pre-trained public model files and a stock of purchasable building blocks, downloaded once:
mkdir -p aizynthfinder_data python -m aizynthfinder.tools.download_public_data aizynthfinder_dataThis downloads (several hundred MB to a few GB) a trained one-step expansion policy, a filter policy, and a "ZINC"-derived stock of purchasable molecules published by the AiZynthFinder authors. Internet access is required once, at setup time; route search itself runs fully offline afterward.
-
A valid target SMILES string, ideally already passed through
standardize-chemical-structuresso it is sanitized and canonical.
Core Workflow
Step 1 — Configure the finder
# config.yml (paths point at files produced by download_public_data)
policy:
files:
uspto:
- aizynthfinder_data/uspto_model.onnx
- aizynthfinder_data/uspto_templates.csv.gz
filter:
files:
uspto: aizynthfinder_data/uspto_filter_model.onnx
stock:
files:
zinc: aizynthfinder_data/zinc_stock.hdf5
Step 2 — Run a search
from aizynthfinder.aizynthfinder import AiZynthFinder
finder = AiZynthFinder(configfile="config.yml")
finder.stock.select("zinc")
finder.expansion_policy.select("uspto")
finder.filter_policy.select("uspto")
finder.target_smiles = "COc1ccc2[nH]c(S(=O)Cc3ncc(C)c(OC)c3C)nc2c1" # example: omeprazole
finder.tree_search()
finder.build_routes()
stats = finder.extract_statistics()
print(f"Solved: {stats['is_solved']}, routes found: {stats['number_of_routes']}")
routes = finder.routes
for i, route in enumerate(routes):
print(f"\nRoute {i}: score={route['all_score']:.3f}, "
f"steps={route['route'].get('children', [])}")
Step 3 — Inspect and rank routes
# Each route is scored on a mix of length, stock availability of the leaves,
# and model confidence in each retrosynthetic step. Export a readable summary:
for i, route in enumerate(routes):
tree = route["route"]
leaves = [n["smiles"] for n in route.get("stock_info", {}).get("leaves", [])] \
if "stock_info" in route else []
print(f"Route {i}: score={route.get('all_score'):.3f} "
f"in_stock_leaves={route.get('in_stock', 'n/a')}")
# Save routes for downstream review (feed this file to review-routes)
import json
with open("candidate_routes.json", "w") as fh:
json.dump(
[{"rank": i, "score": r.get("all_score"), "tree": r["route"]}
for i, r in enumerate(routes)],
fh, indent=2,
)
Step 4 — Hand off for evidence review
Do not treat a high AiZynthFinder score as proof a route works. Pass
candidate_routes.json to the review-routes skill (or a domain chemist) to
check each step against literature precedent, reagent availability, and
reaction-condition feasibility before any wet-lab commitment.
Advanced Usage
Comparing multiple expansion policies
AiZynthFinder supports swapping in different trained expansion policies (e.g.,
a template-free model, or a custom in-house template library) via the same
config.yml structure. Compare finder.extract_statistics() across policies
to see which proposes shorter or higher-confidence routes for a given
chemotype — do not assume the default USPTO-trained policy generalizes to
chemistry far outside patent literature (e.g., organometallic, heterocyclic
materials, or biocatalysis).
Custom stock files
Replace the default ZINC-derived stock with an in-house or vendor catalog
(e.g., eMolecules, Enamine REAL) exported as SMILES and converted with
AiZynthFinder's make_stock utility, so "in stock" reflects reagents actually
available to the user rather than a generic public catalog.
python -m aizynthfinder.tools.make_stock --files my_catalog.smi --output my_stock.hdf5
Batch mode for virtual-library triage
import pandas as pd
from aizynthfinder.aizynthfinder import AiZynthFinder
finder = AiZynthFinder(configfile="config.yml")
finder.stock.select("zinc")
finder.expansion_policy.select("uspto")
results = []
for smi in pd.read_csv("candidates.csv")["smiles"]:
finder.target_smiles = smi
finder.tree_search()
finder.build_routes()
stats = finder.extract_statistics()
results.append({"smiles": smi, "solved": stats["is_solved"],
"n_routes": stats["number_of_routes"],
"top_score": stats.get("top_score")})
pd.DataFrame(results).to_csv("synthesizability_triage.csv", index=False)
Common Failure Modes
| Symptom | Likely cause | Fix |
|---|---|---|
is_solved: False for every target | Target chemotype far from USPTO training distribution (e.g., novel heterocycle, organometallic) | Try a different/larger stock, increase search.max_transforms/iteration budget, or accept the target needs expert/novel-reaction design beyond template-based search |
| Routes score well but steps look implausible | Template application without a reliability check on the proposed reagents/conditions | Always cross-check top routes with search-reactions or primary literature before trusting a step |
| Very slow search | Large max_transforms, big stock file loaded repeatedly, or no filter policy pruning bad expansions | Load stock/policy objects once outside loops (as in Batch mode above), cap iteration budget, enable the filter policy |
| Only trivial 1-step "routes" returned | Target itself (or a close analog) is already in the stock file | Expected behavior — check finder.target_smiles is the right final product, not an intermediate |
Limitations
- AiZynthFinder is template-based: the public USPTO-trained model and templates reflect reactions that appear in US patent literature. Coverage is biased toward pharmaceutical/fine-chemical organic synthesis and weak for novel transformations, organometallic chemistry, polymer/materials synthesis, and biocatalysis. A target outside this distribution may come back "unsolved" even when a real route exists.
- A route being "solved" (all leaves in stock) and well-scored is a computational plausibility signal, not a verified synthesis. Reaction feasibility, yield, chemoselectivity, functional-group compatibility across steps, and scale-up hazards are not modeled and must be checked by a chemist.
- The default public stock reflects a generic commercial catalog (ZINC-derived purchasable set) at the time it was published; it will not reflect what a specific lab or vendor actually has on the shelf today. Supply your own stock file for decisions that matter.
- Search is stochastic (MCTS) — results can differ slightly between runs with the same target unless a random seed is fixed; always report the top few routes, not just the single best score, and re-run before concluding a target is "unsolvable."
Quality Checks Before Reporting Routes
- Target SMILES was validated/standardized (see
standardize-chemical-structures) before search. - Report route count,
is_solvedstatus, and top-N scores, not only the single best route. - Flag which stock file was used (public ZINC-derived vs. a custom catalog) since "in stock" is meaningless without that context.
- Recommend
review-routesor literature lookup (search-reactions) before any route is acted on experimentally. - Note model/template provenance (training corpus, AiZynthFinder version) alongside any reported route for reproducibility.
示例提示词
给定目标分子的SMILES,用AiZynthFinder生成候选逆合成路线供专家复核。
所属插件
安装该插件会一并获得同领域的 32 个 Skill / MCP。
同插件的其他科研 Skill
- ASE原子模拟环境Builds and analyzes atomic structures with ASE: geometry optimization, NEB transition states, and MD trajectories. Use for setting up or analyzing atomistic simulations.
- 电池材料计算工作流Guides DFT/pymatgen workflows for battery materials: voltage profiles, phase stability, and ion migration barriers. Use for cathode, anode, or electrolyte computation.
- 催化剂设计指导Advises on catalyst composition, structure, and synthesis strategy using a traceable methodology base. Use when designing or optimizing a catalyst for a given reaction.
- 催化文献检索整理Searches arXiv, OpenAlex, and journal sites for catalysis literature and outputs a structured matrix. Use for catalysis literature reviews on a reaction or material system.
- ChEMBL生物活性数据查询Queries the ChEMBL API for bioactivity data: target lookup, IC50/Ki retrieval, and SAR tables. Use to build bioactivity datasets for a protein target.
- 量子化学计算工作流Guides quantum chemistry workflows with ORCA and xTB: geometry optimization, thermochemistry, and transition-state search. Use for first-principles energy calculations.
- 分子描述符与指纹计算Computes versioned 2D descriptors, Morgan/MACCS fingerprints, and dataset quality profiles with fixed RDKit. Use to generate reproducible features or audit data quality.
- 腐蚀电化学分析Guides corrosion analysis: electrode potentials, polarization curves, impedance, and Pourbaix diagrams. Use for electrochemical stability or corrosion-kinetics reasoning.
- 化学反应数据整理Curates structured single-step reactions against an ORD schema and RDKit, preserving originals. Use to clean reaction SMILES or tables and flag duplicates or mass-balance issues.
- RDKit简化分子处理Wraps RDKit with sensible defaults for SMILES parsing, standardization, descriptors, and conformers. Use for standard drug-discovery tasks; use rdkit for advanced control.
- 红外拉曼光谱分析Processes IR and Raman spectra with baseline correction, peak picking, and functional-group assignment. Use to interpret vibrational spectra against reference data.
- 质谱相似性比对Computes spectral similarity scores and identifies unknown compounds from mass-spectral libraries. Use for metabolite identification; use pyopenms for full proteomics pipelines.
- 分子动力学轨迹分析Analyzes MD trajectories from GROMACS, AMBER, LAMMPS, or NAMD with MDAnalysis: RMSD, RMSF, and contact maps. Use when analyzing existing trajectory files.
- 药物化学分子过滤Applies drug-likeness rules and structural alert catalogs (PAINS, NIBR) to compound libraries. Use for triaging compound libraries early in drug discovery.
- 分子数据集构建与清洗Guides molecular ML dataset building: source selection, deduplication, unit harmonization, and leakage-aware splits. Use before training molecular property models.
- 分子特征化方法Guides molecular featurization strategy for ML: parsing, fingerprints, and descriptor selection. Use when designing a featurization pipeline before model training.
- 分子机器学习特征化Converts molecules into ML-ready features using 100+ pretrained and hand-crafted featurizers. Use for QSAR modeling or virtual-screening feature generation at scale.
- 核磁共振谱图分析Processes raw NMR FID data through Fourier transform and phase correction, then picks peaks with nmrglue. Use for processing and interpreting 1D/2D NMR spectra.
- 化学文件格式转换Converts chemical file formats and generates 3D coordinates and conformers with OpenBabel and RDKit. Use when interconverting structure formats or generating 3D structures.
- 粉末XRD物相分析Simulates powder XRD patterns from candidate structures and matches them to an experimental pattern. Use for phase ID; use dedicated software for full Rietveld refinement.
- pymatgen晶体材料分析Manipulates crystal structures and queries the Materials Project API for band gaps and formation energies. Use for computational materials science on crystal structures.
- 蛋白质组质谱分析Processes proteomics and metabolomics MS data via OpenMS bindings: feature detection and peptide ID. Use for LC-MS/MS pipelines; use matchms for simpler spectral comparison.
- PySCF量子化学计算Runs ab initio and DFT calculations with PySCF: HF/DFT energies, optimization, and MP2/CCSD(T). Use for first-principles molecular energy and property calculations.
- RDKit化学信息学Provides fine-grained RDKit control: I/O, descriptors, fingerprints, substructure search, and reactions. Use for advanced workflows; use datamol for a simpler interface.
常见问题
逆合成路线规划能做什么?
Generates candidate retrosynthesis routes for a target SMILES using AiZynthFinder’s template-based search. Use before literature or expert route review。
如何安装逆合成路线规划?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「逆合成路线规划」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
逆合成路线规划需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
逆合成路线规划经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。