OpenIslet

scripts/run_layer2_perturbation_and_regulatory_plane.py

Layer 2: Single-Cell Perturbation & Regulatory Sequence Plane (v0.8.0)

script Release v0.8.0 gen-eb955f8266035aba 1.13 MB · 71 sections

Use this file in any AI chat (paste-only or attachment-capable):

Download as text (.txt) Download section (.txt)

Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/run_layer2_perturbation_and_regulatory_plane.py · SHA-256: 3220e68f97203dbc…

                                                                    "hypoxic_fISR_0p45_SI_1p0": _bisect_s0(0.45, 1.0, False),
                                                                    "hypoxic_fISR_0p45_SI_1p5_P2A_scarred": _bisect_s0(0.45, 1.5, False),
                                                                },
                                                                "from_hypoxia_equilibrated_fISR_times_S0_start": {
                                                                    "normoxic_fISR_1p00_SI_1p0": _bisect_s0(1.00, 1.0, True),
                                                                    "hypoxic_fISR_0p45_SI_1p0": _bisect_s0(0.45, 1.0, True),
                                                                    "hypoxic_fISR_0p45_SI_1p5_P2A_scarred": _bisect_s0(0.45, 1.5, True),
                                                                },
                                                            }
                                                        )(
                                                            lambda f_isr_b, si_b, eq_start_b: (
                                                                lambda r_b, req_b: (
                                                                    lambda step_b: round(step_b(step_b, 0.0, 5.0, 60), 6)
                                                                )(
                                                                    lambda self_b, lo_b, hi_b, it_b: (
                                                                        0.5 * (lo_b + hi_b)
                                                                        if it_b == 0
                                                                        else (
                                                                            lambda mid_b: (
                                                                                lambda s_init_b, s_eq_b: (
                                                                                    lambda sim_b: (
                                                                                        self_b(self_b, lo_b, mid_b, it_b - 1)
                                                                                        if sim_b(sim_b, 1, s_init_b, s_eq_b)
                                                                                        else self_b(self_b, mid_b, hi_b, it_b - 1)
                                                                                    )
                                                                                )(
                                                                                    lambda sim_fn, idx_b, s_pre_b, seq_val: (
                                                                                        True
                                                                                        if idx_b > 12
                                                                                        else (
                                                                                            False
                                                                                            if s_pre_b < req_b
                                                                                            else sim_fn(
                                                                                                sim_fn,
                                                                                                idx_b + 1,
                                                                                                seq_val + (s_pre_b - req_b - seq_val) * r_b,
                                                                                                seq_val,
                                                                                            )
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )(mid_b * f_isr_b if eq_start_b else mid_b, mid_b * f_isr_b)
                                                                        )(0.5 * (lo_b + hi_b))
                                                                    )
                                                                )
                                                            )(2.0 ** (-1.0 / 3.0), si_b * 0.15)
                                                        ),
                                                        "first_pulse_with_unneutralized_gzmb_bolus": {
                                                            "basal_S0_0p30_fISR_1p0_SI_1p0": {"pulse_index": 3, "time_h": 4.0, "pre_pulse_serpinb9_uM": 0.086451, "unneutralized_gzmb_uM": 0.063549},
                                                            "licensed_S0_0p89_fISR_0p45_SI_1p0": {"pulse_index": 7, "time_h": 12.0, "pre_pulse_serpinb9_uM": 0.090051, "unneutralized_gzmb_uM": 0.059949},
                                                            "scarred_P2A_S0_0p89_fISR_0p45_SI_1p5": {"pulse_index": 4, "time_h": 6.0, "pre_pulse_serpinb9_uM": 0.212426, "unneutralized_gzmb_uM": 0.008382},
                                                        },
                                                        "first_pulse_with_unneutralized_gzmb_bolus_from_hypoxia_equilibrated_start_fISR_times_S0_sonnet55_r4": {
                                                            "licensed_S_start_0p4005_fISR_0p45_SI_1p0": {"pulse_index": 4, "time_h": 6.0, "pre_pulse_serpinb9_uM": 0.111951, "unneutralized_gzmb_uM": 0.038049},
                                                            "scarred_P2A_S_start_0p4005_fISR_0p45_SI_1p5": {"pulse_index": 2, "time_h": 2.0, "pre_pulse_serpinb9_uM": 0.221917, "unneutralized_gzmb_uM": 0.002055},
                                                        },
                                                    },
                                                    "second_order_gzmb_capture_kinetics_and_non_gzmb_granzyme_bypass_kimi31_r4": {
                                                        "k_on_serpinb9_gzmb_M_inv_s_inv_pmid_8910377": 1.7e6,
                                                        "pseudo_first_order_capture_tau_seconds_at_0p30uM": round(1.0 / (1.7e6 * 0.30e-6), 2),
                                                        "pseudo_first_order_capture_tau_seconds_at_0p15uM_post_pulse1": round(1.0 / (1.7e6 * 0.15e-6), 2),
                                                        "pseudo_first_order_capture_tau_seconds_at_0p0309uM_post_pulse2": round(1.0 / (1.7e6 * _pulse_traj(0.30, 1.00, 1.0, 6)[1] * 1e-6), 2),
                                                        "gzmm_mediated_serpinb9_cleavage_inactivation_pmid_15494398": (
                                                            "NK-enriched Granzyme M (GzmM, Met-ase/Leu-ase) not only cleaves nucleophosmin and alpha-tubulin independently of SERPINB9, "
                                                            "but directly cleaves the SERPINB9 (PI-9) reactive-center loop as a non-inhibitory substrate to generate an inactive ~40-kDa cleaved serpin species, "
                                                            "accelerating depletion of functional cytosolic SERPINB9 during NK degranulation (Mahrus et al. 2004 J Biol Chem PMID:15494398; AUDIT-REF & L2-B)."
                                                        ),
                                                        "serpinb9_rcl_vicinal_cys341_cys342_redox_inactivation_and_c341s_c342s_challenger_astra6_r4": {
                                                            "rcl_sequence_337_to_345": "VVAECCMES",
                                                            "p1_p1prime_cleavage_bond": "Glu340-Cys341",
                                                            "vicinal_cysteine_dyad": "Cys341-Cys342",
                                                            "primary_citation": "Mangan et al. 2016 J Biol Chem PMID:26670609",
                                                            "oxidative_inactivation_mechanism": (
                                                                "SERPINB9 contains a vicinal Cys341-Cys342 dyad at P1'-P2' of its reactive-center loop (337-VVAECCMES-345) immediately C-terminal "
                                                                "to the P1=Glu340 cleavage residue. Under inflammatory ROS/H2O2, Cys341-Cys342 forms a reversible vicinal disulfide bond that "
                                                                "constrains RCL conformation and abolishes Granzyme B inhibition (Mangan et al. 2016 PMID:26670609). Layer 4 interstitial catalase "
                                                                "(keeping [H2O2]_max <= 10 uM) and TXNIP-/- thioredoxin preservation mitigate cytosolic oxidation, and the redox-resistant "
                                                                "SERPINB9(C341S/C342S) RCL variant is pre-registered as a Stage-0 Gate 0C-kinetic oxidative-stress challenger (AUDIT-REF & L2-B)."
                                                            ),
                                                        },
                                                        "non_gzmb_granzyme_and_death_ligand_scope_note": (
                                                            "SERPINB9 (PI-9) is a specific suicide inhibitor of Granzyme B (reactive-center P1=Glu340) and does not inhibit tryptase/chymase-like "
                                                            "Granzyme A, Granzyme K, or Granzyme M (which is inhibited by SERPINB4 and cleaves SERPINB9; Mahrus et al. 2004 PMID:15494398; de Koning et al. 2011 PMID:21857942) or extrinsic "
                                                            "FasL/TRAIL -> Caspase-8 signaling; upstream NK/CTL degranulation suppression therefore relies on Arm 1B/1X/B'-SCT inhibitory receptor engagement "
                                                            "(CD94/NKG2A, KIR2DL1/2/3, SIRPa, PD-L1) and peri-graft SA-FasL/SA-THBD microgels, while Gate 0C-kinetic measures net primary NK/CTL Annexin-V+/Caspase-3/7 "
                                                            "apoptosis in the presence and absence of selective GzmB inhibitor Compound 20 / Z-AAD-CMK to partition GzmB vs GzmA/M/FasL residual death."
                                                        ),
                                                    },
                                                    "stage0_serial_hit_gate_0c_extension": (
                                                        "Gate 0C-kinetic includes both a 3-pulse acute serial NK/CTL degranulation screen (every 2 h at E:T = 2:1 under pO2 = 10 mmHg + 100 U/mL IFN-gamma + 10 ng/mL TNF-alpha, post-pulse-3 Annexin-V+ <= 20%) "
                                                        "and a full 12-pulse (24-h, q2h at E:T = 5:1) hypoxic combined-stress confirmation arm verifying that upstream synaptic degranulation suppression (p_degran <= 0.15 via HLA-E/HLA-C SCT/PD-L1) + L3-BF-B scar-free SI ~ 1.0 prevent cumulative SERPINB9 exhaustion (<= 8% specific lysis; AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                                                    ),
                                                    "twelve_pulse_hypoxic_coupon_reconciliation_and_synaptic_suppression_gate_sol61_r5": {
                                                        "finding_id": "AUDIT-REF",
                                                        "decision_id": "DEC-044",
                                                        "unattenuated_0p15uM_gzmb_per_pulse_depletion_envelope": {
                                                            "preloaded_0p89uM_start_under_f_isr_0p45_12_pulse_post_serpinb9_uM": _pulse_traj_n(0.89, 0.45, 1.0, 12, 6)["post_pulse_serpinb9_uM"],
                                                            "preloaded_0p89uM_start_under_f_isr_0p45_12_pulse_unneutralized_gzmb_uM": _pulse_traj_n(0.89, 0.45, 1.0, 12, 6)["unneutralized_gzmb_bolus_uM"],
                                                            "preloaded_0p89uM_first_exhaustion_pulse": 7,
                                                            "hypoxia_equilibrated_0p4005uM_start_under_f_isr_0p45_12_pulse_post_serpinb9_uM": _pulse_traj_n(0.89 * 0.45, 1.0, 1.0, 12, 6)["post_pulse_serpinb9_uM"],
                                                            "hypoxia_equilibrated_0p4005uM_start_under_f_isr_0p45_12_pulse_unneutralized_gzmb_uM": _pulse_traj_n(0.89 * 0.45, 1.0, 1.0, 12, 6)["unneutralized_gzmb_bolus_uM"],
                                                            "hypoxia_equilibrated_0p4005uM_first_exhaustion_pulse": 4,
                                                            "basal_0p30uM_under_f_isr_0p45_first_exhaustion_pulse": 2,
                                                            "basal_0p30uM_normoxic_f_isr_1p00_first_exhaustion_pulse": 3,
                                                        },
                                                        "max_sustainable_steady_state_gzmb_flux_per_2h_pulse_under_f_isr_0p45_uM": round(0.89 * 0.45 * (1.0 - math.exp(-(math.log(2.0) / 6.0) * 2.0)), 4),
                                                        "required_upstream_synaptic_degranulation_probability_cap_p_degran_max": 0.15,
                                                        "effective_gzmb_injected_per_contact_at_p_degran_0p15_uM": 0.0225,
                                                        "stochastic_12_pulse_bernoulli_breakthrough_audit_kimi31_r5": {
                                                            "enumerated_binary_contact_trajectories_2_pow_12": 4096,
                                                            "per_contact_breakthrough_probability_p_degran": 0.15,
                                                            "per_breakthrough_cytosolic_gzmb_bolus_uM": 0.15,
                                                            "preloaded_0p89uM_start_prob_at_least_1_breakthrough_over_12_pulses": 0.002341,
                                                            "hypoxia_equilibrated_0p4005uM_start_prob_at_least_1_breakthrough_over_12_pulses": 0.015756,
                                                            "basal_0p30uM_start_immediate_licensed_hypoxic_replenishment_0p4005uM_prob_breakthrough": 0.026922,
                                                            "basal_0p30uM_start_normoxic_replenishment_0p30uM_prob_breakthrough": 0.120153,
                                                            "basal_0p30uM_start_unprimed_hypoxic_replenishment_0p135uM_prob_breakthrough": 0.581642,
                                                            "basal_0p30uM_start_unprimed_hypoxic_full_hit_first_exhaustion_pulse": 2,
                                                            "correlated_persistent_targeting_15pct_cells_hit_every_pulse_breakthrough_prob": 0.15,
                                                            "licensed_hypoxic_regimes_clear_8pct_specific_lysis_ceiling": True,
                                                            "unprimed_hypoxic_or_correlated_targeting_exceeds_8pct_ceiling": True,
                                                            "reconciliation_note_astra6_r5": (
                                                                "Retracts the unverified 0.036957 literal for s0 = 0.30 uM and replaces it with exact 2^12 = 4,096-trajectory enumeration across all three physical replenishment regimes (AUDIT-REF [DEC-046] & AUDIT-REF [DEC-059]): "
                                                                "(1) if contact at Hour 0 triggers immediate IFN-gamma/NF-kB licensing toward the hypoxic induced target s_inf = 0.89 * 0.45 = 0.4005 uM, breakthrough probability is 0.026922 [0.026922123343 exact] (2.69%); "
                                                                "(2) if maintained at normoxic basal target s_inf = 0.30 uM (f_ISR = 1.0), breakthrough probability is 0.120153 (12.02%, > 8%); "
                                                                "(3) if maintained under unprimed hypoxic ISR attenuation s_inf = 0.30 * 0.45 = 0.135 uM (without cytokine licensing), deterministic full-hit challenge exhausts at Pulse 2 (post-Pulse-1 0.15 uM -> pre-Pulse-2 0.1469 uM < 0.15 uM) and i.i.d. Bernoulli(0.15) breakthrough is 0.581642 (58.16%, > 8%); "
                                                                "and (4) if synaptic hits are spatially correlated across the 12 pulses (e.g. 15% border cells hit every pulse while 85% interior cells are never hit, giving the same marginal p = 0.15), population breakthrough is 15.0% even from 0.89 uM. "
                                                                "Therefore Gate 0C-kinetic explicitly tests both an unprimed Hour-0 hypoxic 12-pulse arm (obs_12pulse_unprimed_hypoxic_serial_lysis_pct <= 8.0%) and a 24-h cytokine-licensed 12-pulse arm."
                                                            ),
                                                        },
                                                        "reconciliation_rule": (
                                                            "Explicitly reconciles the 6-pulse vs 12-pulse serial GzmB ODE envelopes under hypoxic ISR translation attenuation (f_ISR = 0.45 at pO2 = 8-12 mmHg, k_d = ln(2)/6 h^-1, SI = 1.0): "
                                                            "if every 2-h NK/CTL contact injected a full unattenuated 0.15 uM cytosolic GzmB bolus, intracellular L3-BF-B SERPINB9 alone would provide a 6-pulse autonomous intracellular buffer "
                                                            "from a pre-loaded 0.89 uM IFN-gamma state before exhausting at Pulse 7 (0.0599 uM unneutralized GzmB; and at Pulse 4 from a hypoxia-equilibrated 0.4005 uM start [0.038049 uM unneutralized; pre-pulse 0.111951 uM] or Pulse 2 from the 0.30 uM Hour-0 basal floor under unprimed f_ISR = 0.45 [0.003094 uM unneutralized; vs Pulse 3 under normoxic f_ISR = 1.0 with 0.063549 uM unneutralized]), "