Figure 4: What the gate selects¶
Runs locally against the authors' results (CODE). With RUN = False the cells show the current local figures; set RUN = True to regenerate each panel from the script named. No participant data are stored in this notebook; keep outputs cleared before committing (python ../tools/check_no_ids.py).
Panel a-e Gate: cardiac series, age-varying gate, stability, Lynch, off-signature cells¶
Script: src/reparam_fig3/make_gate_validation_figure_triplet.py
Upstream: static: src/reparam_fig3/fit_cardiac_genes_triplet.py, fit_clinvar_sweep_static_triplet.py; stability: stability_selection_atlas_triplet.py
Script header (inputs, recipe, outputs)
make_gate_validation_figure.py -- the four things the spike-and-slab gate demonstrably does,
each panel a PARSE of a saved fit (no re-fitting in this script).
PANELS
(a) STATIC CARDIAC ALLELIC SERIES. All five cardiac genes scoped to the SAME signature S0, read
from the STATIC fit (fit_cardiac_genes.py, FocalSS, no time axis; sweep_cells/*.npz, nokappa).
Subphenotype resolution is a WHICH-disease question and does not need the time axis; the static
scalar-per-cell offset concentrates each small-N gene's evidence, so ALL FIVE genes select
coherent gene-specific sub-phenotypes -- dilated (TTN/DSP), hypertrophic (MYBPC3), arrhythmogenic
(PKP2/MYH7) -- including TTN->AF (Dpen +3.89). This is the panel to lead the cardiac claim.
(b) DEPLOYED TIME-VARYING GATE. The same five genes read from the deployed delta0 tv atlas: only
TTN (15 cells) + MYBPC3 (4) survive; DSP/MYH7/PKP2 go null (max ungated |eta| ~ 0.04) because
eta(t) spreads each small-N gene's evidence over a function. Static (a) vs tv (b) = which/when.
(c) STABILITY. Selection frequency omega over 10 seeds vs magnitude (tv). Every cell with
mean|eta| >= 0.53 selected 10/10; every unstable cell <= 0.49.
(d) LYNCH ENRICHMENT, MODEL-FREE. Observed precursor and carcinoma rates in ClinVar P/LP carriers
vs 1:4 age/sex-matched controls; also recovers MLH1 > MSH6 > PMS2 with no model in the path.
(e) OFF-SIGNATURE CAPTURE. Opened cells whose own home (argmax_k psi[k,d]) differs from the scoped
signature: the deployed tv atlas 34/203 cells; BRCA2 5 of 5, including the breast cell itself.
INPUTS sweep_cells/*.npz (STATIC cardiac fit, nokappa; per-cell z/eta/dpen)
clinvar_sweep_gp/*_etat.npz (tv atlas, delta0)
premigration_refs_20260626/clinvar_sweep_table.csv (static sweep, nokappa, Jun 27)
stability/*_stability.csv (10-seed selection frequency, tv)
msh6_adenoma_carcinoma_empirical.csv (model-free Lynch rates)
slope_model_nokappa_v3_delta0/*.pt (psi -> each disease's home signature)
OUTPUTS reparam_fig3/fig_gate_validation.png / .pdf (+ .prov.json)
ENV /opt/miniconda3/envs/new_env_pyro2/bin/python