Skip to content
AxelNounPublic

About

Modèle hybride GNN + ESM-2 pour la prédiction d'affinité kinase-inhibiteur, sous protocole d'évaluation sans fuite de données.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

KinoScope

Kinase–inhibitor affinity prediction with a hybrid GNN + ESM-2 model, under a leakage-free evaluation protocol.

CI Python 3.11 License: Apache-2.0

This repository is a public record of work in progress. It is built in the open, one verified step at a time, against the roadmap in MASTER_PLAN.md. Everything below that is claimed has been measured; everything that has not been measured is labelled as such.


The problem

Published drug–target interaction results on Davis and KIBA are obtained under a random split. That split puts the same ligand on both sides of the train/test boundary, so the model learns a compound prior rather than an interaction function. The published number therefore says nothing about an unseen chemotype or an unseen kinase — the only regime that matters in drug discovery.

KinoScope does two things:

  1. A hybrid model — GINE (ligand) × ESM-2 (85-residue KLIFS pocket) — fused by bilinear attention, with a heteroscedastic output and calibrated conformal intervals.
  2. A four-regime evaluation protocol (random, cold-drug, cold-target, temporal) with an automated leakage audit in CI, measuring honestly what generalises.

The scientific claim under test is that performance collapses from random to cold_target. Reporting that collapse is the result.


What is built and verified

make check exits 0: ruff, mypy --strict, 98 tests, 84 % branch coverage.

Component State Where
Six split strategies — random, scaffold, Butina, cold-target, cold-pair, temporal implemented, tested data/splits.py
Quantitative leakage audit — shared InChIKeys, scaffolds, targets, nearest-neighbour Tanimoto implemented, tested data/splits.py
RDKit standardisation — fragment choice → normalisation → uncharging → canonical tautomer implemented, tested data/standardize.py
Metric suite — RMSE, Pearson, Spearman, concordance index, Roy's r²ₘ, AUPR, AUROC, EF@1 % implemented, tested eval/metrics.py
Bootstrap confidence intervals implemented, tested eval/metrics.py
Split-conformal calibration, finite-sample quantile, Mondrian variant implemented, tested eval/conformal.py
Applicability domain — nearest-neighbour Tanimoto to the training set implemented, tested eval/applicability.py
Model — GINE encoder, PLM adapter, bilinear attention fusion, heteroscedastic head implemented, shape- and gradient-tested models/model.py
Global determinism implemented, tested bit-for-bit utils/seed.py
Trained model, reported numbers not done —

Test suite: example-based tests for the cases one thinks of, plus Hypothesis property tests for the class of cases one does not. The property tests draw from a pool of real molecules and apply identity-preserving transformations — non-canonical SMILES rewriting, atom renumbering, explicit-hydrogen variants — which are exactly the transformations a correct featuriser must absorb.


Architecture

SMILES ──RDKit──> 2D graph ──GINE×5 (residual + JK)──> [B, Na, 256] ─┐
                                                                     ├─> BAN ─> MLP ─> (μ, log σ²)
UniProt ──KLIFS──> 85 residues ──ESM-2 (frozen, cached)──> [B, 85, 256] ─┘    └─> contact map

The protein encoder is restricted to the 85 KLIFS-aligned ATP-pocket positions rather than the full kinase domain, and ESM-2 embeddings are precomputed once into LMDB — the language model is never re-run at inference, which is what makes CPU serving viable.


Results

No model has been trained yet. This table is the shape of the result, not the result.

Split regime RMSE ↓ Pearson r ↑ Spearman ρ ↑ CI ↑ PICP@90 %
random (optimistic control) — — — — —
scaffold (cold-drug) — — — — —
cold_target (leave-group-out) — — — — —
temporal (prospective) — — — — —

Every published figure will carry its bootstrap 95 % CI and will be regenerated by code, never typed by hand.


Defects found and reported

Part of the point of this repository is that the failures are visible.

