# Validation Protocol, Benchmark Architecture & Partner Release Gate

**IonTriage / VUS Mechanistic Triage Platform**  
**Version:** 2.2.1-prerelease (WP-2 / WP-3)  
**Status:** Pre-Registration Active · Held-Out Test Set Sealed · Build-Ahead Complete  
**Date:** October 2026  

---

## 1. Executive Summary

Computational triage of Variants of Uncertain Significance (VUS) across human channelopathies has historically suffered from high opposite-direction error rates, circular test evaluation, and structural priors masquerading as mechanistic predictions. 

When evaluated on unselected random variants, legacy heuristic decision trees default to **Loss of Function ~44% of the time and Gain of Function under 6%**. In a clinical setting, calling a Gain-of-Function variant "Loss of Function" (or the reverse) is a catastrophic error that directs contraindicated pharmacology (e.g. administering sodium channel blockers to an SCN1A Dravet syndrome patient, or withholding Class Ib blockers from an SCN5A LQT3 patient).

**The core design principle of this platform is that the ability to abstain outranks raw accuracy.** An affirmative verdict of *"Insufficient evidence for a directional call"* with a transparent resolution roadmap protects patient safety and eliminates confident wrong answers.

### Target Performance Shape

| Safety & Efficacy Metric | Partner Release Bar | Clinical Rationale |
|---|---|---|
| **Opposite-Direction Rate** (Safety Outrank) | **< 5.0%** | Calling GoF as LoF (or LoF as GoF) is strictly constrained; outranks all other metrics |
| **Balanced Accuracy** (Answered Set) | **70.0% – 85.0%** | Clinically defensible, publishable performance across all 15 target genes |
| **Coverage Floor** | **50.0% – 75.0%** | Honest coverage; variants lacking decisive evidence return safe abstention |
| **Expected Calibration Error (ECE)** | **< 0.1000** | Output scores represent empirical probabilities, not arbitrary High/Moderate/Low labels |
| **Simulation Precision** | **Qualitative Illustrative** | Numerical millisecond outputs from unmeasured kinetic guesses are strictly decoupled |

---

## 2. Benchmark Architecture (WP-2)

### 2.1 The 15 Target Channelopathy Genes

The IonTriage platform targets 15 human ion channel and transporter genes responsible for life-threatening channelopathies (with candidate benchmark sourcing active across them; currently 719 candidate rows across 8 genes at status UNVERIFIED):

| Gene | Subunit / Channel | Primary Pathology | Canonical Protein Length |
|---|---|---|---|
| `SCN1A` | Nav1.1 Voltage-Gated Sodium Channel | Dravet Syndrome / GEFS+ / FHM3 | 2,009 aa |
| `SCN2A` | Nav1.2 Voltage-Gated Sodium Channel | Early-Onset Epileptic Encephalopathy / ASD | 2,005 aa |
| `SCN4A` | Nav1.4 Skeletal Muscle Sodium Channel | Hypo/Hyperkalemic Periodic Paralysis / Myotonia | 1,836 aa |
| `SCN5A` | Nav1.5 Cardiac Sodium Channel | Brugada Syndrome (LoF) / LQT3 (GoF) / PCCD | 2,016 aa |
| `SCN8A` | Nav1.6 Neuronal Sodium Channel | Developmental and Epileptic Encephalopathy 13 | 1,980 aa |
| `KCNQ1` | Kv7.1 Voltage-Gated Potassium Channel | Long QT Syndrome 1 (LoF) / Short QT 2 (GoF) | 676 aa |
| `KCNH2` | Kv11.1 (hERG) Potassium Channel | Long QT Syndrome 2 (LoF) / Short QT 1 (GoF) | 1,159 aa |
| `KCNJ2` | Kir2.1 Inward-Rectifier Potassium Channel | Andersen-Tawil Syndrome (LoF) / Short QT 3 (GoF) | 427 aa |
| `KCNE1` | MinK Auxiliary Potassium Channel Beta | Long QT Syndrome 5 / Jervell and Lange-Nielsen | 129 aa |
| `CACNA1A` | Cav2.1 P/Q-Type Calcium Channel | Episodic Ataxia 2 (LoF) / FHM1 (GoF) | 2,506 aa |
| `CACNA1C` | Cav1.2 L-Type Calcium Channel | Timothy Syndrome (GoF) / Brugada (LoF) | 2,221 aa |
| `RYR2` | Ryanodine Receptor 2 (Cardiac SR Ca2+) | CPVT1 (GoF) / CRDS (LoF) | 4,967 aa |
| `CFTR` | ABC Chloride Transporter / Channel | Cystic Fibrosis (Classes I–VI) | 1,480 aa |
| `GRIN2A` | GluN2A NMDA Receptor Subunit | Epilepsy-Aphasia Spectrum / CSWS | 1,464 aa |
| `GRIN2B` | GluN2B NMDA Receptor Subunit | Neurodevelopmental Disorder / Severe ID | 1,484 aa |

