scripts/rank_islet1_stacks.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/rank_islet1_stacks.py · SHA-256: c05d5fe606219e88…
"CYTO_NONE_DEFAULT": {"logit_value": -0.65, "expression": "-0.08 * 8.125", "rationale": "Unprotected against IFN-g/IL-1b/TNF-a + Granzyme B"},
"ER_RNLS_KO": {"logit_value": 0.18, "expression": "0.08 * 2.25", "rationale": "RNLS-/- ER stress / thapsigargin protection (PMID:32719542)"},
"ER_RNLS_KO_PLUS_IAPP_PRAMLINTIDE": {"logit_value": 0.25, "expression": "0.08 * 3.125", "rationale": "RNLS-/- + non-amyloidogenic IAPP proline edit (PMID:25140605, PMID:18753660)"},
"ER_NONE_WITH_STAGE7_120UM_NICHE": {"logit_value": 0.25, "expression": "0.08 * 3.125", "rationale": "Stage 7 OXPHOS maturation + <=120 um oxygenation lowers basal ER/UPR stress"},
},
"Gate5_72h_Vascular_Oxygen_and_80yr_Safety": {
"base_intercept": {"logit_value": 0.15, "expression": "0.08 * 1.875", "rationale": "Baseline engraftment & safety prior"},
"NICHE_TRIHORMONAL_120UM_MVF_CAO2": {"logit_value": 0.45, "expression": "0.08 * 5.625 + _pdelta('stage7_trihormonal_120um_mvf_cao2_niche_prior', 0.45)", "rationale": "<=120 um clusters (<149 um Krogh anoxic limit) + iEC microvessels + 72h CaO2 bridge (PMID:34480863)"},
"NICHE_NAKED_AVASCULAR_TRANSPLANT": {"logit_value": -0.55, "expression": "-0.08 * 6.875", "rationale": "50-70% 72h avascular ischemic core necrosis"},
"NICHE_UNEDITED_MACRODEVICE_ENCAPSULATION": {"logit_value": -0.95, "expression": "-0.08 * 11.875", "rationale": "Severe avascular diffusion barrier + fibrotic foreign-body capsule"},
"SAF_AAVS1_CAG_ICASP9_BIALLELIC": {"logit_value": 0.38, "expression": "0.08 * 4.75", "rationale": "Biallelic safe-harbor pan-lineage iCasp9 switch (PMID:35795779)"},
"SAF_G6PC2_ENDOGENOUS_ICASP9": {"logit_value": -0.45, "expression": "0.08 * -5.625", "rationale": "Lineage-restricted G6PC2::iCasp9 fails to ablate teratoma/SLC18A1+ cells (Graveyard 002)"},
"SAF_NONE_PEDIATRIC": {"logit_value": -0.45, "expression": "-0.08 * 5.625", "rationale": "No prodrug erasability over 70-80 year pediatric horizon"},
"SAF_NONE_LADA": {"logit_value": -0.25, "expression": "-0.08 * 3.125", "rationale": "No prodrug erasability over adult LADA horizon"},
},
"auxiliary_evaluator_hyperparameters": {
"signed_gene_signal_slope": {"parameter_value": 0.42, "rationale": "Linear slope multiplying per-gene net_evidence_and_constraint_score inside signed_gene_signal()"},
"signed_gene_signal_clip_bounds": {"parameter_value": [-4.5, 4.5], "rationale": "Symmetric saturation clamp on cumulative per-branch gene signal"},
"gene_signal_scales_by_gate_and_branch": {
"parameter_value": {
"Gate1_NICHE_INS_GAD2": 0.20,
"Gate1_ALLO_HLA_C_TYK2_KO": 0.20,
"Gate1_AUTO_FULL_KO": 0.35,
"Gate1_ER_RNLS_KO": 0.25,
"Gate2A_ALLO_B2M_HLAE_CD47": 0.30,
"Gate2A_ALLO_HLA_C_TYK2": 0.28,
"Gate2A_ALLO_UP421": 0.28,
"Gate2A_ALLO_VCTX210": 0.25,
"Gate2B_ALLO_B2M_NULL": 0.22,
"Gate2B_HLA_C_INS_EDIT": 0.28,
"Gate2B_HLA_C_FULL_KO": 0.25,
"Gate2B_CYTO_CXCL10_SWAP": 0.25,
"Gate2B_CYTO_IL10_OE": 0.25,
"Gate3_ALLO_B2M_HLAE_CD47": 0.35,
"Gate3_ALLO_HLA_C_TYK2": 0.30,
"Gate3_ALLO_UP421": 0.28,
"Gate4_CYTO_CXCL10_SWAP": 0.32,
"Gate4_CYTO_IL10_OE": 0.30,
"Gate4_CYTO_STAT1_KO": 0.30,
"Gate4_CYTO_VCTX210_A20": 0.25,
"Gate4_ER_RNLS_KO": 0.25,
"Gate5_SAF_ICASP9": 0.25,
},
"rationale": "Branch-specific scaling weights coupling empirical target_profiles into each gate logit (F-04/R10 live-wired parameter inventory)",
},
"cd47_gsis_penalty_scale": {"parameter_value": -0.25, "rationale": "Multiplier routing CD47 weighted_deleterious_penalty_score into Gate 1 (x0.5 for signaling-attenuated CD47-IgV-GPI vs x1.0 for lentiviral CD47-WT; PMID:37820008, PMID:38508139)"},
"lrr_shrinkage_hyperparameters": {
"parameter_value": {"prior_weight": 4.50, "per_empirical_study_slope": 0.50},
"formula": "signed_lrr_weighted_sum / (w_tot + prior_weight + per_empirical_study_slope * n_emp)",
"rationale": "Empirical-Bayes-style shrinkage damping single-study outlier LRRs toward zero",
},
"effect_direction_weights": {"parameter_value": {"protective": 0.50, "deleterious": 0.75, "secretome_or_differentiation_penalty_addon": 0.35, "shrunk_lrr_multiplier": 1.50}, "rationale": "Asymmetric counter-evidence weighting in build_target_evidence_profiles()"},
"omics_constraint_weights": {"parameter_value": {"gnomad_pli_ko_slope": -0.45, "gnomad_loeuf_ko_slope": 0.12, "opentargets_t1d_slope": 0.15}, "rationale": "Perturbation-direction-aware human genetic constraint weights"},
"lower_10pct_cred_bound_hyperparameters": {"parameter_value": {"z_multiplier": 1.2816, "locus_cut_linear_discount": 0.008, "default_gene_se": 0.35, "no_gene_se": 0.45}, "rationale": "Heuristic conservative floor index parameters"},
},
"secondary_ranking_tie_break_and_display_constants": {
"lower_10pct_cred_bound_b_edit_quadratic_discount": {
"parameter_value": 0.005,
"formula": "max(0.0, penalized_index * exp(-z_multiplier * se_combined) - locus_cut_linear_discount * K - lower_10pct_cred_bound_b_edit_quadratic_discount * (B ** 2))",
"rationale": "Secondary display/audit quadratic base-edit floor discount (0.005 * B^2) reported alongside the linear K-only search-grid floor index (Finding 013)",
},
"composite_utility_pediatric_weight": {
"parameter_value": 0.50,
"rationale": "Equal 50% weight on Pediatric_Early_Onset_T1D in composite_series_system_utility (Finding 013)",
},
"composite_utility_adult_weight": {
"parameter_value": 0.50,
"rationale": "Equal 50% weight on Adult_Onset_LADA in composite_series_system_utility (Finding 013)",
},
},
}
def _sec_param(key: str, default: float) -> float:
"""Returns parameter_value for `key` from COMPLETE_GATE_COEFFICIENT_REGISTRY['secondary_ranking_tie_break_and_display_constants']."""
sec = COMPLETE_GATE_COEFFICIENT_REGISTRY.get("secondary_ranking_tie_break_and_display_constants", {})
if isinstance(sec, dict):
entry = sec.get(key, {})
if isinstance(entry, dict) and "parameter_value" in entry:
return _finite_real(entry["parameter_value"], f"Secondary parameter {key}")
return default
def _composite_utility_weights() -> tuple[float, float]:
pediatric = _sec_param("composite_utility_pediatric_weight", 0.50)
adult = _sec_param("composite_utility_adult_weight", 0.50)
if not 0 <= pediatric <= 1 or not 0 <= adult <= 1 or not math.isclose(pediatric + adult, 1.0, rel_tol=0.0, abs_tol=1e-12):
raise ValueError("Composite cohort weights must be nonnegative and sum to one")
return pediatric, adult
def _aux_param(key: str, default):
"""Returns parameter_value for `key` from COMPLETE_GATE_COEFFICIENT_REGISTRY['auxiliary_evaluator_hyperparameters'] so mutations propagate live (Audit R10)."""
aux = COMPLETE_GATE_COEFFICIENT_REGISTRY.get("auxiliary_evaluator_hyperparameters", {})
if isinstance(aux, dict):
entry = aux.get(key, {})
if isinstance(entry, dict) and "parameter_value" in entry:
return entry["parameter_value"]
return default
def _branch_scale(branch_key: str, default_scale: float) -> float:
scales = _aux_param("gene_signal_scales_by_gate_and_branch", {})
if isinstance(scales, dict) and branch_key in scales:
return _finite_real(scales[branch_key], f"Gene-signal branch scale {branch_key}")
return default_scale
def _pdelta(
key: str,
default: float,
gate_key: str | None = None,
entry_key: str | None = None,
reg_default: float | None = None,
) -> float:
"""
Returns (point_estimate - default) from ENGINEERING_PRIORS_AND_SENSITIVITY_TABLE plus any active
PURE_EMPIRICAL_LINEAGE wet-lab posterior shift so prior-table and wet-lab calibration mutations
dynamically propagate into gate logits (Finding 013/081/082).
"""
entry = ENGINEERING_PRIORS_AND_SENSITIVITY_TABLE.get(key, {})
w_deltas = _load_active_wetlab_posterior_deltas()
return (_finite_real(entry.get("point_estimate", default), f"Engineering prior {key}") - default) + _finite_real(w_deltas.get(key, 0.0), f"Wet-lab shift {key}")
def _rdelta(gate_key: str, entry_key: str, default_val: float) -> float:
"""Returns (logit_value - default_val) from COMPLETE_GATE_COEFFICIENT_REGISTRY plus any active PURE_EMPIRICAL_LINEAGE wet-lab posterior shift."""
w_deltas = _load_active_wetlab_posterior_deltas()
w_shift = _finite_real(w_deltas.get(f"{gate_key}::{entry_key}", 0.0), "Wet-lab gate shift")
g_dict = COMPLETE_GATE_COEFFICIENT_REGISTRY.get(gate_key, {})
if isinstance(g_dict, dict):
e_dict = g_dict.get(entry_key, {})
if isinstance(e_dict, dict) and "logit_value" in e_dict:
return (_finite_real(e_dict["logit_value"], f"Gate coefficient {gate_key}.{entry_key}") - default_val) + w_shift
return w_shift
ALLO_CLOAK_MODULES = {
"ALLO_B2M_HLAE_CD47_SWAP_CIITA_KO": {
"label": "B2M-ISRE::[EEF1A1-core+intron]-HLA-E*01:03(VMAPRTLVL)-GSG-P2A-CD47-IgV-GPI-WPREmut6 (or 2A-Free Bidirectional Arm 1B) + CIITA-/-",
"cuts": 2,
"base_edits": 0,
"genes": ["B2M", "CIITA", "HLA-E", "CD47"],
"description": "2 chromosomal cuts (B2M exon 1 knock-in via single-AAV6 [Arm 1B 2A-free bidirectional: 3,974 bp donor / 4,264 bp with ITRs <= 4,700 bp limit] or non-viral linear dsDNA/ceDNA HDR [Arm 1A bicistronic: 4,880 bp donor / 5,170 bp with ITRs; Shy et al. 2023 PMID:36008610 supports a different nonviral editing context; exact ceDNA/Arm 1A delivery in hPSCs remains unvalidated; note that bacterial IS110 Bridge-RNA recombinases in Durrant et al. 2024 PMID:38926615 and Pelea et al. 2026 PMID:41642947 are exploratory and not validated in human iPSCs] + CIITA biallelic KO). Eliminates classical HLA-A/B/C and HLA-II direct presentation while co-expressing single-chain HLA-E*01:03 (HLA-A2 VMAPRTLVL leader; ~12% overlap with clinical HCMV UL40 isolates per Lin et al. 2023 PMID:37264229, vs optional cytoplasmic KW-motif retention-signal removal per He et al. 2025 PMC12582296) and CD47-IgV-GPI placed at the 3' cistron so the 37-aa DAF GPI signal resides at the true extreme C-terminus without a 2A peptide scar (note membrane topology per Audit R01: because HLA-E*01:03's C-terminal cytoplasmic tail resides in the cytosol whereas Furin's catalytic domain is lumenal inside the trans-Golgi network, Furin is omitted and HLA-E*01:03 retains the 21-aa cytosolic -GSG-P2A peptide tail in Arm 1A, compared head-to-head in Stage-0 Decision Experiment #1 against scarless 2A-free bidirectional Arm 1B [SV40pA-CD47-IgV-GPI(antisense) <- EEF1A1-core | Syn_5xISRE_minP -> HLA-E*01:03(VMAPRTLVL)-bGHpA]; PMID:38508139, PMID:37156915, PMID:37820008). Subject to Hour-0 resting B2M-promoter surface density verification (Graveyard 009; Han et al. 2019 PMID:31040209).",
},
"ALLO_HLA_C_RETAINED_SUPERDONOR_PLUS_TYK2_KO": {
"label": "HLA-A-/- + HLA-B-/- + CIITA-/- (Retaining 1 matched HLA-C allele) + TYK2-/-",
"cuts": 4,
"base_edits": 0,
"genes": ["HLA-A", "HLA-B", "CIITA", "HLA-C", "TYK2"],
"description": "4 chromosomal cuts (HLA-A KO + HLA-B KO + CIITA KO + TYK2 KO). Retains 1 recipient-matched HLA-C allele (Xu et al. 2019 PMID:30853558) for KIR2DL C1/C2 NK self-recognition and viral surveillance while blocking IFN-alpha-induced MHC-I hyper-expression via TYK2-/- (PMID:36289205); note that whereas the -21M/-21T leader dimorphism is primarily an HLA-B polymorphism and HLA-C typically encodes -21M (Ramsuran et al. 2018 PMID:29302013), deleting HLA-A and HLA-B removes the dominant HLA-A/-21M HLA-B leader supply so endogenous HLA-E stabilization must be verified empirically (Lin et al. 2023 PMID:37264229), and co-targeting linked HLA-A (~chr6:29.94 Mb) and HLA-B (~chr6:31.35 Mb) in cis carries a ~1.41 Mb interstitial deletion/LOH hazard across the intervening HLA-C locus (~31.27 Mb) unless executed sequentially or verified by long-read/ddPCR copy-number gating.",
},
"ALLO_B2M_CIITA_KO_CD47_LENTI": {
"label": "B2M-/- + CIITA-/- + Constitutive Lentiviral CD47 OE (Sana UP421 / HIP benchmark)",
"cuts": 3,
"base_edits": 0,
"genes": ["B2M", "CIITA", "CD47"],
"description": "2 CRISPR nuclease DSB knockouts (B2M-/-, CIITA-/-) + 1 semi-random lentiviral CD47 integration (counted as K_total_genomic_modifications = 3 in the uniform locus budget, with K_crispr_dsb = 2 and K_lentiviral_integration = 1; Finding 025). Validated in NHP and n=1 human forearm intramuscular sentinel implant (PMID:37156915, PMID:40757665; 14-month follow-up correspondence in Carlsson et al. 2026 PMID:42430558, which carries zero quantitative weight in target_profiles because PubMed indexes NEJM correspondence without an abstract).",
},
"ALLO_B2M_KO_PDL1_A20_KI": {
"label": "B2M-/- + PD-L1 KI + TNFAIP3 (A20) KI (CRISPR/ViaCyte VCTX210 benchmark, CIITA WT)",
"cuts": 3,
"base_edits": 0,
"genes": ["B2M", "CD274", "TNFAIP3"],
"description": "3 genomic edits (B2M KO + PD-L1 KI + TNFAIP3/A20 KI) without CIITA KO or CD47/HLA-E NK shield (VCTX210 clinical trial NCT05210530).",
},
"ALLO_NONE_UNEDITED_OR_SYSTEMIC_IMMUNOSUPPRESSION": {
"label": "Unedited Wild-Type Allogeneic HLA (Vertex VX-264 macrodevice or zimislecel / VX-880 with chronic systemic immunosuppression)",
"cuts": 0,
"base_edits": 0,
"genes": [],
"description": "0 genetic edits (K=0). Inside the immunosuppression-free evaluator, this module scores strictly the unedited macro-encapsulated device proxy (Vertex VX-264, NCT05791201: clinical advancement stopped March 2025 after missing its Day-90 stimulated C-peptide endpoint; active registry follow-up with no posted results and no single established mechanism — BPR-12). By contrast, naked intraportal zimislecel (VX-880, NCT04786262, PMID:40544428: 10/12 insulin-independent at Day 365 under chronic systemic calcineurin/mTOR/anti-thymocyte IS) is an unscored comparator outside the IS-free target product profile, and NCT06832410 is a separate recruiting kidney-transplant-recipient registration (n=10 est., no posted results) rather than an efficacy readout (Finding 025 / BPR-12).",
},
}
AUTOANTIGEN_MODULES = {
"AUTO_NONE": {
"label": "No Intracellular Autoantigen Edits (Lean Default for Classical-MHC-Null Chassis A)",
"cuts": 0,
"base_edits": 0,
"genes": [],
"description": "Zero autoantigen edits. Eliminates direct classical HLA-A/B/C CD8+ autoantigen presentation when paired with B2M-/-, avoiding G6PC2-/- fasting glucose set-point downshift and SLC30A8-/- dense-core defects; residual indirect APC presentation is modeled explicitly.",
},
"AUTO_DUAL_INS_LEADER_AND_DRIP_EDIT": {
"label": "Base-Edit of INS Signal Peptide (PPI) + Silent INS-DRiP AUG Removal",
"cuts": 0,
"base_edits": 1,
"genes": ["INS"],
"description": "1 multiplex base-edit locus (B=1) at INS removing out-of-frame INS-DRiP initiation and/or replacing PPI signal peptide (PMID:28263308, PMID:42690930).",
},
"AUTO_FULL_KO_G6PC2_SLC30A8_PLUS_BASE_INS_GAD2_IAPP_CXADR": {
"label": "Gross Pan-Autoantigen/GWAS KO (G6PC2-/- + SLC30A8-/- + PTPN2-/-, 3 cuts) + 4-Locus Base/Prime Edits (INS, GAD2, IAPP, CXADR)",
"cuts": 3,
"base_edits": 4,
"genes": ["G6PC2", "SLC30A8", "INS", "GAD2", "IAPP", "CXADR", "PTPN2"],
"description": "High-burden 7-target autoantigen/GWAS modification: K=3 chromosomal DSB knockouts (G6PC2-/-, SLC30A8-/-, and high-pLI negative-feedback brake PTPN2-/- [gnomAD v4 pLI = 0.990]) + B=4 nickase base/prime-edit loci (INS, high-pLI paracrine GABA enzyme GAD2 [gnomAD v4 pLI = 1.000], IAPP, CXADR). Incurs G6PC2-/- fasting glucose set-point downshift hazard (PMID:32569842, PMID:34954144), Graveyard 007 high-pLI KO/coding-disruption block on PTPN2-/- and multiplex GAD2 disruption (PMID:19336676, PMID:32432213), and multiplex nickase DSB/translocation penalty (PMID:39529170).",
},
}
CYTOKINE_GRANZYME_MODULES = {
"CYTO_CXCL10_SWAP_PDL1_SERPINB9": {
"label": "CXCL10::SERPINB9-GSG-tPT2A-PD-L1 (or CXCL10::PD-L1-P2A-SERPINB9 Endogenous CXCL10 KO + Inflammation-Inducible Swap-In)",
"cuts": 1,
"base_edits": 0,
"genes": ["CXCL10", "CD274", "SERPINB9"],
"description": "1 chromosomal cut at CXCL10 exon 1: deletes graft CXCL10 chemokine and expresses Granzyme-B inhibitor SERPINB9 + PD-L1 under native IFN/NF-kB inflammation control (comparing inverted SERPINB9-GSG-tPT2A-PD-L1 against PD-L1-GSG-tPT2A-SERPINB9 in Decision Experiment #3; Yoshihara et al. 2020 PMID:32814902; Sintov et al. 2022 PMID:36055241; Parent et al. 2021 PMID:34407395; Liu et al. 2017 PMID:28526819).",
},
"CYTO_CONSTITUTIVE_IL10_VIRAL_OE": {
"label": "Constitutive Viral IL-10 Overexpression (1 locus — Graveyard 008 Mast-Cell/Granulocyte Trap)",
"cuts": 1,
"base_edits": 0,
"genes": ["IL10"],
"description": "1 viral/transgenic locus constitutively secreting IL-10. Fails to provide durable alloprotection while risking local mast-cell/granulocyte expansion (mechanistic mast-cell expansion context: Polukort et al. 2016 PMID:27183617).",
},
"CYTO_STAT1_OR_TYK2_CLONAL_KO_WITH_GAS_IND_PDL1": {
"label": "Clonal STAT1-/- + GAS/ISRE-Inducible PD-L1 (Epistatic Trap — Graveyard 001)",
"cuts": 1,
"base_edits": 0,
"genes": ["STAT1", "CD274"],
"description": "1 cut (STAT1 KO) paired with a STAT1-dependent GAS/ISRE promoter (silences inducible PD-L1; Sintov et al. 2022 PMID:36055241).",
},
"CYTO_NONE": {
"label": "No Intrinsic Cytokine or Granzyme Shield",
"cuts": 0,
"base_edits": 0,
"genes": [],