scripts/run_layer2_perturbation_and_regulatory_plane.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/run_layer2_perturbation_and_regulatory_plane.py · SHA-256: 3220e68f97203dbc…
"iec_branch_mean": 0.97, "iec_branch_sd": 0.08,
"cd47_mult": eef1a_arm1b_cd47_mult,
"hlae_mult": arm1b_hlae_mult,
"hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 3.9, "kir_lysis_mean": 6.5, "allo_ctl_mean": 2.9, "auto_ctl_mean": 4.2,
"empirical_literature_anchors": [
{
"pmid": "PMID:38508139",
"journal": "Cell Reports Medicine (Xu et al. 2024)",
"endpoint": "Truncated CD47-IgV preserves endothelial angiogenesis and blocks SIRPa+ macrophage phagocytosis without full-length CD47-TSP1 angiogenesis inhibition",
},
{
"pmid": "PMID:36055241",
"journal": "Stem Cell Reports (Sintov et al. 2022)",
"endpoint": "CXCL10 knockout in human SC-islets prevents CXCR3+ immune recruitment",
},
],
},
{
"genotype_id": "SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR",
"genotype_aliases": ["SCENARIO_A_ARM_1A_TPT2A_COMPARATOR"],
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, -1, -1],
"construct_arm": "LOCUS1_ARM1A_TPT2A_BICISTRONIC",
"is_hpsc_differentiated": True,
"description": "B2M::HLA-E*01:03(VMAPRTLVL)-GSG-P2A-CD47-IgV-GPI (constitutive EEF1A1 bicistronic 2A comparator to Arm 1B; eta_skip = 0.88)",
"stage4_mean": round(0.812 + 0.010 * ring1_evidence_weight, 3), "stage4_sd": 0.038,
"stage6_mean": round(0.655 + 0.008 * ring1_evidence_weight, 3), "stage6_sd": 0.045,
"beta_yield_mean": round(0.550 + 0.030 * ring1_evidence_weight, 4), "beta_yield_sd": 0.045,
"gsis_mean": round(3.05 + 0.20 * ring1_evidence_weight, 3), "gsis_sd": 0.36,
"iec_branch_mean": 0.95, "iec_branch_sd": 0.09,
"cd47_mult": eef1a_arm1a_cd47_mult,
"hlae_mult": arm1a_hlae_mult,
"hlae_resting_unstim_mult": arm1a_hlae_mult,
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 4.3, "kir_lysis_mean": 7.4, "allo_ctl_mean": 3.1, "auto_ctl_mean": 4.5,
"empirical_literature_anchors": [
{
"pmid": "PMID:28526819",
"journal": "Scientific Reports (Liu et al. 2017)",
"endpoint": "Position- and construct-dependent 2A expression in reporter/cardiac reprogramming systems; eta_skip=0.88 is an assigned OpenIslet sensitivity prior, not a measured skipping efficiency for these hPSC cassettes. Exact uncleaved read-through is unmeasured.",
}
],
},
{
"genotype_id": "HIP_CORE_FULL_LENGTH_CD47_WT_COMPARATOR",
"hip_core_factor_vector_X1_to_X6": [1, -1, 1, -1, -1, -1],
"is_hpsc_differentiated": True,
"description": "Same as Scenario A but expressing full-length 5-TM CD47-WT (323 aa, X2 = -1) instead of CD47-IgV-GPI",
"stage4_mean": 0.810, "stage4_sd": 0.040,
"stage6_mean": 0.640, "stage6_sd": 0.048,
"beta_yield_mean": 0.550, "beta_yield_sd": 0.050,
"gsis_mean": round(2.55 - 0.015 * cd47_pen_studies_n * ring1_evidence_weight, 3), "gsis_sd": 0.38,
"iec_branch_mean": 0.58, "iec_branch_sd": 0.10,
"cd47_mult": round(eef1a_arm1b_cd47_mult * 0.92, 4),
"hlae_mult": arm1a_hlae_mult,
"hlae_resting_unstim_mult": arm1a_hlae_mult,
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 4.1, "kir_lysis_mean": 6.8, "allo_ctl_mean": 3.1, "auto_ctl_mean": 4.4,
"empirical_literature_anchors": [
{
"pmid": "PMID:38508139",
"journal": "Cell Reports Medicine (Xu et al. 2024)",
"endpoint": "Full-length CD47 overexpression impairs endothelial tube formation/angiogenesis via TSP1-CD47 signaling, rescued by CD47-IgV",
},
{
"pmid": "PMID:37820008",
"journal": "Science Translational Medicine (Ghimire et al. 2023)",
"endpoint": "Full-length CD47 5-TM signaling tonically limits beta-cell cAMP/calcium insulin exocytosis and GSIS (Graveyard Rule R02 counter-evidence)",
},
],
},
{
"genotype_id": "HIP_CORE_X4_TYK2_KO_PERTURBATION",
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, 1, -1, -1],
"is_hpsc_differentiated": True,
"description": "Scenario A + constitutive TYK2-/- knockout (X4 = +1; applies Chandra et al. 2022 PMID:36289205 relative reductions [Fig 2c S5 NEUROG3+ 28.81% -> 15.45%, -46.37%; Fig 2k S7 INS+ immunostaining 23.73% -> 16.01%, -32.54%; Fig 2i S7 INS+ flow 29.78% -> 21.90%, -26.46%] to the assigned OpenIslet WT baseline: Stage 4 PP2 0.816 vs 0.840 WT, Stage 5/6 NEUROG3+ EP 0.364 vs 0.678 WT [-46.31%], Stage 7 INS+ SC-beta yield 0.408 vs 0.600 WT [-32.00%])",
"stage4_mean": 0.816, "stage4_sd": 0.038,
"stage6_mean": tyk2_ko_s6_mean, "stage6_sd": 0.055,
"beta_yield_mean": tyk2_ko_s7_mean, "beta_yield_sd": 0.055,
"gsis_mean": 3.25, "gsis_sd": 0.38,
"iec_branch_mean": 0.96, "iec_branch_sd": 0.08,
"cd47_mult": eef1a_arm1b_cd47_mult,
"hlae_mult": round(4.5 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"hlae_resting_unstim_mult": round(0.75 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 4.2, "kir_lysis_mean": 6.7, "allo_ctl_mean": 2.5, "auto_ctl_mean": 3.6,
"empirical_literature_anchors": [
{
"pmid": "PMID:36289205",
"journal": "Nature Communications (Chandra et al. 2022, PMC9606380, reference GEO accession GSE190726)",
"endpoint": "Chandra et al. 2022 Source Data relative TYK2-/- reductions (Fig 2c S5 NEUROG3+ immunostaining 28.81% WT vs 15.45% KO [-46.37%]; Fig 2k S7 INS+ immunostaining 23.73% WT vs 16.01% KO [-32.54%]; Fig 2i S7 INS+ flow 29.78% WT vs 21.90% KO [-26.46%]) rescaled onto assigned OpenIslet WT baselines (Stage 4 PP2 0.816 vs 0.840 WT; Stage 5/6 NEUROG3+ 0.364 vs 0.678 WT [-46.31%]; Stage 7 SC-beta 0.408 vs 0.600 WT [-32.00%]) via KRAS/MAPK derepression, while mature SC-islets retain GSIS",
}
],
},
{
"genotype_id": "HIP_CORE_X5_TXNIP_KO_MODIFIER",
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, 1, -1],
"is_hpsc_differentiated": True,
"description": "Scenario A + isolated TXNIP-/- (X5 = +1, X6 = -1; tests oxidative/thioredoxin stress protection without RNLS knockout)",
"stage4_mean": 0.822, "stage4_sd": 0.038,
"stage6_mean": 0.660, "stage6_sd": 0.045,
"beta_yield_mean": 0.575, "beta_yield_sd": 0.048,
"gsis_mean": 3.30, "gsis_sd": 0.35,
"iec_branch_mean": 0.96, "iec_branch_sd": 0.08,
"cd47_mult": eef1a_arm1b_cd47_mult,
"hlae_mult": arm1b_hlae_mult,
"hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 3.9, "kir_lysis_mean": 6.5, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.7,
"empirical_literature_anchors": [
{
"pmid": "PMID:40320524",
"journal": "Stem Cell Research & Therapy (Traini et al. 2025)",
"endpoint": "TXNIP loss in H1-hESCs increased proliferation; derived SC-islets retained differentiation and glucose responsiveness but showed no enhanced glycemic control or GSIS under the tested conditions. The numerical OpenIslet profile remains an unmeasured prior, not a reported full-stack benefit.",
}
],
},
{
"genotype_id": "HIP_CORE_X6_RNLS_KO_COUNTER_CONTROL",
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, -1, 1],
"is_hpsc_differentiated": True,
"description": "Scenario A + isolated RNLS-/- (X5 = -1, X6 = +1; Graveyard Rule R04 counter-control testing human SC-islet basal glycolysis/GSIS trade-off)",
"stage4_mean": 0.815, "stage4_sd": 0.040,
"stage6_mean": 0.642, "stage6_sd": 0.048,
"beta_yield_mean": 0.545, "beta_yield_sd": 0.052,
"gsis_mean": 2.95, "gsis_sd": 0.39,
"iec_branch_mean": 0.94, "iec_branch_sd": 0.09,
"cd47_mult": eef1a_arm1b_cd47_mult,
"hlae_mult": arm1b_hlae_mult,
"hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 4.0, "kir_lysis_mean": 6.6, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.2,
"empirical_literature_anchors": [
{
"pmid": "PMID:32719542",
"journal": "Nature Metabolism (Cai et al. 2020)",
"endpoint": "RNLS knockout protects beta cells against ER stress/autoimmune CTL killing in vivo but shifts basal metabolic tone in human SC-islets (Graveyard Rule R04)",
}
],
},
{
"genotype_id": "HIP_CORE_X5_TXNIP_KO_X6_RNLS_KO_METABOLIC_SHIELD",
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, 1, 1],
"is_hpsc_differentiated": True,
"description": "Scenario A + combined TXNIP-/- (X5 = +1) + RNLS-/- (X6 = +1) metabolic/ER-stress shield comparator",
"stage4_mean": 0.812, "stage4_sd": 0.040,
"stage6_mean": 0.635, "stage6_sd": 0.050,
"beta_yield_mean": 0.540, "beta_yield_sd": 0.055,
"gsis_mean": 3.18, "gsis_sd": 0.38,
"iec_branch_mean": 0.94, "iec_branch_sd": 0.09,
"cd47_mult": eef1a_arm1b_cd47_mult,
"hlae_mult": round(5.1 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 4.0, "kir_lysis_mean": 6.6, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.1,
"empirical_literature_anchors": [
{
"pmid": "PMID:32719542",
"journal": "Nature Metabolism (Cai et al. 2020)",
"endpoint": "RNLS single-target beta-cell protection study; the combined TXNIP/RNLS interaction is a planned HIP-Core comparison, not a measured combination in this reference",
}
],
},
{
"genotype_id": "SCENARIO_B_HLAC_RETAINED_TYK2_P1104A_SUPERDONOR",
"genotype_aliases": ["SCENARIO_B2_HLAC_RETAINED_TYK2_P1104A_5LOCUS"],
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, 0, -1, -1],
"is_hpsc_differentiated": True,
"description": "Scenario B2 (5-locus Plan B): HLA-A-/- HLA-B-/- HLA-C(retained KIR-matched) + CIITA-/- + TYK2(P1104A rs34536443 catalytic hypomorph, preserving Stage 5/6 scaffolding) + CXCL10::SERPINB9-P2A-PD-L1 + AAVS1-iCasp9",
"stage4_mean": 0.832, "stage4_sd": 0.036,
"stage6_mean": 0.652, "stage6_sd": 0.044,
"beta_yield_mean": 0.560, "beta_yield_sd": 0.050,
"gsis_mean": 3.28, "gsis_sd": 0.35,
"iec_branch_mean": 0.97, "iec_branch_sd": 0.08,
"cd47_mult": 1.8, "hlae_mult": round(3.8 * ring1_evidence_weight, 3), "hlae_resting_unstim_mult": round(3.8 * ring1_evidence_weight, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 3.5, "kir_lysis_mean": 2.8, "allo_ctl_mean": 6.2, "auto_ctl_mean": 8.4,
"empirical_literature_anchors": [
{
"pmid": "PMID:30853558",
"journal": "Cell Stem Cell (Xu et al. 2019)",
"endpoint": "HLA-A/B bi-allelic disruption with HLA-C retention engages inhibitory KIR2DL1/2/3+ NK cells across HLA-C-matched recipients",
}
],
},
{
"genotype_id": "SCENARIO_B1_HLAC_RETAINED_TYK2_KO_6LOCUS",
"genotype_aliases": ["SCENARIO_B_HLAC_RETAINED_TYK2_KO_INS_EDITED"],
"hip_core_factor_vector_X1_to_X6": [1, 1, 1, 1, -1, -1],
"is_hpsc_differentiated": True,
"description": "Scenario B1 (6-locus comparator): HLA-A-/- HLA-B-/- HLA-C(retained) + CIITA-/- + complete TYK2-/- knockout + INS-epitope edit + CXCL10::SERPINB9-P2A-PD-L1 + AAVS1-iCasp9 (incurs Chandra 2022 -46.3% Stage 6 EP and -32.0% Stage 7 yield penalty plus extra editing step)",
"stage4_mean": 0.816, "stage4_sd": 0.038,
"stage6_mean": tyk2_ko_s6_mean, "stage6_sd": 0.055,
"beta_yield_mean": tyk2_ko_s7_mean, "beta_yield_sd": 0.055,
"gsis_mean": 3.12, "gsis_sd": 0.40,
"iec_branch_mean": 0.95, "iec_branch_sd": 0.08,
"cd47_mult": 1.8, "hlae_mult": round(3.6 * ring1_evidence_weight, 3), "hlae_resting_unstim_mult": round(3.6 * ring1_evidence_weight, 3),
"cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
"nkg2a_lysis_mean": 3.6, "kir_lysis_mean": 2.9, "allo_ctl_mean": 5.8, "auto_ctl_mean": 4.9,
"empirical_literature_anchors": [
{
"pmid": "PMID:36289205",
"journal": "Nature Communications (Chandra et al. 2022, PMC9606380)",
"endpoint": "Complete TYK2-/- in Scenario B1 incurs -46.3% Stage 5/6 NEUROG3+ and -32.0% Stage 7 SC-beta yield reduction relative to WT, motivating Scenario B2 TYK2 P1104A hypomorph",
}
],
},
{
"genotype_id": "SANA_UP421_CADAVERIC_PRIMARY_ISLET_BENCHMARK",
"hip_core_factor_vector_X1_to_X6": [-1, -1, -1, -1, -1, -1],
"is_hpsc_differentiated": False,
"description": "Primary human cadaveric donor islets transduced with B2M-/- + CIITA-/- + LV-CAG-CD47(WT) (Carlsson et al. 2025 NEJM PMID:40757665; NOT an hPSC Stage 0->7 product)",
"stage4_mean": None, "stage4_sd": None,
"stage6_mean": None, "stage6_sd": None,
"beta_yield_mean": None, "beta_yield_sd": None,
"gsis_mean": 2.65, "gsis_sd": 0.42,
"iec_branch_mean": 0.62, "iec_branch_sd": 0.11,
"cd47_mult": 6.5, "hlae_mult": 0.0, "hlae_resting_unstim_mult": 0.0,
"cxcl10_ko": False, "locus3_ki": False,
"nkg2a_lysis_mean": 13.5, "kir_lysis_mean": 7.1, "allo_ctl_mean": 3.5, "auto_ctl_mean": 17.8,
"empirical_literature_anchors": [
{
"pmid": "PMID:40757665",
"journal": "New England Journal of Medicine (Carlsson et al. 2025)",
"endpoint": "First-in-human survival and C-peptide function of hypoimmune-edited primary cadaveric allogeneic islets without immunosuppression",
}
],
},
]
perturbation_profiles = []
for spec in genotype_specs:
is_hpsc = spec["is_hpsc_differentiated"]
cd47_mols = max(0, int(round(basal_cd47_wt * spec["cd47_mult"])))
hlae_mols = max(0, int(round(basal_hlae_wt * spec["hlae_mult"])))
hlae_resting_mols = max(0, int(round(basal_hlae_wt * spec["hlae_resting_unstim_mult"])))
hlae_hour0_gap_mols = max(0, hlae_mols - hlae_resting_mols)
resting_hlae_below_15k = bool(hlae_resting_mols < 15000)
if resting_hlae_below_15k and hlae_mols >= 15000:
hour0_protection_status = (
f"IFN_INDUCIBLE_HLAE_RESTING_BELOW_15K_THRESHOLD ({hlae_resting_mols} < 15,000 molecules/cell at Hour 0, rising to "
f"{hlae_mols} molecules/cell upon 24h IFN-gamma licensing); constitutive "
f"EEF1A1 -> CD47-IgV-GPI ({cd47_mols} molecules/cell) is an unvalidated independent shield hypothesis, not demonstrated compensation for this gap; requires direct resting unstimulated "
"vs IFN-gamma-licensed primary NK killing validation (Decision Experiment #2)"
)
elif not resting_hlae_below_15k:
hour0_protection_status = (
f"CONSTITUTIVE_HOUR0_HLAE_ABOVE_15K_THRESHOLD ({hlae_resting_mols} >= 15,000 molecules/cell at Hour 0; CD47 = {cd47_mols} molecules/cell)"
)