### 2.2 Row Schema & The Two-Person Rule

Every row in the candidate pool conforms to the strict Pydantic [`BenchmarkRow`](benchmark/schema.py) specification:
- **Identifier**: `gene` (1 of 15), `uniprot_pos` ($1 \le \text{pos} \le \text{canonical\_length}$), `wt_aa` and `mut_aa` (1-letter), `hgvs_p` (standard 3-letter notation, e.g. `p.Arg1623Gln`).
- **Directional Ground Truth**: `direction` $\in \{\text{"Gain of Function (GoF)"}, \text{"Loss of Function (LoF)"}, \text{"Neutral / Likely Benign"}, \text{"Mixed / Unclassifiable"}\}$.
- **Evidence Anchor**: Mandatory `pmid` (numeric string) and verbatim `quote` from the primary literature detailing experimental patch-clamp or functional measurements.
- **Two-Person Verification Rule**: `verifier` MUST be distinct from `curator` (`curator != verifier`). No agent or automated tool writes a verified direction that enters truth.
- **Structural Gating**: All candidate rows are initialized with `status: "UNVERIFIED"`. Scoring loaders structurally filter out unverified rows unless an explicit `--dry-run` or `--allow-unverified` flag is provided.
- **Preprint & Publication Policy**: Where functional characterization originates from preprints or newly published literature (e.g. Kurganov et al., published in *Sci Transl Med* 17(828): eadr0024 [2025], DOI: 10.1126/scitranslmed.adr0024, PMID: 41370402, superseding bioRxiv 2025.04.23.650298 for `CACNA1A`), data are explicitly documented in `benchmark/sources/README.md`. Furthermore, when authors report continuous biophysical measurements (e.g., z-scores across current density and gating shifts) without assigning categorical GoF/LoF direction calls, directional labels cannot be adopted verbatim. The human curator must define explicit objective derivation rules before any such candidate enters truth.

### 2.3 Split Protocol (Not Yet Executed)

The candidate pool currently holds 719 rows across 8 genes, all at status: UNVERIFIED (0 VERIFIED). No split has been generated. The 60/20/20 stratified split, its cryptographic seal and benchmark/split_manifest.json will be created only after human curator verification is complete. No sealed test set exists at this time, and no metric has been computed against held-out data.

### 2.4 Four-Way Structural Leakage Gate (`scripts/check_leakage.py`)

CI automatically runs the leakage gate to guarantee structural impossibility of test set memorization:
1. **Integer Literal Check**: No `uniprot_pos` from any test row appears as an integer literal in decision-path files.
2. **HGVS String Check**: No `hgvs_p` string from any test row appears in decision-path files.
3. **Truth Collision Check**: No test row appears in `EMPIRICAL_BENCHMARK_TRUTH_SET` or unit test fixtures.
4. **Range Comparison Check**: No range comparison literal in decision-path code (e.g. `low <= pos <= high`) contains a test row coordinate.

---

## 3. Classifier Rebuild Methodology (WP-3)

### 3.1 Feature Space (Properties Over Positions)

The rebuilt classifier replaces memorized residue lists with 26 generalizable biophysical, structural, and evolutionary properties ([`src/vus_mechanistic_triage/features.py`](src/vus_mechanistic_triage/features.py)):

1. **Structural Geometry**:
   - AlphaFold Euclidean distance to central pore permeation axis ($\text{\AA}$).
   - AlphaFold distance to selectivity filter ($\text{\AA}$).
   - Relative solvent accessibility / burial fraction.
   - Local backbone pLDDT score and low-confidence flag ($\text{pLDDT} < 70$).
   - Contact count within $8\text{ \AA}$ sphere.
   - Secondary structure classes (alpha helix, beta sheet, loop/turn).
2. **Mechanism Topology**:
   - Voltage-sensor S4 segment membership and gating charge indicator ($R/K$).
   - Fast-inactivation gate / hinged-lid linker region (IFM motif).
   - Selectivity filter and inner pore-lining helix.
   - Ligand-binding domain (LBD) or regulatory EF-hand interface.
   - Subunit assembly and trafficking chaperone interface.
   - Linear sequence distance to nearest annotated functional motif.