_group_split ignored its seed — found by a property test, since fixed. Each bucket was shuffled and then sorted, which annuls the shuffle, and the group-to-bucket assignment was otherwise deterministic. Measured before the fix: one distinct test partition across four seeds for scaffold and cold_target, against four for random_split. A confidence interval computed across seeds for the group-based regimes was therefore aggregating identical replicates and was artificially narrow — it measured initialisation variance while being reported as covering split variance too. The fix shuffles the group list before a stable sort by descending size, so the seed breaks ties between equal-sized groups without disturbing the largest-first order the greedy bin-packing relies on.

The single-batch overfitting check was measuring noise. The canonical architecture sanity check trains 400 steps on four examples and asserts a loss below 0.05. It failed — but with all four dropout layers active in training mode. Measured on the same run: 7.13 with default dropout, 0.80 re-evaluated in eval mode after that same training, 0.0000 with dropout disabled. The architecture overfits four examples perfectly; the test was wrong. It also had no seed, so the loss varied from 3.3 to 7.1 between runs.

A test fixture was silently vacuous. With only five Bemis-Murcko scaffolds, greedy 80/10/10 bin-packing produced train=240, valid=60, test=0 — so the scaffold-disjointness assertions passed on an empty set. The fixture now carries seventeen ring systems. It deliberately keeps cyclopentane, cyclohexane and cycloheptane, whose ECFP4 fingerprints are identical (every atom has the same radius-2 environment): Tanimoto 1.0 across disjoint scaffolds is precisely what a leakage audit must catch.

audit_leakage raised on a degenerate partition. It now reports NaN and logs a warning rather than 0.0, which would read as "no leakage detected".

A Hydra config could not be parsed at all. In YAML flow style, the braces of ${now:%Y-%m-%d} are read as a nested mapping; OmegaConf itself failed to load the file, so the training entry point would never have started.


Engineering

  • Static analysis: ruff with 13 rule families and mypy --strict, zero violations. Every exemption is justified in place — a noqa without a reason is a defect.
  • Determinism: one seeding entry point covering random, NumPy, torch and CUDA, with strict deterministic algorithms. The two limits that are usually hidden — PYTHONHASHSEED only affecting child processes, and np.random.seed only touching the legacy global generator — are documented in the module rather than glossed over.
  • CI: lint, typecheck, test and a leakage gate. Actions are pinned by commit SHA, the GITHUB_TOKEN is scoped to contents: read, credentials are not persisted, and the workflows are themselves audited by zizmor.
  • Pre-commit: twelve hooks. mypy runs in the project environment rather than an isolated one — the mirrored hook could not see torch or NumPy and reported 36 phantom import errors instead of real ones.
  • Supply chain: gitleaks over the full history reports no secrets. pip-audit reports 95 known vulnerabilities across 12 pinned packages; the pins date from September 2024 and need review before any deployment.

Current status

Three of 58 roadmap steps are complete. The foundations are verified; the science is not yet done. Known gaps, stated so that nobody discovers them the hard way:

  • No model has been trained. No number in this repository is a measured result.
  • Hydra composition does not resolve. configs/config.yaml declares the groups data: chembl_kinase and trainer: single_gpu, whose files belong to later phases.
  • dvc repro fails. dvc.yaml describes the target pipeline, but five of its dependencies belong to unwritten steps and DVC is not initialised.

Declared limitations

  • Restricted to ATP-site inhibitors (types I/II). Type III/IV allosteric binders fall outside the applicability domain by construction.
  • Human kinases only, with a resolved KLIFS pocket required.
  • The predicted affinity is a pAffinity conditioned on assay type. No Cheng-Prusoff conversion is applied — it requires [S] and Km, which ChEMBL does not carry.
  • Under a cold-target split the exchangeability required by conformal prediction is violated by construction. Coverage will be reported as empirical, not guaranteed.

See MODEL_CARD.md.


Data sources

ChEMBL (CC BY-SA 3.0) · BindingDB (CC BY 3.0) · KLIFS · UniProt (CC BY 4.0) · PDBbind · Davis & KIBA via Therapeutics Data Commons. Details in docs/data_card.md.

About

Modèle hybride GNN + ESM-2 pour la prédiction d'affinité kinase-inhibiteur, sous protocole d'évaluation sans fuite de données.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages