Upload folder using huggingface_hub
Browse files- README.md +41 -0
- __pycache__/feature_extraction.cpython-312.pyc +0 -0
- __pycache__/predict_herg.cpython-312.pyc +0 -0
- config.json +101 -0
- feature_extraction.py +258 -0
- models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_random_DEPLOYMENT.pkl +3 -0
- models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_scaffold_DEPLOYMENT.pkl +3 -0
- models/extratreesA_reg_morgan+desc+herg+pharm_random_DEPLOYMENT.pkl +3 -0
- models/extratreesA_reg_morgan+desc+herg+pharm_scaffold_DEPLOYMENT.pkl +3 -0
- predict_herg.py +125 -0
- regulatory_inference_sample.csv +8 -0
- requirements.txt +4 -0
- validation_results.json +107 -0
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# hERG ExtraTrees (comprehensive features) — DEPLOYMENT REFITS
|
| 2 |
+
|
| 3 |
+
**DEPLOYMENT REFIT — trained on ALL labeled data, including the regulatory/external sets
|
| 4 |
+
(hERG-70, new-compounds 967, FDA panel 36, REGFAIL).** This is the third hERG deployment
|
| 5 |
+
model, added after the Phase-5 finish chain (2026-11-16): the comprehensive-features
|
| 6 |
+
ExtraTrees is the **best single (non-fusion) model** of the locked-pool Phase-5 benchmark,
|
| 7 |
+
refit on the complete labeled corpus for production screening use:
|
| 8 |
+
|
| 9 |
+
- classification: 14,441 compounds (`cls_alldata.csv`)
|
| 10 |
+
- regression: 10,370 compounds (`reg_alldata.csv`)
|
| 11 |
+
|
| 12 |
+
Hard gate: every external/regulatory compound was verified present in the actual training
|
| 13 |
+
files AND in the fitted training matrices by InChIKey connectivity before these bundles
|
| 14 |
+
were staged (hERG-70 462/462, new-compounds 967/967, FDA 36/36, REGFAIL 7/7, hERG-60
|
| 15 |
+
249/249, Test-1 43/43 cls / 17/43 reg; counts in `validation_results.json`).
|
| 16 |
+
|
| 17 |
+
**Do not validate these models on the absorbed sets** — scores there are in-sample by
|
| 18 |
+
construction. Honest external benchmarks of this architecture (locked-pool Phase-5
|
| 19 |
+
refits, external sets locked out) are listed in `config.json` /
|
| 20 |
+
`validation_results.json` under `honest_locked_benchmark_scores`: classification
|
| 21 |
+
scaffold refit hERG-70 ACC 0.760 / MCC **0.543** (best single model), FDA 4 errors,
|
| 22 |
+
REGFAIL Tier-1 4/5; regression hERG-70 RMSE 0.838.
|
| 23 |
+
|
| 24 |
+
## Contents
|
| 25 |
+
- `models/` — 4 bundles (cls/reg x scaffold/random; per task both protocols wrap the same
|
| 26 |
+
fitted model: identical combo/hyperparameters + all-data training make the protocol
|
| 27 |
+
distinction vanish). Headline = scaffold.
|
| 28 |
+
- `predict_herg.py` — standalone inference (SMILES -> blocker probability / pIC50).
|
| 29 |
+
- `feature_extraction.py` — the exact Phase-5 feature blocks.
|
| 30 |
+
- `config.json`, `validation_results.json`, `regulatory_inference_sample.csv`
|
| 31 |
+
(in-sample demonstration predictions on REGFAIL compounds, labelled as such).
|
| 32 |
+
|
| 33 |
+
Recipe (identical to the locked-pool finals): ExtraTrees, 300 trees, seed 42.
|
| 34 |
+
Feature blocks — classification: Morgan + MACCS + descriptors + physchem-extra +
|
| 35 |
+
hERG + pharmacophore blocks (2,499 features after preprocessing); regression:
|
| 36 |
+
Morgan + descriptors + hERG + pharmacophore blocks. Classification cutoff:
|
| 37 |
+
10 uM (blocker = pIC50 >= 5.0; call = prob >= 0.5).
|
| 38 |
+
|
| 39 |
+
Sibling deployment repos (same training files, same gate): Delower/herg-xgboost-deployment,
|
| 40 |
+
Delower/herg-cardiogenai-deployment. The three models are used together for DPP-4 lead
|
| 41 |
+
screening: a lead flagged by all three is the highest-concern class.
|
__pycache__/feature_extraction.cpython-312.pyc
ADDED
|
Binary file (15.6 kB). View file
|
|
|
__pycache__/predict_herg.cpython-312.pyc
ADDED
|
Binary file (7.57 kB). View file
|
|
|
config.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project": "hERG toxicity prediction - ExtraTrees-comprehensive DEPLOYMENT REFITS (third deployment model; Phase-5 best single model, refit on all labeled data)",
|
| 3 |
+
"version": "deployment-refit-2026-11-16",
|
| 4 |
+
"deployment_refit": true,
|
| 5 |
+
"trained_on": "ALL labeled data: locked pools (cls 12,702 / reg 8,657) + masters remainder + absorbed external sets (hERG-70 462, new-compounds 967, FDA panel 36, REGFAIL 7, hERG-60, Test-1)",
|
| 6 |
+
"training_files": {
|
| 7 |
+
"classification": "cls_alldata.csv (14,441 rows)",
|
| 8 |
+
"regression": "reg_alldata.csv (10,370 rows)"
|
| 9 |
+
},
|
| 10 |
+
"hard_gate": "every external/regulatory compound verified present in the actual training files AND in the fitted training matrices by InChIKey connectivity (counts in validation_results.json; full report HARD_GATE_ET.md in the project record)",
|
| 11 |
+
"models": {
|
| 12 |
+
"cls_scaffold": {
|
| 13 |
+
"file": "models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_scaffold_DEPLOYMENT.pkl",
|
| 14 |
+
"task": "classification",
|
| 15 |
+
"protocol": "scaffold",
|
| 16 |
+
"headline": true,
|
| 17 |
+
"n_train": 14441,
|
| 18 |
+
"n_features": 2499
|
| 19 |
+
},
|
| 20 |
+
"cls_random": {
|
| 21 |
+
"file": "models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_random_DEPLOYMENT.pkl",
|
| 22 |
+
"task": "classification",
|
| 23 |
+
"protocol": "random",
|
| 24 |
+
"headline": false,
|
| 25 |
+
"n_train": 14441,
|
| 26 |
+
"n_features": 2499
|
| 27 |
+
},
|
| 28 |
+
"reg_scaffold": {
|
| 29 |
+
"file": "models/extratreesA_reg_morgan+desc+herg+pharm_scaffold_DEPLOYMENT.pkl",
|
| 30 |
+
"task": "regression",
|
| 31 |
+
"protocol": "scaffold",
|
| 32 |
+
"headline": true,
|
| 33 |
+
"n_train": 10370,
|
| 34 |
+
"n_features": 2331
|
| 35 |
+
},
|
| 36 |
+
"reg_random": {
|
| 37 |
+
"file": "models/extratreesA_reg_morgan+desc+herg+pharm_random_DEPLOYMENT.pkl",
|
| 38 |
+
"task": "regression",
|
| 39 |
+
"protocol": "random",
|
| 40 |
+
"headline": false,
|
| 41 |
+
"n_train": 10370,
|
| 42 |
+
"n_features": 2331
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"feature_blocks": {
|
| 46 |
+
"classification": [
|
| 47 |
+
"morgan",
|
| 48 |
+
"maccs",
|
| 49 |
+
"desc",
|
| 50 |
+
"physchem_extra",
|
| 51 |
+
"herg",
|
| 52 |
+
"pharm"
|
| 53 |
+
],
|
| 54 |
+
"regression": [
|
| 55 |
+
"morgan",
|
| 56 |
+
"desc",
|
| 57 |
+
"herg",
|
| 58 |
+
"pharm"
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
"hyperparameters": {
|
| 62 |
+
"n_estimators": 300,
|
| 63 |
+
"n_jobs": 2,
|
| 64 |
+
"random_state": 42,
|
| 65 |
+
"note": "identical to the locked-pool Phase-5 ET finals (p5_approachA_et.py)"
|
| 66 |
+
},
|
| 67 |
+
"protocol_note": "scaffold and random bundles wrap the same fitted model per task: identical combo/hyperparameters and all-data training make the protocol distinction vanish in deployment refits",
|
| 68 |
+
"honest_locked_benchmark_scores": {
|
| 69 |
+
"source": "Locked-pool Phase-5 refits (train+val only; every external/regulatory set locked out), results/phase5/PHASE5_RESULTS.md \u2014 these are the honest benchmark scores of this architecture. The DEPLOYMENT refits in this repo absorbed those sets and are never scored on them.",
|
| 70 |
+
"classification_scaffold_refit": {
|
| 71 |
+
"hERG-70": {
|
| 72 |
+
"ACC": 0.76,
|
| 73 |
+
"MCC": 0.543
|
| 74 |
+
},
|
| 75 |
+
"new_compounds_MCC": 0.149,
|
| 76 |
+
"FDA_errors": "4/36",
|
| 77 |
+
"REGFAIL_Tier1": "4/5"
|
| 78 |
+
},
|
| 79 |
+
"classification_random_refit": {
|
| 80 |
+
"hERG-70": {
|
| 81 |
+
"ACC": 0.74,
|
| 82 |
+
"MCC": 0.504
|
| 83 |
+
},
|
| 84 |
+
"new_compounds_MCC": 0.154,
|
| 85 |
+
"FDA_errors": "5/36",
|
| 86 |
+
"REGFAIL_Tier1": "4/5"
|
| 87 |
+
},
|
| 88 |
+
"regression_scaffold_refit": {
|
| 89 |
+
"hERG-70_RMSE": 0.838
|
| 90 |
+
},
|
| 91 |
+
"regression_random_refit": {
|
| 92 |
+
"hERG-70_RMSE": 0.829
|
| 93 |
+
},
|
| 94 |
+
"note": "Best SINGLE (non-fusion) model on hERG-70 in the programme (MCC 0.543); the best overall classifier is Fusion G (0.548, XGBoost + CardioGenAI), which is not a deployment model."
|
| 95 |
+
},
|
| 96 |
+
"sibling_deployment_repos": [
|
| 97 |
+
"Delower/herg-xgboost-deployment",
|
| 98 |
+
"Delower/herg-cardiogenai-deployment"
|
| 99 |
+
],
|
| 100 |
+
"warning": "DEPLOYMENT MODEL - trained on the regulatory/external sets. Do NOT report its scores on those sets as validation."
|
| 101 |
+
}
|
feature_extraction.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Feature extraction for the hERG Phase-5 models — end-to-end from SMILES, RDKit only.
|
| 2 |
+
|
| 3 |
+
Reproduces exactly the feature blocks used by the Phase-5 XGBoost models (Approach A
|
| 4 |
+
and the XGBoost legs of Approaches B/C), and is backwards-compatible with the Phase-3/4
|
| 5 |
+
blocks (Morgan / MACCS / 217 RDKit descriptors are computed with the same settings as
|
| 6 |
+
work/step0_lock_splits_features.py, so Phase-5 models can be compared like-for-like).
|
| 7 |
+
|
| 8 |
+
Blocks (in canonical assembly order):
|
| 9 |
+
morgan ECFP4 Morgan bits, radius 2, 2048 bits (Phase 3/4)
|
| 10 |
+
maccs MACCS keys, 166 bits (167-bit vector with placeholder bit 0 dropped) (Phase 3/4)
|
| 11 |
+
desc 217 RDKit molecular descriptors (Descriptors.descList, the exact
|
| 12 |
+
set/order of the Phase-3/4 cache, work/desc_names.json) (Phase 3/4)
|
| 13 |
+
physchem_extra [QED] — the one standard physicochemical property absent from the
|
| 14 |
+
217-descriptor set (verified programmatically; TPSA, MolLogP,
|
| 15 |
+
FractionCSP3, NumAromaticRings etc. are already inside `desc`,
|
| 16 |
+
so they are deliberately NOT duplicated here) (Phase 5)
|
| 17 |
+
morgan_counts Morgan radius-2 atom-environment COUNTS folded to 2048
|
| 18 |
+
(assembly applies log1p) (Phase 5)
|
| 19 |
+
ecfp6 Morgan bits, radius 3, 2048 bits (Phase 5)
|
| 20 |
+
fcfp4 Morgan bits, radius 2, 2048 bits, feature-class atom invariants
|
| 21 |
+
(FCFP4) (Phase 5)
|
| 22 |
+
herg hERG-targeted features (13, continuous) — see featurize_herg() (Phase 5)
|
| 23 |
+
pharm 2D pharmacophore pair counts (60, counts) — see featurize_pharm() (Phase 5)
|
| 24 |
+
morgan1024 Morgan ECFP4 bits folded to 1024 (added 2026-11-13 at Hossain's
|
| 25 |
+
instruction, alongside the 2048-bit default) (Phase 5)
|
| 26 |
+
morgan1024_counts Morgan ECFP4 counts folded to 1024 (assembly applies log1p) (Phase 5)
|
| 27 |
+
cdk OPTIONAL, not computed here: CDK fingerprints come from
|
| 28 |
+
PaDEL-Descriptor (separate Java tool); see PHASE5_RESULTS.md.
|
| 29 |
+
|
| 30 |
+
Usage:
|
| 31 |
+
from feature_extraction import featurize_smiles, BLOCK_ORDER
|
| 32 |
+
X, blocks = featurize_smiles("CCOc1ccc(cc1)...") # blocks: dict name -> 1-D np.array
|
| 33 |
+
|
| 34 |
+
Preprocessing applied at model time (NOT in this module; fit on training folds only):
|
| 35 |
+
- desc / physchem_extra / herg: drop near-constant & >5%-NaN columns (fit on train),
|
| 36 |
+
median-impute (train medians), standardize (train mean/SD) — Phase 3/4 DescPrep logic.
|
| 37 |
+
- morgan_counts / pharm: log1p, then the same standardisation as above.
|
| 38 |
+
- bit fingerprints (morgan / maccs / ecfp6 / fcfp4 / cdk): used raw.
|
| 39 |
+
"""
|
| 40 |
+
import os
|
| 41 |
+
import numpy as np
|
| 42 |
+
from rdkit import Chem, RDConfig, RDLogger
|
| 43 |
+
from rdkit.Chem import AllChem, MACCSkeys, rdMolDescriptors, rdFingerprintGenerator
|
| 44 |
+
from rdkit.Chem import ChemicalFeatures, QED
|
| 45 |
+
from rdkit.Chem.Descriptors import MolLogP
|
| 46 |
+
|
| 47 |
+
RDLogger.DisableLog("rdApp.*")
|
| 48 |
+
|
| 49 |
+
from rdkit.Chem import Descriptors as _Desc
|
| 50 |
+
DESC_NAMES = [n for n, _ in _Desc.descList] # 217, fixed order (== Phase-3/4 desc_names.json)
|
| 51 |
+
_DESC_FNS = dict(_Desc.descList)
|
| 52 |
+
BLOCK_ORDER = ["morgan", "maccs", "desc", "physchem_extra", "morgan_counts",
|
| 53 |
+
"ecfp6", "fcfp4", "herg", "pharm", "morgan1024", "morgan1024_counts"]
|
| 54 |
+
BLOCK_SIZES = {"morgan": 2048, "maccs": 166, "desc": 217, "physchem_extra": 1,
|
| 55 |
+
"morgan_counts": 2048, "ecfp6": 2048, "fcfp4": 2048, "herg": 13, "pharm": 60,
|
| 56 |
+
"morgan1024": 1024, "morgan1024_counts": 1024}
|
| 57 |
+
|
| 58 |
+
# ---------------------------------------------------------------- hERG block ----
|
| 59 |
+
# Method (documented approximation, no fitted parameters):
|
| 60 |
+
# * Protonatable / ionizable centres are identified with RDKit's BaseFeatures
|
| 61 |
+
# feature factory (PosIonizable / NegIonizable families).
|
| 62 |
+
# * Each PosIonizable centre is assigned a class pKa by atom environment:
|
| 63 |
+
# aromatic pyridine-like N ......... 5.2
|
| 64 |
+
# imidazole-like aromatic N (5-ring, >=2 ring N) ... 7.0
|
| 65 |
+
# aniline-like N (attached to aromatic C) ......... 4.6
|
| 66 |
+
# other (aliphatic amine etc.) .................... 9.5
|
| 67 |
+
# Fraction protonated at pH 7.4 for a centre: f = 1 / (1 + 10^(7.4 - pKa)).
|
| 68 |
+
# * logD(7.4) estimate: MolLogP - log10(1 + 10^(pKa_base - 7.4)) using the strongest
|
| 69 |
+
# basic centre, and additionally - log10(1 + 10^(7.4 - 4.5)) if a carboxylic-acid
|
| 70 |
+
# group is present (assumed acid pKa 4.5). This is a crude class-pKa approximation
|
| 71 |
+
# of logD, NOT a measured or rigorously predicted logD — it is labelled as such
|
| 72 |
+
# everywhere it is used.
|
| 73 |
+
_CLASS_PKA = {"pyridine": 5.2, "imidazole": 7.0, "aniline": 4.6, "aliphatic": 9.5}
|
| 74 |
+
_ACID_PKA = 4.5
|
| 75 |
+
_PH = 7.4
|
| 76 |
+
_factory = None
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def _get_factory():
|
| 80 |
+
global _factory
|
| 81 |
+
if _factory is None:
|
| 82 |
+
cands = [os.path.join(RDConfig.RDDataDir, "BaseFeatures.fdef"),
|
| 83 |
+
os.path.join(RDConfig.RDDataDir, "Code", "GraphMol", "ChemicalFeatures",
|
| 84 |
+
"BaseFeatures.fdef")]
|
| 85 |
+
fdef = next(p for p in cands if os.path.exists(p))
|
| 86 |
+
_factory = ChemicalFeatures.BuildFeatureFactory(fdef)
|
| 87 |
+
return _factory
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def _classify_base(atom, mol):
|
| 91 |
+
if atom.GetIsAromatic():
|
| 92 |
+
ring = mol.GetRingInfo()
|
| 93 |
+
for r in ring.AtomRings():
|
| 94 |
+
if atom.GetIdx() in r and len(r) == 5 and sum(1 for i in r if mol.GetAtomWithIdx(i).GetAtomicNum() == 7) >= 2:
|
| 95 |
+
return "imidazole"
|
| 96 |
+
return "pyridine"
|
| 97 |
+
for nb in atom.GetNeighbors():
|
| 98 |
+
if nb.GetIsAromatic():
|
| 99 |
+
return "aniline"
|
| 100 |
+
return "aliphatic"
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def _frac_prot(pka, ph=_PH):
|
| 104 |
+
return 1.0 / (1.0 + 10.0 ** (ph - pka))
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
HERG_NAMES = ["n_pos_ionizable", "n_neg_ionizable", "expected_protonated_pH74",
|
| 108 |
+
"strongest_base_pKa", "logD74_est", "formal_charge", "abs_formal_charge",
|
| 109 |
+
"n_aromatic_rings", "frac_aromatic_atoms", "n_amine_like_N",
|
| 110 |
+
"n_carboxylic_acid", "has_base", "has_acid"]
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def featurize_herg(mol):
|
| 114 |
+
feats = _get_factory().GetFeaturesForMol(mol)
|
| 115 |
+
pos, neg = [], []
|
| 116 |
+
for f in feats:
|
| 117 |
+
if f.GetFamily() == "PosIonizable":
|
| 118 |
+
pos.append(f)
|
| 119 |
+
elif f.GetFamily() == "NegIonizable":
|
| 120 |
+
neg.append(f)
|
| 121 |
+
pkas = []
|
| 122 |
+
exp_prot = 0.0
|
| 123 |
+
for f in pos:
|
| 124 |
+
aidx = f.GetAtomIds()[0]
|
| 125 |
+
cls = _classify_base(mol.GetAtomWithIdx(aidx), mol)
|
| 126 |
+
pka = _CLASS_PKA[cls]
|
| 127 |
+
pkas.append(pka)
|
| 128 |
+
exp_prot += _frac_prot(pka)
|
| 129 |
+
logp = MolLogP(mol)
|
| 130 |
+
logd = logp
|
| 131 |
+
if pkas:
|
| 132 |
+
logd -= np.log10(1.0 + 10.0 ** (max(pkas) - _PH))
|
| 133 |
+
n_acid = len(mol.GetSubstructMatches(Chem.MolFromSmarts("[CX3](=O)[OX2H1]")))
|
| 134 |
+
if n_acid:
|
| 135 |
+
logd -= np.log10(1.0 + 10.0 ** (_PH - _ACID_PKA))
|
| 136 |
+
n_ar = sum(1 for a in mol.GetAtoms() if a.GetIsAromatic())
|
| 137 |
+
amine_like = len(mol.GetSubstructMatches(
|
| 138 |
+
Chem.MolFromSmarts("[NX3;!$(NC=O);!$(NS(=O)(=O));!$(N=*);!$(N#*)]")))
|
| 139 |
+
fc = Chem.GetFormalCharge(mol)
|
| 140 |
+
return np.array([
|
| 141 |
+
len(pos), len(neg), exp_prot,
|
| 142 |
+
max(pkas) if pkas else 0.0,
|
| 143 |
+
logd, fc, abs(fc),
|
| 144 |
+
rdMolDescriptors.CalcNumAromaticRings(mol),
|
| 145 |
+
n_ar / max(mol.GetNumAtoms(), 1),
|
| 146 |
+
amine_like, n_acid,
|
| 147 |
+
1.0 if pkas else 0.0, 1.0 if n_acid else 0.0,
|
| 148 |
+
], dtype=float)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
# ---------------------------------------------------------------- pharm block ---
|
| 152 |
+
# 2D pharmacophore pair counts. Feature points from RDKit's BaseFeatures factory,
|
| 153 |
+
# families mapped to 5 classes: Donor, Acceptor, Hydrophobe (Hydrophobe +
|
| 154 |
+
# LumpedHydrophobe + AromaticRing), PosIonizable, NegIonizable. For every pair of
|
| 155 |
+
# points (same point excluded; pairs taken with repetition over classes), the
|
| 156 |
+
# minimum topological distance between the two points' atoms is binned as
|
| 157 |
+
# <=2, 3-4, 5-6, >=7, giving 15 class-pairs x 4 bins = 60 counts.
|
| 158 |
+
_PHARM_FAMS = ["Donor", "Acceptor", "Hydrophobe", "PosIonizable", "NegIonizable"]
|
| 159 |
+
_FAM_MAP = {"Donor": "Donor", "Acceptor": "Acceptor", "Hydrophobe": "Hydrophobe",
|
| 160 |
+
"LumpedHydrophobe": "Hydrophobe", "AromaticRing": "Hydrophobe",
|
| 161 |
+
"PosIonizable": "PosIonizable", "NegIonizable": "NegIonizable",
|
| 162 |
+
"RingDonor": "Donor", "RingAcceptor": "Acceptor"}
|
| 163 |
+
PHARM_NAMES = [f"{a}|{b}|d{db}" for i, a in enumerate(_PHARM_FAMS) for b in _PHARM_FAMS[i:]
|
| 164 |
+
for db in ["<=2", "3-4", "5-6", ">=7"]]
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def _dist_bin(d):
|
| 168 |
+
return 0 if d <= 2 else 1 if d <= 4 else 2 if d <= 6 else 3
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def featurize_pharm(mol):
|
| 172 |
+
feats = _get_factory().GetFeaturesForMol(mol)
|
| 173 |
+
pts = []
|
| 174 |
+
for f in feats:
|
| 175 |
+
fam = _FAM_MAP.get(f.GetFamily())
|
| 176 |
+
if fam is not None:
|
| 177 |
+
pts.append((fam, set(f.GetAtomIds())))
|
| 178 |
+
out = np.zeros(60, dtype=float)
|
| 179 |
+
if len(pts) < 2:
|
| 180 |
+
return out
|
| 181 |
+
dm = Chem.GetDistanceMatrix(mol)
|
| 182 |
+
pair_index = {}
|
| 183 |
+
k = 0
|
| 184 |
+
for i, a in enumerate(_PHARM_FAMS):
|
| 185 |
+
for b in _PHARM_FAMS[i:]:
|
| 186 |
+
pair_index[(a, b)] = k
|
| 187 |
+
k += 4
|
| 188 |
+
for i in range(len(pts)):
|
| 189 |
+
for j in range(i + 1, len(pts)):
|
| 190 |
+
fa, aa = pts[i]
|
| 191 |
+
fb, ab = pts[j]
|
| 192 |
+
d = min(dm[x, y] for x in aa for y in ab)
|
| 193 |
+
key = (fa, fb) if (fa, fb) in pair_index else (fb, fa)
|
| 194 |
+
out[pair_index[key] + _dist_bin(int(d))] += 1.0
|
| 195 |
+
return out
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
# ---------------------------------------------------------------- main entry ----
|
| 199 |
+
_morgan_gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)
|
| 200 |
+
_morgan_gen_1024 = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=1024)
|
| 201 |
+
_morgan_gen_r3 = rdFingerprintGenerator.GetMorganGenerator(radius=3, fpSize=2048)
|
| 202 |
+
_fcfp_gen = rdFingerprintGenerator.GetMorganGenerator(
|
| 203 |
+
radius=2, fpSize=2048,
|
| 204 |
+
atomInvariantsGenerator=rdFingerprintGenerator.GetMorganFeatureAtomInvGen())
|
| 205 |
+
from rdkit.ML.Descriptors.MoleculeDescriptors import MolecularDescriptorCalculator
|
| 206 |
+
_CALC = MolecularDescriptorCalculator(DESC_NAMES)
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def _desc_vector(mol):
|
| 210 |
+
# C++-loop calculator over the descList functions; identical values/order to
|
| 211 |
+
# calling each descList function in Python, several-fold faster.
|
| 212 |
+
try:
|
| 213 |
+
return np.array(_CALC.CalcDescriptors(mol), dtype=float)
|
| 214 |
+
except Exception:
|
| 215 |
+
out = np.empty(len(DESC_NAMES), dtype=float)
|
| 216 |
+
for i, n in enumerate(DESC_NAMES):
|
| 217 |
+
try:
|
| 218 |
+
out[i] = _DESC_FNS[n](mol)
|
| 219 |
+
except Exception:
|
| 220 |
+
out[i] = np.nan
|
| 221 |
+
return out
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
def featurize_mol(mol):
|
| 225 |
+
"""mol: RDKit Mol -> dict block name -> 1-D float32 array (NaN-free except desc)."""
|
| 226 |
+
out = {}
|
| 227 |
+
out["morgan"] = np.asarray(_morgan_gen.GetFingerprint(mol), dtype=np.float32)
|
| 228 |
+
out["maccs"] = np.asarray(MACCSkeys.GenMACCSKeys(mol), dtype=np.float32)[1:] # drop bit 0
|
| 229 |
+
out["desc"] = _desc_vector(mol)
|
| 230 |
+
out["physchem_extra"] = np.array([QED.qed(mol)], dtype=float)
|
| 231 |
+
counts = _morgan_gen.GetCountFingerprint(mol)
|
| 232 |
+
arr = np.zeros(2048, dtype=np.float32)
|
| 233 |
+
for idx, c in counts.GetNonzeroElements().items():
|
| 234 |
+
arr[idx % 2048] += c
|
| 235 |
+
out["morgan_counts"] = arr
|
| 236 |
+
out["ecfp6"] = np.asarray(_morgan_gen_r3.GetFingerprint(mol), dtype=np.float32)
|
| 237 |
+
out["fcfp4"] = np.asarray(_fcfp_gen.GetFingerprint(mol), dtype=np.float32)
|
| 238 |
+
out["herg"] = featurize_herg(mol)
|
| 239 |
+
out["pharm"] = featurize_pharm(mol)
|
| 240 |
+
# Morgan ECFP4 at 1024 bits (bits + counts) — added to the Phase-5 ablation by
|
| 241 |
+
# Hossain's instruction of 2026-11-13 (tests whether the smaller, denser folding
|
| 242 |
+
# beats the 2048-bit default).
|
| 243 |
+
out["morgan1024"] = np.asarray(_morgan_gen_1024.GetFingerprint(mol), dtype=np.float32)
|
| 244 |
+
counts = _morgan_gen_1024.GetCountFingerprint(mol)
|
| 245 |
+
arr = np.zeros(1024, dtype=np.float32)
|
| 246 |
+
for idx, c in counts.GetNonzeroElements().items():
|
| 247 |
+
arr[idx % 1024] += c
|
| 248 |
+
out["morgan1024_counts"] = arr
|
| 249 |
+
return out
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def featurize_smiles(smiles):
|
| 253 |
+
"""SMILES -> (assembled float32 vector in BLOCK_ORDER, blocks dict). None if unparseable."""
|
| 254 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 255 |
+
if mol is None:
|
| 256 |
+
return None, None
|
| 257 |
+
blocks = featurize_mol(mol)
|
| 258 |
+
return np.concatenate([blocks[b] for b in BLOCK_ORDER]).astype(np.float32), blocks
|
models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_random_DEPLOYMENT.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fe1abde77703780d6d01a585a480d54d38b54c76d44250f18be46a8bf5e4bab9
|
| 3 |
+
size 208769871
|
models/extratreesA_cls_morgan+maccs+desc+physchem_extra+herg+pharm_scaffold_DEPLOYMENT.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12c3408bf40518976d8f4bdae0810db98f1502842001265c7029b5f7e24d0360
|
| 3 |
+
size 208769880
|
models/extratreesA_reg_morgan+desc+herg+pharm_random_DEPLOYMENT.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:64631ec533419704eb0d5fbaa3b8118a175b8f1006ce9bf7450e695631ab20c4
|
| 3 |
+
size 431007729
|
models/extratreesA_reg_morgan+desc+herg+pharm_scaffold_DEPLOYMENT.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b344ea43d1c71d7c94558253956f41c73e24d643b9c27c2a1d5197692d9753ec
|
| 3 |
+
size 431007738
|
predict_herg.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Standalone inference for the hERG ExtraTrees DEPLOYMENT refits (Delower/herg-extratrees-deployment).
|
| 3 |
+
|
| 4 |
+
DEPLOYMENT REFIT: trained on ALL labeled data (locked pools + hERG-70 +
|
| 5 |
+
new-compounds + FDA panel + REGFAIL absorbed). Not a benchmark model;
|
| 6 |
+
never validate it on the absorbed sets.
|
| 7 |
+
|
| 8 |
+
Takes SMILES, builds the exact Phase-5 feature blocks with feature_extraction.py,
|
| 9 |
+
applies the fitted preprocessing stored inside each model pickle (fold-fitted
|
| 10 |
+
ContPrep states: column keep-mask, median imputation, standardisation; log1p for
|
| 11 |
+
count blocks), and predicts with the ExtraTrees model stored in the same pickle.
|
| 12 |
+
|
| 13 |
+
Usage:
|
| 14 |
+
python predict_herg.py --model models/<cls_scaffold.pkl> "CCOc1ccc..." [...]
|
| 15 |
+
python predict_herg.py --model models/<reg_scaffold.pkl> --csv compounds.csv
|
| 16 |
+
(CSV must have a 'smiles' column; output adds pred_pIC50 / prob_blocker)
|
| 17 |
+
|
| 18 |
+
Classification pickles output blocker probability at the locked 10 uM cutoff
|
| 19 |
+
(call = prob >= 0.5). Regression pickles output predicted pIC50
|
| 20 |
+
(derived 10 uM call = pIC50 >= 5.0).
|
| 21 |
+
|
| 22 |
+
Dependencies: see requirements.txt (rdkit, scikit-learn, numpy).
|
| 23 |
+
"""
|
| 24 |
+
import argparse, csv, json, pickle, sys
|
| 25 |
+
import numpy as np
|
| 26 |
+
|
| 27 |
+
from feature_extraction import featurize_smiles
|
| 28 |
+
|
| 29 |
+
BLOCK_KIND = {"morgan": "bits", "maccs": "bits", "desc": "cont",
|
| 30 |
+
"physchem_extra": "cont", "morgan_counts": "counts",
|
| 31 |
+
"ecfp6": "bits", "fcfp4": "bits", "herg": "cont",
|
| 32 |
+
"pharm": "counts", "cdk": "bits",
|
| 33 |
+
"morgan1024": "bits", "morgan1024_counts": "counts"}
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def apply_prep(raw, state):
|
| 37 |
+
"""Replicates p5_common.ContPrep.transform from its stored state dict."""
|
| 38 |
+
X = np.asarray(raw, dtype=float).reshape(1, -1)
|
| 39 |
+
X = np.where(np.isfinite(X), X, np.nan)
|
| 40 |
+
if state["log1p"]:
|
| 41 |
+
X = np.log1p(np.clip(X, 0, None))
|
| 42 |
+
X = X[:, np.asarray(state["keep"], dtype=bool)]
|
| 43 |
+
med = np.asarray(state["med"], dtype=float)
|
| 44 |
+
X = np.where(np.isnan(X), med, X)
|
| 45 |
+
mu = np.asarray(state["mu"], dtype=float)
|
| 46 |
+
sd = np.asarray(state["sd"], dtype=float)
|
| 47 |
+
return ((X - mu) / sd).astype(np.float32)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def design_row(blocks, combo, preps):
|
| 51 |
+
parts = []
|
| 52 |
+
for b in combo:
|
| 53 |
+
raw = np.asarray(blocks[b], dtype=np.float32)
|
| 54 |
+
if b in preps:
|
| 55 |
+
parts.append(apply_prep(raw, preps[b]))
|
| 56 |
+
else:
|
| 57 |
+
parts.append(raw.reshape(1, -1).astype(np.float32))
|
| 58 |
+
return np.hstack(parts)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def load_bundle(path):
|
| 62 |
+
with open(path, "rb") as fh:
|
| 63 |
+
return pickle.load(fh)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def predict(bundle, smiles_list):
|
| 67 |
+
out = []
|
| 68 |
+
for smi in smiles_list:
|
| 69 |
+
_, blocks = featurize_smiles(smi)
|
| 70 |
+
if blocks is None:
|
| 71 |
+
out.append(None)
|
| 72 |
+
continue
|
| 73 |
+
X = design_row(blocks, bundle["blocks"], bundle["preps"])
|
| 74 |
+
model = bundle["model"]
|
| 75 |
+
if bundle["task"] == "cls":
|
| 76 |
+
out.append(float(model.predict_proba(X)[0, 1]))
|
| 77 |
+
else:
|
| 78 |
+
out.append(float(model.predict(X)[0]))
|
| 79 |
+
return out
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def main():
|
| 83 |
+
ap = argparse.ArgumentParser()
|
| 84 |
+
ap.add_argument("--model", required=True, help="path to a model pickle from models/")
|
| 85 |
+
ap.add_argument("--csv", help="input CSV with a 'smiles' column")
|
| 86 |
+
ap.add_argument("--out", help="output CSV (default: stdout summary)")
|
| 87 |
+
ap.add_argument("smiles", nargs="*", help="SMILES strings")
|
| 88 |
+
args = ap.parse_args()
|
| 89 |
+
|
| 90 |
+
bundle = load_bundle(args.model)
|
| 91 |
+
rows = []
|
| 92 |
+
if args.csv:
|
| 93 |
+
with open(args.csv) as fh:
|
| 94 |
+
for r in csv.DictReader(fh):
|
| 95 |
+
rows.append(r)
|
| 96 |
+
smiles = [r["smiles"] for r in rows]
|
| 97 |
+
else:
|
| 98 |
+
smiles = args.smiles
|
| 99 |
+
rows = [{"smiles": s} for s in smiles]
|
| 100 |
+
if not smiles:
|
| 101 |
+
print("no SMILES given", file=sys.stderr)
|
| 102 |
+
return 2
|
| 103 |
+
preds = predict(bundle, smiles)
|
| 104 |
+
col = "prob_blocker" if bundle["task"] == "cls" else "pred_pIC50"
|
| 105 |
+
for r, p in zip(rows, preds):
|
| 106 |
+
r[col] = "" if p is None else f"{p:.4f}"
|
| 107 |
+
if bundle["task"] == "cls":
|
| 108 |
+
r["call_10uM"] = "" if p is None else int(p >= 0.5)
|
| 109 |
+
else:
|
| 110 |
+
r["derived_call_10uM"] = "" if p is None else int(p >= 5.0)
|
| 111 |
+
if args.out:
|
| 112 |
+
with open(args.out, "w", newline="") as fh:
|
| 113 |
+
w = csv.DictWriter(fh, fieldnames=list(rows[0].keys()))
|
| 114 |
+
w.writeheader()
|
| 115 |
+
w.writerows(rows)
|
| 116 |
+
print(f"wrote {args.out} ({len(rows)} rows, model task={bundle['task']}, "
|
| 117 |
+
f"protocol={bundle['protocol']})")
|
| 118 |
+
else:
|
| 119 |
+
for r in rows:
|
| 120 |
+
print(json.dumps(r))
|
| 121 |
+
return 0
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
if __name__ == "__main__":
|
| 125 |
+
sys.exit(main())
|
regulatory_inference_sample.csv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
drug,sponsor,stage_reached,status,smiles_canonical,compound_key,ic50_nM,pIC50,ic50_assay_note,ic50_source,blocker_call_10uM,attribution_grade,reason_summary,source_1,source_2,in_training_pool,tier,notes,cls_scaffold_pred,reg_scaffold_pred,note
|
| 2 |
+
Almokalant,Astra-Hässle AB (Astra),Phase III,discontinued,CCC[S+]([O-])CCCN(CC)CC(O)COc1ccc(C#N)cc1,ZMHOBBKJBYLXFR,35.36,7.4515,"Project quantitative master median of 4 measurements (ChEMBL CHEMBL240 + BindingDB Q12809 pulls), all ChEMBL assay type B (radioligand displacement on hERG). Per-source medians agree (pIC50 7.452 both) but individual values span 5-250 nM (spread 1.70 log, spread-flagged in the master).",data/herg_master_quantitative.csv (this project; sources ChEMBL CHEMBL362103 + BindingDB),1.0,A,Development programme produced repeated torsades de pointes in patients (4/100 in the pivotal chronic-AF conversion study; 8 patients across 7 studies programme-wide); clinical investigation abandoned.,"Houltz B et al., Cardiovasc Drugs Ther 1999;13:329-338 (primary, Astra-Hässle authors): 'Four patients developed torsades de pointes' among 100 chronic AF patients; Svernhage E et al. 1998: 'During the clinical development program for almokalant... a total of eight patients in seven different studies developed one or more torsades de pointes.'","'New Antiarrhythmic Drugs' (textbook chapter, ScienceDirect): 'The intravenous preparation has been associated with a high incidence of Torsades de Pointes... Clinical investigation is not currently planned.' TTD/DrugMAP lists almokalant as 'Discontinued in Phase 3' for cardiac arrhythmias.",False,1,Selective IKr (hERG) blocker (Astra code H 234/09). Member of external hERG-70 set and of UnihERG_DB; NOT in the locked training pools. IC50 spread across assays is wide (>=1 log flag) - treat the point value cautiously.,1.0,7.451499999999967,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 3 |
+
AZD1305,AstraZeneca,Phase II,discontinued,CC(C)(C)OC(=O)NCCN1C[C@@H]2CN(CCOc3ccc(C#N)cc3F)C[C@H](C1)O2,BLLNYXOLLAVTRF,370.0,6.4318,"hERG IC50 0.37 uM from AstraZeneca's in vitro hERG assay programme, as published (fixed/estimated) in the AZD1305 PK-PD (hERG-JT interval) analysis. Mixed ion-channel blocker (hERG, Nav1.5, Cav1.2); the hERG value is the torsadogenic-relevant one.","Janzén DLI et al., Front Physiol 2016;7:590: 'The estimated IC50 of hERG was 0.37 +/- 0.04 uM.' Not present in this project's ChEMBL/BindingDB pulls.",1.0,A,Phase II AF cardioversion trial: two patients developed torsade de pointes with dose-dependent QTcF prolongation; benefit-risk judged unfavourable and the development programme was discontinued.,"Rónaszéki A et al., Europace 2011;13:1148-1156 (primary Phase II paper): 'Two patients experienced torsade de pointes (TdP)... AZD1305 was effective in converting AF to SR, but was associated with QT prolongation and TdP. The benefit-risk profile was judged as unfavourable and the AZD1305 development programme was discontinued.'","Bergenholm L et al., Br J Pharmacol 2017;174:3268-3283 (AstraZeneca authors): 'AZD1305 is a mixed ion channel blocker (hERG, hNav1.5 and rCav1.2) previously in development for the treatment of atrial fibrillations, which was discontinued due to safety concerns regarding QTc prolongations and TdP risk (Rónaszéki et al., 2011).'",False,1,"Cleanest compound in this set: absent from the locked training pools, from ALL existing held-out sets, and from UnihERG_DB (so also unseen by the incumbent hERG-LTN). Successor to AZD7009 (see report - AZD7009 itself was discontinued for extra-cardiac flu-like symptoms and is excluded).",1.0,6.43180000000002,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 4 |
+
Vanoxerine,Laguna Pharmaceuticals,Phase III,discontinued,Fc1ccc(C(OCCN2CCN(CCCc3ccccc3)CC2)c2ccc(F)cc2)cc1,NAUWTFJOPJWYOT,470.0,6.3279,"Project quantitative master median of 2 measurements (ChEMBL CHEMBL240 + BindingDB Q12809), assay type B (hERG binding/displacement family); sources agree exactly (spread 0.0). Functional IKr potency of the same order is reported in the primary electrophysiology literature (Lacerda et al. 2010).",data/herg_master_quantitative.csv (this project; ChEMBL CHEMBL281594 + BindingDB),1.0,A,"Phase III RESTORE SR trial terminated prematurely after 3/26 vanoxerine patients (11.5%, all with structural heart disease) developed torsades de pointes; sponsor wound down and the AF programme ended. (An earlier cocaine-dependence programme had also been stopped over QTc effects.)","Piccini JP et al., Heart Rhythm 2016;13:1777-1783 (RESTORE SR primary report): 'The study was terminated prematurely because of safety concerns... The primary safety end point (all-cause death, ventricular fibrillation/tachycardia requiring intervention, or torsades de pointes) occurred in no patient in the placebo arm vs 11.5% (3 of 26) in the vanoxerine arm. All 3 patients had torsades de pointes and underlying SHD.'","Frontiers in Pharmacology 2020 review of AF antiarrhythmics: 'the study was terminated early due to the occurrence of ventricular arrhythmias and torsades de pointes in the treatment group (Piccini et al., 2016)'; Healio 2016 quoting Piccini: 'The QT prolongation observed with vanoxerine led to a significant risk [for torsades de pointes]'.",False,1,"GBR-12909; multichannel blocker (IKr > ICaL, INa) originally a dopamine-reuptake inhibitor. Member of external hERG-70 set and of UnihERG_DB; NOT in the locked training pools.",1.0,6.3279,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 5 |
+
d-Sotalol,Bristol-Myers Squibb,Phase III,discontinued,CC(C)NC[C@@H](O)c1ccc(NS(C)(=O)=O)cc1,ZBMZVLHSJCTVON,,,"ic50_available=False for functional IC50: no functional hERG IC50 exists in this project's data (the FDA panel row for sotalol is likewise Ki-headline). Binding Ki = 24,663 nM (pKi 4.608), [3H]dofetilide displacement, Negami et al. 2019 SI Table S1 - Ki is recorded here for context only and is NOT pooled as an IC50, per project rules. Qualitative evidence: selective IKr blocker; SWORD dosing was QTc-gated (held above QTc 560 ms).","Ki: data/fda_benchmark_herg.csv, Sotalol row (Negami et al. 2019, Sci Rep 9, SI Table S1; primary Diaz et al. 2004)",,A,"SWORD, the Phase III mortality trial of this selective IKr blocker in post-MI LV dysfunction, was stopped early: mortality 5.0% on d-sotalol vs 3.1% on placebo (RR 1.65), with presumed arrhythmic deaths (RR 1.77) accounting for the excess; standalone d-sotalol development ended (the racemate remains marketed).","Waldo AL et al. (SWORD Investigators), Lancet 1996;348:7-12 (primary): trial stopped after 3,121 of 6,400 planned patients; 'presumed arrhythmic deaths accounted for the increased mortality' on d-sotalol.","Pratt CM et al., Am J Cardiol 1998 - recorded as a caveat, not a contradiction of the termination reason: 'very little objective data supports torsades de pointes or any specific proarrhythmic mechanism' for the individual excess deaths. The Frontiers AF review describes d-sotalol as 'a phase 3 K+ channel (hERG/IKr) blocker' with QTc-gated dosing.",False,1,"IDENTITY OVERLAP: connectivity block is identical to racemic sotalol, which already sits in the FDA panel (approved_blocker) and in hERG-70 - so this row adds a new development HISTORY but not a new chemical identity versus those sets. NOT in the locked training pools (panel lockout); IS in UnihERG_DB. Enantiomer-specific row: SMILES shown is the (R)-(+)-enantiomer (dextrosotalol, PubChem CID 119259); racemate shares the compound_key. Grade A refers to proarrhythmic (hERG-mechanism) mortality as the termination cause; the TdP-specific mechanism for individual deaths is presumed, per the Pratt caveat.",0.0033333333333333335,4.1311208009983424,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 6 |
+
Tedisamil,Solvay Pharmaceuticals,Phase III (NDA filed; FDA advisory review),refused,C1CCC2(C1)C1CN(CC3CC3)CC2CN(CC2CC2)C1,CTIRHWCPXYGDGF,2500.0,5.6021,"Project quantitative master: single functional (ChEMBL assay type F) IC50 measurement, 2,500 nM.",data/herg_master_quantitative.csv (this project; ChEMBL CHEMBL113461),1.0,B,"FDA Cardiovascular & Renal Drugs Advisory Committee (Dec 2007) voted not to recommend approval: the programme showed a narrow therapeutic window with 11 documented torsade-like arrhythmia episodes (5 in men, 6 in women, several requiring cardioversion) and dose-related QT prolongation; Solvay was asked for more data, never resubmitted, and the programme ended.",Circulation 2009 review of new AF drugs / advisory proceedings: tedisamil had 'a narrow therapeutic window'; 'Five torsade-like arrhythmia episodes documented in men and six in women'; the FDA advisory committee 'voted not to recommend approval of tedisamil' and requested Solvay submit more information.,"NCATS Inxight Drugs (tedisamil entry): 'An FDA advisory committee voted against recommending approval of tedisamil maleate in December, 2007.'",False,1,"KC-8857; multichannel class III (IKr/IKs/Ito + INa). Grade B rather than A: the formal regulatory outcome was a non-recommendation + request for more data, with proarrhythmia/QT the central safety issue but not a single-cause refusal letter. Member of external hERG-60 set and of UnihERG_DB; NOT in the locked training pools.",1.0,5.602100000000012,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 7 |
+
Sematilide,Bayer HealthCare (Berlex),Phase III,discontinued,CCN(CC)CCNC(=O)c1ccc(NS(C)(=O)=O)cc1,KHYPYQZQJSBPIX,25000.0,4.6021,"APPROXIMATE literature value: IKr IC50 ~25 uM, whole-cell patch clamp in rabbit atrial myocytes (native IKr, not a hERG expression system), as compiled in vendor technical literature from the primary electrophysiology papers. Sematilide is absent from this project's ChEMBL/BindingDB pulls and masters. The 10 uM blocker call (0) is robust across the reported 10-30 uM range; the point value should be treated as an order-of-magnitude estimate.","Vendor-compiled technical guides (BenchChem, citing the primary sematilide electrophysiology literature): 'Sematilide inhibits this channel in a concentration-dependent manner, with a reported IC50 of approximately 25 uM' (rabbit atrial myocytes).",0.0,C,"Selective IKr blocker discontinued in the cardiac-arrhythmia indication after Phase III-era development; its documented clinical liability was dose-dependent proarrhythmia (aggravation of arrhythmias in 3/14 patients in the clinical pharmacology study; TdP reported). No public source itemizes the sponsor's reason for termination - weakest-evidence member of this set, graded C accordingly.",AdisInsight drug profile (sematilide; originator Bayer HealthCare Pharmaceuticals): Highest Development Phases - 'Discontinued: Cardiac-arrhythmias' (CK-1752 / ZK-110516).,"Synapse (PatSnap) R&D records: 'Drug Highest Phase: Discontinued Phase 3' (Bayer, cardiac arrhythmias); NCATS Inxight Drugs: 'The further development of the drug was discontinued.'",False,1,"Member of external hERG-70 set and of UnihERG_DB; NOT in the locked training pools. Like sotalol, sematilide is a weak-potency hERG blocker whose clinical QT/proarrhythmia liability appeared at high (micromolar) exposure - a deliberately retained hard case for threshold-based calls.",0.0,4.300514999499995,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
| 8 |
+
Tecastemizole,Sepracor Inc.,Phase III (NDA filed; not-approvable letter),refused,Fc1ccc(Cn2c(NC3CCNCC3)nc3ccccc32)cc1,SFOVDSLXFUGAIV,28.0,7.5528,Project quantitative master median of 12 measurements (ChEMBL CHEMBL240 + BindingDB Q12809; assay types B and F; spread 0.01 log - the most precisely measured compound in this set). Potent hERG blocker.,data/herg_master_quantitative.csv (this project; ChEMBL CHEMBL61301 + BindingDB),1.0,C,"FDA issued a not-approvable letter (Mar 2002) for the allergic-rhinitis NDA citing several safety issues - long elimination time/accumulation, phospholipidosis and cardiomyopathy in preclinical studies, and the need for additional data on QTc prolongation; after further studies Sepracor discontinued development (Dec 2003), also weighing antihistamine-market dynamics. QTc was one of several cited reasons - grade C.","BioCentury, 2 Dec 2003 ('Sepracor ends Soltara program'): 'In March 2002, SEPR received a non-approvable letter citing safety issues related to the compound's long elimination time, including phospholipidosis and cardiomyopathy seen in preclinical studies, and the need for additional data on QTc prolongation (a cardiovascular side effect).'","Medscape, 8 Mar 2002 ('FDA rejects allergy drug over side effects'): 'Concerns over cardiac arrhythmias are prompting the US FDA to issue a nonapprovable letter... Tecastemizole also appeared to increase potential for QTc prolongation.' Sepracor SEC Form 424B3 (2004) confirms the Dec 2003 discontinuation decision and its mixed basis.",True,2,"TIER 2: tecastemizole IS present in both locked training pools (it is a common hERG dataset compound) - it must be reported separately and never mixed into Tier-1 scores. It is norastemizole, the active metabolite of astemizole (an FDA-panel drug), but a distinct compound/connectivity. In UnihERG_DB; in no existing held-out set.",1.0,7.552799999999973,IN-SAMPLE demonstration only - all REGFAIL compounds were absorbed into the deployment training files; NOT validation
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
rdkit==2026.9.1
|
| 2 |
+
scikit-learn==1.9.1
|
| 3 |
+
numpy==2.5.4
|
| 4 |
+
pandas>=2.0
|
validation_results.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"deployment_refit": true,
|
| 3 |
+
"in_sample_diagnostics_ONLY_not_validation": {
|
| 4 |
+
"cls_scaffold": 1.0,
|
| 5 |
+
"cls_random": 1.0,
|
| 6 |
+
"reg_scaffold": 9.239338538866721e-11,
|
| 7 |
+
"reg_random": 9.239338538866721e-11
|
| 8 |
+
},
|
| 9 |
+
"hard_gate_report": {
|
| 10 |
+
"per_set": {
|
| 11 |
+
"herg70": {
|
| 12 |
+
"unique_keys": 462,
|
| 13 |
+
"connectivity_in_cls_file": 462,
|
| 14 |
+
"in_cls_training_matrix": 462,
|
| 15 |
+
"full_ikey_in_cls_file": 452,
|
| 16 |
+
"connectivity_in_reg_file": 462,
|
| 17 |
+
"in_reg_training_matrix": 462,
|
| 18 |
+
"full_ikey_in_reg_file": 452
|
| 19 |
+
},
|
| 20 |
+
"herg60": {
|
| 21 |
+
"unique_keys": 249,
|
| 22 |
+
"connectivity_in_cls_file": 249,
|
| 23 |
+
"in_cls_training_matrix": 249,
|
| 24 |
+
"full_ikey_in_cls_file": 245,
|
| 25 |
+
"connectivity_in_reg_file": 249,
|
| 26 |
+
"in_reg_training_matrix": 249,
|
| 27 |
+
"full_ikey_in_reg_file": 245
|
| 28 |
+
},
|
| 29 |
+
"new_compounds": {
|
| 30 |
+
"unique_keys": 967,
|
| 31 |
+
"connectivity_in_cls_file": 967,
|
| 32 |
+
"in_cls_training_matrix": 967,
|
| 33 |
+
"full_ikey_in_cls_file": 967,
|
| 34 |
+
"connectivity_in_reg_file": 967,
|
| 35 |
+
"in_reg_training_matrix": 967,
|
| 36 |
+
"full_ikey_in_reg_file": 967
|
| 37 |
+
},
|
| 38 |
+
"fda": {
|
| 39 |
+
"unique_keys": 36,
|
| 40 |
+
"connectivity_in_cls_file": 36,
|
| 41 |
+
"in_cls_training_matrix": 36,
|
| 42 |
+
"full_ikey_in_cls_file": 34,
|
| 43 |
+
"connectivity_in_reg_file": 36,
|
| 44 |
+
"in_reg_training_matrix": 36,
|
| 45 |
+
"full_ikey_in_reg_file": 34
|
| 46 |
+
},
|
| 47 |
+
"regfail": {
|
| 48 |
+
"unique_keys": 7,
|
| 49 |
+
"connectivity_in_cls_file": 7,
|
| 50 |
+
"in_cls_training_matrix": 7,
|
| 51 |
+
"full_ikey_in_cls_file": 6,
|
| 52 |
+
"connectivity_in_reg_file": 7,
|
| 53 |
+
"in_reg_training_matrix": 7,
|
| 54 |
+
"full_ikey_in_reg_file": 6
|
| 55 |
+
},
|
| 56 |
+
"test1": {
|
| 57 |
+
"unique_keys": 43,
|
| 58 |
+
"connectivity_in_cls_file": 43,
|
| 59 |
+
"in_cls_training_matrix": 43,
|
| 60 |
+
"full_ikey_in_cls_file": 41,
|
| 61 |
+
"connectivity_in_reg_file": 17,
|
| 62 |
+
"in_reg_training_matrix": 17,
|
| 63 |
+
"full_ikey_in_reg_file": 15
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"cls_alldata_n": 14441,
|
| 67 |
+
"inchikey_compute_failures_cls": 0,
|
| 68 |
+
"connectivity_vs_compound_key_mismatches_cls": 0,
|
| 69 |
+
"store_missing_cls": 0,
|
| 70 |
+
"bundle_n_train_cls": 14441,
|
| 71 |
+
"reg_alldata_n": 10370,
|
| 72 |
+
"inchikey_compute_failures_reg": 0,
|
| 73 |
+
"connectivity_vs_compound_key_mismatches_reg": 0,
|
| 74 |
+
"store_missing_reg": 0,
|
| 75 |
+
"bundle_n_train_reg": 10370,
|
| 76 |
+
"pass": true
|
| 77 |
+
},
|
| 78 |
+
"honest_locked_benchmark_scores": {
|
| 79 |
+
"source": "Locked-pool Phase-5 refits (train+val only; every external/regulatory set locked out), results/phase5/PHASE5_RESULTS.md \u2014 these are the honest benchmark scores of this architecture. The DEPLOYMENT refits in this repo absorbed those sets and are never scored on them.",
|
| 80 |
+
"classification_scaffold_refit": {
|
| 81 |
+
"hERG-70": {
|
| 82 |
+
"ACC": 0.76,
|
| 83 |
+
"MCC": 0.543
|
| 84 |
+
},
|
| 85 |
+
"new_compounds_MCC": 0.149,
|
| 86 |
+
"FDA_errors": "4/36",
|
| 87 |
+
"REGFAIL_Tier1": "4/5"
|
| 88 |
+
},
|
| 89 |
+
"classification_random_refit": {
|
| 90 |
+
"hERG-70": {
|
| 91 |
+
"ACC": 0.74,
|
| 92 |
+
"MCC": 0.504
|
| 93 |
+
},
|
| 94 |
+
"new_compounds_MCC": 0.154,
|
| 95 |
+
"FDA_errors": "5/36",
|
| 96 |
+
"REGFAIL_Tier1": "4/5"
|
| 97 |
+
},
|
| 98 |
+
"regression_scaffold_refit": {
|
| 99 |
+
"hERG-70_RMSE": 0.838
|
| 100 |
+
},
|
| 101 |
+
"regression_random_refit": {
|
| 102 |
+
"hERG-70_RMSE": 0.829
|
| 103 |
+
},
|
| 104 |
+
"note": "Best SINGLE (non-fusion) model on hERG-70 in the programme (MCC 0.543); the best overall classifier is Fusion G (0.548, XGBoost + CardioGenAI), which is not a deployment model."
|
| 105 |
+
},
|
| 106 |
+
"note": "In-sample diagnostics are printed for sanity only (ExtraTrees in-sample accuracy is 1.0000 and in-sample regression RMSE ~0.0000 by construction of the algorithm \u2014 fully grown trees memorize the training rows; they are NOT performance estimates). These refits absorbed every external/regulatory set, so no honest external validation of them exists; the honest scores of this architecture are the locked-pool Phase-5 refits listed under honest_locked_benchmark_scores."
|
| 107 |
+
}
|