3. **Biophysical Deltas**:
   - Grantham physicochemical distance ($0 - 215$).
   - BLOSUM62 evolutionary substitution score.
   - Van der Waals volume change ($\Delta V, \text{\AA}^3$).
   - Formal electrostatic charge delta at physiological pH 7.4 ($\Delta q, e$).
   - Proline and glycine disruption indicators.
   - Kyte-Doolittle hydropathy index delta.
   - Predicted folding stability change ($\Delta\Delta G, \text{kcal/mol}$) and uncertainty.
4. **Evolutionary Conservation**:
   - Multi-species Shannon conservation entropy (bits).
   - Mutant amino acid tolerance in aligned vertebrate orthologs.
   - Human channel family paralog conservation score.
5. **Gene Constraint**:
   - gnomAD Loss-of-function Observed/Expected Upper Bound Fraction (LOEUF).
   - Probability of Loss-of-function Intolerance (pLI).

> [!CRITICAL]
> **Allele frequency (gnomAD AF) is strictly excluded** from the feature space. AF acts as a benignity threshold, not a mechanistic direction signal, and its inclusion artificially inflates pathogenic direction concordance.

### 3.2 Model & Training Architecture (`src/vus_mechanistic_triage/training.py`)

- **Model Class**: Regularized multinomial logistic regression with balanced class weights (or shallow gradient-boosted trees). Neural networks are intentionally avoided to ensure transparent mathematical interpretability and full inspectability of learned feature weights.
- **Multi-Class Formulation**: 3 distinct classes: `Gain of Function (0)`, `Loss of Function (1)`, and `Neutral / Likely Benign (2)`. `Mixed` variants are excluded from training and reported separately in evaluation.
- **Gene-Grouped Cross-Validation**: `GroupKFold` grouped by gene guarantees that variants from the same gene never appear in both fold-train and fold-validation, preventing the memorization of gene identity.

---

## 4. Calibration & Abstention Protocols

### 4.1 Post-Hoc Probability Calibration (`src/vus_mechanistic_triage/calibration.py`)

Raw classifier outputs do not represent true empirical probabilities. To provide honest confidence:
- A multi-class calibrator (Platt scaling or isotonic regression) is fit strictly on the **`dev` split**, never on `train` or `test`.
- Evaluates Expected Calibration Error (ECE) and Maximum Calibration Error (MCE) using reliability diagram binning.
- Replaces arbitrary "High/Moderate/Low" verbal tags with true calibrated probabilities ($p \in [0.0, 1.0]$). Target ECE is $< 0.1000$.

### 4.2 Abstention Decision Harness

- **Threshold Sweeper**: Sweeps operating threshold $\tau \in [0.35, 0.95]$ on calibrated `dev` probabilities.
- **Decision Rule**: Let $\hat{p} = \max_k p_k$. If $\hat{p} < \tau$, the classifier returns *"Insufficient evidence for a directional call"* (Abstain).
- **Safety Objective**: Selects the operating point satisfying **$\text{Opposite-Direction Rate} < 5.0\%$** subject to a **$\text{Coverage} \ge 50.0\%$** floor.
- **Resolution Roadmap**: When abstaining, the platform generates an actionable scientific explanation detailing why the call was withheld and the exact clinical tests (patch-clamp, ortholog alignment, trio sequencing) required to resolve it.

---

## 5. Baseline Comparison Framework

Evaluation is partitioned into two distinct tasks to ensure scientifically rigorous and honest comparison:

### 5.1 Two-Table Benchmark Architecture

#### Table 1 — Functional Direction (GoF vs. LoF)
- **Target Population:** Pathogenic variants with resolved functional direction ($\text{GoF}$ vs. $\text{LoF}$).
- **Comparator:** IonTriage versus the empirical **Trivial Per-Gene Majority Baseline** (derived strictly from `train`).
- **Domain Rationale:** *No published general-purpose predictor performs this task (predicting functional direction: Gain-of-Function vs. Loss-of-Function), and this is the specific gap IonTriage exists to address.* General-purpose predictors (REVEL, AlphaMissense, CADD) predict damage/pathogenicity, not functional polarity; mapping a pathogenicity score to GoF/LoF trivially reduces to the majority class and would be misleading in IonTriage's favour.
- **Metrics:** Opposite-Direction Rate ($< 5.0\%$ safety bar), Balanced Accuracy, Macro-F1, Coverage.

#### Table 2 — Pathogenicity (Neutral vs. Non-Neutral)
- **Target Population:** All benchmark variants with definitive binary pathogenicity truth ($\text{Pathogenic} \in \{\text{GoF}, \text{LoF}\}$ vs. $\text{Neutral} \in \{\text{Neutral / Likely Benign}\}$).
- **Comparators:** IonTriage versus **REVEL** and **AlphaMissense** using dbNSFP 0–1 normalized rankscores.
- **Scientific Value:** This is the task REVEL and AlphaMissense were actually trained to perform, enabling a fair and informative comparison in both directions. If IonTriage cannot separate neutral from pathogenic variants as effectively as REVEL, that is a genuine empirical finding that must be known and reported.
- **Metrics:** Balanced Accuracy, Sensitivity (Pathogenic Recall), Specificity (Neutral Recall), Coverage.

### 5.2 Baseline Provenance & dbNSFP MCP Service Integration
- **Acquisition Date:** 2026-10-18.
- **Source Endpoint:** Public Genos-hosted dbNSFP MCP service (`https://mcp.dbnsfp.org/mcp`).
- **Service Version:** dbNSFP 5.4c, MANE release 1.5, schema `variant-catalog-api/2`, built 2026-08-04.
- **Predictor Status:**
  - **REVEL:** Obtained via `REVEL_rankscore` (0–1 normalized across dbNSFP).
  - **AlphaMissense:** Obtained via `AlphaMissense_rankscore` (0–1 normalized across dbNSFP).
  - **CADD:** **UNAVAILABLE** on the dbNSFP 5.4c branch. Probe confirmed 0 matching columns in catalog and the service returned explicit warning `No column named CADD_phred / CADD_raw on this branch: not in the 5.4c branch. CADD is listed under interpretation_guide.not_served_here; do not substitute another predictor for it.` CADD is not substituted, approximated, or imputed.
- **Transcript Policy:** Strict **MANE Select** (`transcripts: "mane"`, `MANE == "Select"`). If a variant lacks a MANE Select transcript, it is recorded as unscored (`None`).
- **Multi-SNV Preservation & Scoring Aggregation Policy:** In a protein-level benchmark, a missense amino acid change can be reachable by multiple distinct single nucleotide variants (SNVs) on the MANE Select coding sequence (e.g. `CACNA1C p.Gly406Arg` reachable by both `chr12:2504944 G>A` and `G>C`). All returned MANE Select SNVs are preserved unaggregated in the committed raw cache (`mane_select_rows`). At scoring time, where multiple reachable SNVs exist on MANE Select, the unweighted arithmetic mean across those reachable SNVs is computed. The benchmark report explicitly declares how many variants in the evaluated cohort matched multiple MANE Select SNVs.
- **Missing Data Handling:** Nulls propagate as missing/unscored and are excluded from metric denominators. Nulls are never imputed and never defaulted to neutral.
- **Offline Reproducibility:** All responses are committed to `benchmark/baselines/baseline_scores.json` with metadata, query date, and service version. Evaluation runs offline without network access.

### 5.3 Negative Result Publication Commitment
If the reconstructed classifier fails to beat the trivial majority baseline or fails the $< 5.0\%$ opposite-direction rate threshold, **the findings will be published in full without suppression, modification of thresholds, or post-hoc alteration of splits**.

---

## 6. Partner Release Gate Checklist

To transition from internal build-ahead to external clinical/biopharma partner review, all gates must be verified:

### 6.1 Scientific Rigor
- [ ] Sealed `test` split run exactly once with 10,000-resample bootstrap 95% CIs.
- [ ] Opposite-direction rate verified $< 5.0\%$ at the locked operating point.
- [ ] Calibration curve published with ECE $< 0.1000$.
- [ ] Abstention engine active in UI, generating actionable resolution pathways.
- [ ] Per-gene breakdown published, explicitly identifying the weakest genes.

### 6.2 Transparency & Honesty
- [x] `VALIDATION.md` complete and committed to repository root.
- [x] `docs/METHOD.md` complete with all unsourced numerical cutoffs declared.
- [x] Persistent validation banner and first-visit acknowledgment modal live in UI.
- [x] Limitations section displayed directly on the website.
- [x] Research Use Only (RUO) disclaimers present across all application views and exported documents.

### 6.3 Product & Governance
- [x] Prior-auth, eIND, and CLIA-report PDF generation gated as disabled/draft-only during pre-clinical validation.
- [x] Audit decision logging endpoint (`POST /api/v1/decision_log`) active for reconstructing reported discrepancies.
- [ ] Channelopathy electrophysiologist sign-off on `VALIDATION.md`.
- [x] Named communication channel for partners to submit discordant electrophysiology data (`research@iontriage.com` / discrepancy audit).
