reinvent_analyze_molecules
Evaluate SMILES for drug-likeness, diversity, and alerts. Generates analysis report, per-molecule metrics, and optional plots, including reference-based similarity and novelty.
Instructions
Evaluate a set of generated SMILES across multiple quality dimensions.
Designed for raw sampling output (CSV or .smi) from reinvent_sampling, but works with any SMILES file. Writes an analysis_report.json and per_molecule.csv to disk and returns a structured summary to the agent.
Evaluators available: Always: validity, physicochemical, druglikeness, scaffold, alerts, diversity With ref: similarity, novelty, coverage (auto-skipped if no ref_smiles_file)
physicochemical covers: MW, LogP, TPSA, HBD, HBA, rotatable bonds, num atoms (incl. H), num heavy atoms, num heteroatoms, fraction heteroatoms, num rings, num aromatic rings, num aliphatic rings. druglikeness covers: QED, Lipinski RO5, Veber rules, SA score (if available). scaffold: Bemis-Murcko scaffold count and diversity. alerts: PAINS and Brenk structural alert rates. diversity: internal diversity (1 − mean pairwise Tanimoto, ECFP4). similarity: nearest-neighbour Tanimoto to reference set. novelty: % generated SMILES not present in reference (exact canonical match). coverage: % reference molecules with ≥1 generated neighbour at Tanimoto ≥ 0.4.
When plots=True, generates PNGs: physicochemical_dist.png — MW/LogP/TPSA/HBD/HBA/QED(/SA) histograms atom_profile.png — num atoms/heavy/hetero/frac_het/rotbonds/rings atom_types.png — element frequency bar chart (C/N/O/S/halogens/…) ring_profile.png — total/aromatic/aliphatic ring histograms similarity_hist.png — NN Tanimoto to ref (if ref provided) umap_projection.png — ECFP4 UMAP; requires umap-learn
Args: smiles_file: Path to sampling CSV or .smi file (SMILES col auto-detected). ref_smiles_file: Optional reference / known-active SMILES file. evaluators: List of evaluator names, or "all" (default). plots: Generate PNG plots (default True). Set False to skip all visualisation. color_by: Property to colour generated UMAP points (viridis). Any column in per_molecule.csv: "qed", "mw", "sa_score", "logp", "tpsa", etc. Default None = generated blue / reference red. output_dir: Where to write outputs (default: _analysis/ next to input).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plots | No | ||
| color_by | No | ||
| evaluators | No | all | |
| output_dir | No | ||
| smiles_file | Yes | ||
| ref_smiles_file | No |