Install
openclaw skills install @orionshaowswmw/classical-ml-drug-discoveryEnd-to-end, evidence-aware drug-discovery skill for building and auditing molecular QSAR, virtual-screening, ADMET, toxicity, binding-affinity, and drug-target models with Random Forests, Support Vector Machines/Regression, and Gradient Boosting. Use when a user asks to curate bioactivity data, compare RF/SVM/XGBoost, design leakage-resistant chemical validation, screen a compound library, assess applicability domain or uncertainty, select diverse experimental candidates, audit a molecular ML paper, or identify open-source cheminformatics software and web services.
openclaw skills install @orionshaowswmw/classical-ml-drug-discoveryBuild defensible molecular machine-learning workflows with Random Forest (RF), Support Vector Machine/Regression (SVM/SVR), and Gradient Boosting (GB)—then turn predictions into a diverse, uncertainty-aware experimental shortlist rather than unsupported claims.
This skill is for computational decision support. It never treats a model score as proof of binding, efficacy, safety, mechanism, or clinical utility.
Invoke this skill when the user asks for any of the following:
If the user provides a CSV with smiles and a response column, use the bundled CLI:
SKILL_DIR="${SKILL_DIR:-$HOME/skills/classical-ml-drug-discovery}"
# 1) Audit chemistry, endpoints, duplicates, and conflicts without training
python3 "$SKILL_DIR/scripts/qsar_pipeline.py" audit \
--input compounds.csv \
--smiles-column smiles \
--target-column activity \
--task classification \
--output-dir audit_output
# 2) Train leakage-aware RF, SVM, and gradient-boosting baselines
python3 "$SKILL_DIR/scripts/qsar_pipeline.py" train \
--input compounds.csv \
--smiles-column smiles \
--target-column activity \
--task classification \
--split scaffold \
--models rf svm gb xgb \
--output-dir qsar_run
# 3) Predict an external library with a similarity-based domain flag
python3 "$SKILL_DIR/scripts/qsar_pipeline.py" predict \
--model qsar_run/model.joblib \
--trust-model \
--input library.csv \
--smiles-column smiles \
--output predictions.csv
xgb is optional and is skipped with an actionable message if XGBoost is not installed.
The required local packages are documented in requirements-optional.txt.
Capture the following before touching labels:
| Field | Required answer |
|---|---|
| Biological question | Target, phenotype, property, or safety liability |
| Endpoint | Exact measurement, units, transform, species, construct, assay |
| Prediction mode | Classification, regression, or ranking |
| Deployment population | Lead series, public library, novel scaffolds, new target, future data |
| Experimental budget | Number or fraction of compounds that can be tested |
| Error costs | Relative cost of false positives and false negatives |
| Novelty requirement | Same-series optimization or scaffold hopping |
| Required evidence | Retrospective, external, prospective biochemical, cellular, PK, in vivo |
| Confidentiality | Whether structures/labels may leave the local machine |
If the request is underspecified and the missing choice changes the analysis, ask focused questions. If the user requests autonomous full execution, choose conservative defaults, record them, and continue.
Preferred public sources include:
Record database version, retrieval date, exact query, target identifier, assay filters, units, qualifiers, and data license. Do not scrape a source that forbids automated access.
Perform and report:
For molar potency, use pActivity = -log10(activity in molar units) only when the source
units and endpoint type are consistent. Preserve raw values and qualifiers.
Benchmark at least two representations when data allow:
The bundled CLI combines Morgan bits with a compact RDKit descriptor panel and stores the feature specification in the model bundle.
Choose the split that matches deployment:
| Deployment claim | Minimum defensible split |
|---|---|
| Future random samples from the same mixture | Stratified/random holdout plus repeated CV |
| New analogues in the same program | Temporal or medicinal-chemistry-series holdout |
| Novel chemotypes | Structure-cluster holdout; scaffold split as a secondary baseline |
| Future project data | Temporal split with no future leakage |
| New compounds for known targets | Drug-cold DTI split |
| Known compounds for new targets | Target-cold DTI split |
| Both new | Drug-and-target-cold split |
| Transfer across laboratories | External laboratory/source holdout |
A scaffold split is not automatically an out-of-distribution guarantee. Measure train–test nearest-neighbor similarity and report it.
Always include:
Use identical molecules and outer splits for every model. Give comparable tuning budgets.
Use nested cross-validation or an inner validation set. For scaffold/grouped training data, use group-aware inner folds. For temporal deployment, preserve chronology in validation.
Suggested search priorities:
Do not use the frozen test set for early stopping or model selection.
Primary metrics:
Secondary metrics:
Report:
Use bootstrap or repeated-fold confidence intervals where possible.
At minimum provide:
The bundled CLI estimates a similarity threshold from leave-one-out nearest-neighbor
similarities in a capped training sample and labels predictions in_domain or out_of_domain.
This is a useful structural check, not a complete mechanistic domain.
For stronger uncertainty, use CPSign or another leakage-safe conformal workflow and test coverage under the intended chemical shift. Conformal coverage requires exchangeability and can fail under series or temporal drift.
For RF/GB:
For SVM:
Never describe model attribution as biological causality.
Do not simply take the highest scores. Construct a shortlist using:
Include a small exploration fraction when the program can tolerate it. Preserve the exact selection rule before assays return.
Escalate evidence through:
Update the model with both positive and negative prospective results, maintaining assay consistency and version history.
| Situation | Preferred starting model | Why | Main risk |
|---|---|---|---|
| Small/medium tabular dataset, fast baseline | RF | Robust, little scaling, nonlinear | Analogue leakage and poor extrapolation |
| High-dimensional fingerprints, limited samples | Linear or RBF SVM | Margin-based, strong in high dimensions | Scaling/tuning and kernel cost |
| Continuous property with small/medium data | SVR + RF | Complementary smooth/kernel and tree models | Assay noise and domain limits |
| Medium/large descriptor/fingerprint table | XGBoost | Strong regularized tabular learner | Tuning and feature-importance instability |
| Very large sparse table | LightGBM | Fast histogram/leaf-wise training | Overfit without leaf constraints |
| Numeric molecular data plus real categories | CatBoost | Ordered boosting and category handling | Categories may encode leakage |
| Structure-based rescoring | ODDT RF-Score plus independent scorer | Proven RF contact features | Training-target and docking-pose shift |
| SVM with valid prediction intervals/sets | CPSign | Conformal and Venn–Abers support | Exchangeability and license terms |
| No-code/low-code workflow | KNIME + RDKit | Visual, auditable pipeline | Node-version and extension-license drift |
See references/ALGORITHM_GUIDE.md for deeper details and
references/RESEARCH_REPORT.md for the complete evidence review.
See references/OPEN_SOURCE_TOOLS.md for links, licenses, and caveats.
python3 scripts/qsar_pipeline.py audit --help
Produces:
data_audit.json;curated_data.csv;python3 scripts/qsar_pipeline.py train --help
Produces:
model.joblib with model, features, labels, metadata, and training-domain structures;metrics.json with CV and holdout metrics;test_predictions.csv;split_assignments.csv;feature_importance.csv when available;data_audit.json;model_card.md documenting intended use and limitations.python3 scripts/qsar_pipeline.py predict --help
Produces a CSV containing canonical structures, predictions, optional probabilities, nearest training similarity, and domain flags. Invalid SMILES are retained with an error status.
Every completed modeling task must report:
Use templates/DRUG_DISCOVERY_REPORT_TEMPLATE.md.
| Failure | Required action |
|---|---|
| Too few compounds | Reduce claims, prefer simple models, repeated/grouped validation, seek more data |
| Only actives available | Do not invent inactives; use ranking, one-class/domain methods, or obtain screened negatives |
| Conflicting replicates | Investigate assay/provenance; aggregate only with a documented rule |
| One scaffold dominates | Use grouped split, report scaffold-specific performance, diversify acquisition |
| Split lacks both classes | Change split seed/design without consulting test outcomes; record the rule |
| SVM too slow | Linear SVM, kernel approximation, smaller tuning set, or boosted trees |
| XGBoost unavailable | Run classical GradientBoosting and document omission; do not rename it XGBoost |
| High CV but weak external test | Diagnose similarity/leakage/shift; do not tune against the external labels |
| Poor calibration | Recalibrate on inner folds; report ranking and probability quality separately |
| Mostly out-of-domain library | Acquire representative labels or restrict claims; do not force a ranking as reliable |
| Feature importance changes by fold | Report instability and avoid mechanistic conclusions |
| Web predictor disagrees | Check endpoint/model/domain/version; do not average blindly |
joblib; never load an untrusted .joblib/pickle file, because
Python deserialization can execute code.references/RESEARCH_REPORT.md — complete deep-research report and citations.references/ALGORITHM_GUIDE.md — RF/SVM/GB mechanics, strengths, limits, and tuning.references/VALIDATION_PROTOCOL.md — leakage-resistant validation and metrics.references/OPEN_SOURCE_TOOLS.md — software and web-resource matrix.templates/PROJECT_BRIEF.md — task definition form.templates/DRUG_DISCOVERY_REPORT_TEMPLATE.md — final reporting template.Follow the commands in README.md or run:
python3 scripts/verify_integrity.py
sha256sum -c CHECKSUMS.sha256