OpenIslet

scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py

OpenIslet Wave-6 W6-C1 (Provisional IIP-0055 / DEC-136 / GATE-34 / GY-033;

script Release v0.8.0 gen-eb955f8266035aba 417 KB · 30 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/verify_iip0055_hygiene_safecell_minifh_orthogonality.py · SHA-256: d5b98e2ba1310333…

                "hygiene": emcv_h,
            },
            "bGH_polyA_M57764_1_225bp": {
                "accession": reg["bGH_polyA_M57764_1_225bp"]["accession"],
                "hygiene": bgh_h,
            },
        },
        "authentic_essential_locus_homology_arms_grch38": ha_audit,
        "phase1a_repairs": {
            "repair_1_arm1b_l1_l2_dr": {
                "before_l1_b2m_l2_max_dr_bp": arm1b_old_h["max_disjoint_dr_bp"],
                "before_l1_b2m_l2_max_gc50_pct": arm1b_old_h["max_gc50_pct"],
                "after_synthetic_payload": arm1b_new_payload_h,
                "after_full_donor_bp": len(arm1b_new),
                "after_packaged_aav6_arithmetic_bp": len(arm1b_new) + AAV6_ITR_OVERHEAD_BP,
                "aav6_arithmetic_headroom_bp": AAV6_MAX_PACKAGED_BP - (len(arm1b_new) + AAV6_ITR_OVERHEAD_BP),
                "arm1a_retired_overflow_packaged_bp": 5170,
                "aa_identity_preserved_pct": 100.0,
            },
            "repair_2_ubc_pa_t20_all_9_constructs": {
                "segment_digests_dynamically_recomputed_count": len(t20_recomputed_rows),
                "segment_digests_verified_count": len(t20_recomputed_rows),
                "representative_post_patch_segments_in_fasta": 1,
                "full_9_post_patch_donors_status": "PENDING_FOLD_IN (only 1 representative 180-bp post-patch segment drop-in is deposited in the staged 26-record FASTA; all 9 shipped 180-bp T20 segments are dynamically recomputed & hygiene-verified before/after)",
                "before_max_homo_nt": ubc_old_h["max_homopolymer_nt"],
                "after_180bp_hygiene": ubc_new_h,
                "cstf64_gu_dse_20bp": "TTGTGTTTGTTGTTGTGTTG",
                "pas_aataaa_preserved": True,
                "constructs_verified": t20_recomputed_rows,
            },
            "repair_3_locus3_arm5_multimir_pdl1_syn6plus": {
                "before_legacy_donor_sha256_verified": rep["arm5_before_sha256"],
                "before_packaged_aav6_arithmetic_bp": arm5_before_pkg_bp,
                "before_disjoint_ir_ge20_count": arm5_mir_old_h["disjoint_ir_ge20_count"],
                "before_full_arm5_antisense_orf_aa": arm5_full_anti_before,
                "before_full_arm5_antisense_orf_dynamically_recomputed": True,
                "after_full_arm5_antisense_orf_aa": arm5_full_anti_after,
                "full_donor_passes_le_25aa_cap": False,
                "before_pdl1_cds_antisense_orf_aa": pdl1_anti_before,
                "after_pdl1_cds_antisense_orf_aa": pdl1_anti_after,
                "pdl1_cds_segment_passes_le_25aa_cap": True,
                "antisense_orf_scope_disclosure": "Full ARM5 donor antisense M-ORF dynamically recomputed from ARM5_L3_V2_INTRON_DUPLEX_IL1R1_FAS_WT_SB9_4398 drops 400 -> 134 aa (exceeds 25 aa); the <=25 aa reduction (286 -> 19 aa) applies strictly to the 873-bp PD-L1[SYN6+] CDS segment.",
                "after_synthetic_payload": arm5_payload_h,
                "after_full_donor_bp": len(arm5_new),
                "after_packaged_aav6_arithmetic_bp": len(arm5_new) + AAV6_ITR_OVERHEAD_BP,
                "aav6_arithmetic_headroom_bp": AAV6_MAX_PACKAGED_BP - (len(arm5_new) + AAV6_ITR_OVERHEAD_BP),
                "mature_3p_guides_intact": {"IL1R1": "ATCTTTGACTCCACTAAAGTGT", "FAS": "CAATTCCAATCCCTTGGAGTTG"},
            },
            "repair_4_design_y_gc_spikes_authentic_replacement": {
                "before_design_y_11tu": rep["design_y_before_summary"],
                "rt2_rng_filler_purged": True,
                "authentic_replacement_modules": ["cHS4_0C9_U78775_2 (unqualified pending FI VEZF1 barrier assay)", "EEF1A1_core_GRCh38_230bp", "CBX3_A2UCOE_GRCh38_700bp (unqualified pending archived barrier + aberrant-splicing assay)", "CXCL10_NFkB_ISRE_GRCh38_260bp"],
            },
        },
        "serpinb9_and_catalase_verification": {
            "serpinb9_uniprot": "P50453",
            "serpinb9_length_aa": len(sb9_wt),
            "serpinb9_exact_frame_in_arm5": arm5_sb9_ok,
            "serpinb9_p1_residue": "Glu340",
            "serpinb9_rcl_330_350": sb9_wt[329:350],
            "serpinb9_rcl_redox_sensitive_cys": [335, 341, 342, 350],
            "serpinb9_2a_scar_eliminated": True,
            "serpinb9_stage0_redox_qualification_required": "Gate G34-01-SB9-Redox: verify >=80% Granzyme B inhibition retained under 100 uM H2O2 / inflammatory ROS.",
            "catalase_uniprot": "P04040",
            "catalase_length_aa": len(cat_wt),
            "catalase_catalytic_triad": {"His75": cat_wt[74], "Asn148": cat_wt[147], "Tyr358": cat_wt[357]},
            "catalase_intracellular_cys_count": cat_wt.count("C"),
            "catalase_ecd_unpaired_cys": 0,
        },
        "fasta_26_record_provenance_manifest": provenance_manifest,
    }


# =============================================================================
# PART B — RT-2-PATCHED DUAL-SAFECELL (TBP/ACTB + CDK1::HSV-TK), ESCAPE & PK
# =============================================================================
def verify_part_b_dual_safecell_escape_and_pk() -> Dict[str, Any]:
    pro = EMBEDDED_AUTHENTIC_ASSETS["proteins"]
    reg = EMBEDDED_AUTHENTIC_ASSETS["authentic_genomic_and_regulatory"]
    rep = EMBEDDED_AUTHENTIC_ASSETS["repaired_constructs"]

    seq_casp9 = pro["CASP9_P55211"]
    seq_fkbp = pro["FKBP1A_P62942"]
    seq_casp8 = pro["CASP8_Q14790"]
    seq_dtymk = pro["DTYMK_P23919"]
    seq_hsvtk = pro["HSV1_TK_Q9QNF7"]

    require_cond(len(seq_casp9) == 416 and seq_casp9[236] == "H" and seq_casp9[284:289] == "QACGG", "CASP9 P55211 catalytic check failed")
    require_cond(seq_casp9[311:319] == "PEPDATPF", "CASP9 PEPD|ATPF check failed")
    require_cond(len(seq_fkbp) == 108 and seq_fkbp[36] == "F", "FKBP1A P62942 F37(mature F36) check failed")
    require_cond(len(seq_casp8) == 479 and seq_casp8[316] == "H" and seq_casp8[357:362] == "QACQG", "CASP8 Q14790 catalytic check failed")
    require_cond(len(seq_dtymk) == 212 and seq_dtymk[96:105] == "RYAFSGVAF", "DTYMK P23919 check failed")
    require_cond(len(seq_hsvtk) == 376, "HSV1-TK Q9QNF7 length check failed")

    fkbp_f36v = seq_fkbp[:36] + "V" + seq_fkbp[37:]
    icasp9_wt = fkbp_f36v + "SGGGS" + seq_casp9[134:]
    icasp9_d315a = fkbp_f36v + "SGGGS" + (seq_casp9[:314] + "A" + seq_casp9[315:])[134:]
    icasp8 = fkbp_f36v + "SGGGS" + seq_casp8[216:]

    require_cond(translate(rep["cds_icasp9_wt"], 0) == icasp9_wt + "*", "iCasp9(WT) CDS translation mismatch")
    require_cond(translate(rep["cds_icasp9_d315a"], 0) == icasp9_d315a + "*", "iCasp9(D315A) CDS translation mismatch")
    require_cond(translate(rep["cds_icasp8"], 0) == icasp8 + "*", "iCasp8 CDS translation mismatch")
    require_cond(translate(rep["cds_hsvtk"], 0) == seq_hsvtk + "*", "HSV-TK CDS translation mismatch")
    require_cond("GMLEDGKKV" in icasp8 and "GSSESQTL" in icasp8, "RT-2 iCasp8 neoepitope markers missing")
    require_cond(len(re.findall(r"DA[TVI]P[FWY]", seq_casp8[216:])) == 0, "Unexpected XIAP-BIR3 IBM in CASP8")

    # Essential-locus donor arithmetic AAV6 headroom audit (NOT a wet-lab packaging assay)
    emcv_len = len(reg["EMCV_IRES_M81861_1_567bp"]["seq"]) - 3
    bgh_len = len(reg["bGH_polyA_M57764_1_225bp"]["seq"])
    donors = {
        "TBP_chr6q27_3UTR_IRES_iCasp9_WT": {
            "locus": "TBP (chr6q27, moderate housekeeping, glycolysis-independent, replaces hyper-abundant GAPDH; native RHA contains T13)",
            "donor_bp": 700 + 3 + emcv_len + len(rep["cds_icasp9_wt"]) + bgh_len + 700,
            "mhc_routing": "Single-layer on A/B/X; Dual-FailSafe layer 1 on B2M-/- Y-v3 and Z-EnSC; head-to-head Stage-0 comparator vs iCasp9(D315A)",
        },
        "TBP_chr6q27_3UTR_IRES_iCasp9_D315A": {
            "locus": "TBP (chr6q27; native RHA contains T13)",
            "donor_bp": 700 + 3 + emcv_len + len(rep["cds_icasp9_d315a"]) + bgh_len + 700,
            "mhc_routing": "STRICTLY B2M-/- arms ONLY (PEPAATPF generates 6 MHC-I anchor hits); Stage-0 comparator gated on hypoxic dimerization parity (PMID:23572523 caution)",
        },
        "ACTB_chr7p22p1_3UTR_IRES_iCasp8": {
            "locus": "ACTB (chr7p22.1, Martin et al. 2020 PMID:32483127; native RHA contains T16)",
            "donor_bp": 700 + 3 + emcv_len + len(rep["cds_icasp8"]) + bgh_len + 700,
            "mhc_routing": "Single-layer switch on autologous D1b-Lean-K2 (NOT dual-switch!) and Design A comparator; on self-MHC arms requires GMLEDGKKV/GSSESQTL MS immunopeptidomics + cFLIP/GSDMD pyroptosis gate (WT FRB/FKBP12 backup)",
        },
        "CDK1_chr10q21p2_3UTR_IRES_HSV_TK": {
            "locus": "CDK1 (chr10q21.2, Liang et al. 2018 Nature PMID:30429614 — undifferentiated pluripotent cell precedent)",
            "donor_bp": 700 + 3 + emcv_len + len(rep["cds_hsvtk"]) + bgh_len + 700,
            "mhc_routing": "STRICTLY B2M-/- Dual-FailSafe arms Y-v3 and Z-EnSC ONLY (absent on A/B/X/D; viral HSV-TK invisible to CD8+ T cells on B2M-/-; 0x 2A scar via IRES)",
        },
    }
    for k, d in donors.items():
        d["packaged_aav6_arithmetic_bp"] = d["donor_bp"] + AAV6_ITR_OVERHEAD_BP
        d["aav6_arithmetic_headroom_bp"] = AAV6_MAX_PACKAGED_BP - d["packaged_aav6_arithmetic_bp"]
        require_cond(d["packaged_aav6_arithmetic_bp"] <= AAV6_MAX_PACKAGED_BP, f"AAV6 arithmetic overflow in {k}")

    # Exact dual-layer dependence mathematics (P0-1 / C1.2 remediation):
    # - NO release-level independence-assumed 1e-12 bound!
    # - NO false 'empirical 1e-16' claim!
    p1_marginal = 1.0e-6   # Stipulated conservative single-layer marginal ceiling (TBP::iCasp9, chr6q27)
    p2_marginal = 1.0e-6   # Stipulated conservative single-layer marginal ceiling (CDK1::HSV-TK, chr10q21.2)
    frechet_lo = max(0.0, p1_marginal + p2_marginal - 1.0)
    frechet_hi = min(p1_marginal, p2_marginal)  # Sharp mathematical upper bound = 1.0e-6
    indep_sensitivity = p1_marginal * p2_marginal  # 1.0e-12 strictly as independence sensitivity ONLY
    dose_cells = 1.0e9  # 10^9 transplanted cells (~500k IEQ upper bound)
    exp_escapes_indep = dose_cells * indep_sensitivity  # 0.001
    exp_escapes_frechet_hi = dose_cells * frechet_hi    # 1,000.0
    p_surv_ge1_indep = -math.expm1(-exp_escapes_indep)
    p_surv_ge1_frechet_hi = -math.expm1(-exp_escapes_frechet_hi)

    # Exact one-sided 95% Clopper-Pearson binomial upper bound (1 - 0.05**(1/n)) for Wunderlich et al. 2022 (PMID:35795779):
    # 0 biallelic escapees in 0.8e9 undifferentiated AAVS1-iCasp9 hiPSCs
    wunderlich_cells = 800_000_000
    wunderlich_u95_binomial = clopper_pearson_u95(0, wunderlich_cells, alpha=0.05)  # 3.744665335e-9 exact
    wunderlich_u95_poisson = -math.log(0.05) / wunderlich_cells                   # 3.744665342e-9 Poisson approx
    require_cond(abs(wunderlich_u95_binomial - 3.74466533493123e-9) < 1e-17, "Wunderlich exact Clopper-Pearson U95 error")
    require_cond(abs(wunderlich_u95_poisson - 3.744665341942489e-9) < 1e-15, "Wunderlich Poisson U95 error")
    cp_k4_n100k = clopper_pearson_u95(4, 100_000, alpha=0.05)
    cp_k5_n100k = clopper_pearson_u95(5, 100_000, alpha=0.05)
    cp_k10_n100k = clopper_pearson_u95(10, 100_000, alpha=0.05)
    cp_k99983552_n1e12 = clopper_pearson_u95(99_983_552, 10**12, alpha=0.05)
    cp_k99983553_n1e12 = clopper_pearson_u95(99_983_553, 10**12, alpha=0.05)
    cp_k100k_n1005m = clopper_pearson_u95(100_000, 1_005_216_927, alpha=0.05)
    oq012_k0_n299573228 = clopper_pearson_u95(0, GATE5_OQ012_MIN_EFFECTIVE_TRIALS, alpha=0.05)
    oq012_k0_n299573227 = clopper_pearson_u95(0, GATE5_OQ012_MIN_EFFECTIVE_TRIALS - 1, alpha=0.05)
    oq012_k0_n400m = clopper_pearson_u95(0, 400_000_000, alpha=0.05)
    acute_k0_n100k = clopper_pearson_u95(0, 100_000, alpha=0.05)
    require_cond(cp_k4_n100k <= 1.0e-4, "Clopper-Pearson k=4, n=100000 self-check failed")
    require_cond(abs(cp_k5_n100k - 0.000105127451172471) < 1e-12 and cp_k5_n100k > 1.0e-4, "Clopper-Pearson k=5, n=100000 self-check failed")
    require_cond(abs(cp_k10_n100k - 0.000169616287626368) < 1e-12 and cp_k10_n100k > 1.0e-4, "Clopper-Pearson k=10, n=100000 self-check failed")
    require_cond(cp_k99983552_n1e12 <= 1.0e-4 and abs(cp_k99983552_n1e12 - 9.999999992960521e-5) < 1e-14, "Clopper-Pearson k=99983552, n=1e12 boundary PASS check failed")
    require_cond(cp_k99983553_n1e12 > 1.0e-4 and abs(cp_k99983553_n1e12 - 1.0000000092968744e-4) < 1e-14, "Clopper-Pearson k=99983553, n=1e12 boundary FAIL check failed")
    require_cond(cp_k99983552_n1e12 < cp_k99983553_n1e12, "Clopper-Pearson monotonicity check at n=1e12 failed")
    require_cond(cp_k100k_n1005m > 1.0e-4, "Clopper-Pearson k=100000, n=1005216927 boundary FAIL check failed")
    require_cond(
        clopper_pearson_u95_decimal(0, GATE5_OQ012_MIN_EFFECTIVE_TRIALS, alpha=0.05) <= GATE5_OQ012_MAX_U95_DEC
        and oq012_k0_n299573228 <= 1.0e-8
        and oq012_k0_n400m <= 1.0e-8
        and acute_k0_n100k > 1.0e-5,
        "Live Blueprint Section 7 OQ-012 Gate 5 boundary self-check failed",
    )

    # Clinical PK clearance audit: Rimiducid (Iuliucci et al. 2001, PMID:11504275; Di Stasi et al. 2011, PMID:22047558) & GCV
    ap1903_assumed_monoexp_t_half_h = 5.0
    ap1903_cmax_nM = 300.0  # 0.4 mg/kg 2-h IV infusion (~250-350 nM)
    ap1903_ec90_nM = 10.0
    ap1903_monoexp_t99_h = round(ap1903_assumed_monoexp_t_half_h * math.log2(100.0), 2)
    gcv_t_half_h = 3.5
    gcv_cmax_uM = 34.0      # 5 mg/kg IV q12h (~32-36 uM)
    gcv_ctrough_uM = 3.0    # 3 uM trough = 60% of 5 uM upper IC90 (BELOW 5 uM!)
    gcv_ic90_upper_uM = 5.0
    gcv_ctrough_pct_of_upper_ic90 = round((gcv_ctrough_uM / gcv_ic90_upper_uM) * 100.0, 1)
    gcv_monoexp_t99_h = round(gcv_t_half_h * math.log2(100.0), 2)

    return {
        "rt2_gapdh_migration_note": "Moved pan-lineage switch OFF hyper-abundant glycolysis-coupled GAPDH (>5e5 copies/cell; basal leak risk and 7.2 kb 3'-UTR NMD mirroring GY-022) onto moderate essential TBP (chr6q27) or ACTB (chr7p22.1).",
        "yi_2000_ires_scope_correction": "Yi et al. 2000 (PMID:10864658) demonstrated GAPDH translational suppression specifically on the hepatitis A virus (HAV) IRES (stem-loop IIIa), NOT on the EMCV IRES used here; retained strictly as a mechanistic analog caution, not proof of an EMCV genomic-neighborhood effect.",
        "pmid_11242052_integrity_pairing": {
            "pmid_11242052_status": "NOT_RETRACTED_ERRATUM_AND_ORI_FIG2B_NOTICED",
            "erratum_and_ori_notices": [
                "Erratum: Nature 2001 Jun 28;411(6841):1081",
                "NIH ORI Notice NOT-OD-01-040 (PMC4259633, PubMed 12449965) — falsified Fig. 2b Western blot panel by co-author Ayman Saleh",
                "NIH ORI Notice NOT-OD-01-046 (PMC4259631, PubMed 12449950)",
            ],
            "paired_caution_pmid": "23572523",
            "shared_author_and_construct_disclosure": "Yigong Shi is a shared senior author between Srinivasula et al. 2001 (PMID:11242052) and Hu & Shi 2013 (PMID:23572523), AND Hu & Shi 2013 tested a distinct biochemical construct/hypothesis (apoptosome activation of unprocessed single-chain procaspase-9 triple mutant E306A/D315A/D330A, NOT FKBP-dimerized iCasp9 D315A). Combined with XIAP/Caspase-3 ratio heterogeneity (Yuan et al. 2022, PMID:35013114), unilateral D315A promotion is prohibited pending head-to-head hypoxic 1% O2 + cytokine testing of WT iCasp9 vs iCasp9(D315A) vs iCasp8.",
        },
        "pdb_1nw9_benchmark": PINNED_PDB_ATOMIC_BENCHMARKS["PDB_1NW9_XIAP_BIR3_CASP9"],
        "protein_specs": {
            "iCasp9_WT": {"length_aa": len(icasp9_wt), "mw_kda": protein_mw_kda(icasp9_wt), "pI": protein_pi(icasp9_wt), "catalytic_motif": "His237 / Cys287 (QACGG)", "sha256": sha256_str(icasp9_wt)},
            "iCasp9_D315A": {"length_aa": len(icasp9_d315a), "mw_kda": protein_mw_kda(icasp9_d315a), "pI": protein_pi(icasp9_d315a), "catalytic_motif": "His237 / Cys287 (QACGG)", "ibm_mutated": "PEPD|ATPF -> PEPAATPF", "sha256": sha256_str(icasp9_d315a)},
            "iCasp8_WT_Cat": {"length_aa": len(icasp8), "mw_kda": protein_mw_kda(icasp8), "pI": protein_pi(icasp8), "catalytic_motif": "His317 / Cys360 (QACQG)", "xiap_bir3_ibm_count": 0, "rt2_neoepitope_watch": ["GMLEDGKKV (HLA-A*02:01 P9-Val from FKBP12 F36V)", "GSSESQTL (HLA-C*03:04 junction)"], "rt2_cflip_pyroptosis_watch": "Cottet et al. 2002 (PMID:12031968, mouse betaTc-Tet cFLIP) + GSDMD/IL-1beta cleavage check; WT FRB/FKBP12 backup", "sha256": sha256_str(icasp8)},
            "HSV1_TK_Q9QNF7": {"length_aa": len(seq_hsvtk), "mw_kda": protein_mw_kda(seq_hsvtk), "pI": protein_pi(seq_hsvtk), "sha256": sha256_str(seq_hsvtk)},
            "hTMPK_F105Y_neoepitope_ban": {"wt_9mer": "RYAFSGVAF", "mut_9mer": "RYAFSGVAY", "restriction": "BANNED on AH8.1+ HLA-C*07:01/02 arms including autologous D1b-Lean-K2 and HLA-C-retained Design X."},
        },
        "essential_locus_aav6_donors_arithmetic_headroom": donors,
        "dual_layer_mutation_escape_dependence_analysis": {
            "applicable_manifest_arms_only": ["Y", "Z"],
            "single_switch_arms_excluded_from_dual_claim": ["A", "B", "X", "D"],
            "independent_chromosomes_note": "chr6q27 (TBP::iCasp9) and chr10q21.2 (CDK1::HSV-TK) sit on distinct chromosomes, which does NOT eliminate shared clone state, epigenetic silencing, drug access, hypoxic stress, or quiescent G0 state.",
            "stipulated_marginal_ceilings": {"p_tbp_icasp9": p1_marginal, "p_cdk1_hsvtk": p2_marginal},
            "frechet_dependence_interval_joint_escape": [frechet_lo, frechet_hi],
            "independence_sensitivity_only_joint_escape": indep_sensitivity,
            "release_level_1e12_bound_withdrawn": True,
            "empirical_1e16_claim_removed": True,
            "expected_escapes_at_1e9_cells": {
                "dose_cells": int(dose_cells),
                "frechet_full_interval": [round(dose_cells * frechet_lo, 6), round(exp_escapes_frechet_hi, 3)],
                "independence_reference_point_only": round(exp_escapes_indep, 6),
                "interval_vs_independence_note": "Full exact Frechet interval spans [0, 1,000] expected escapes per 10^9 cells; 0.001 is strictly the separate independence reference point (p1*p2=10^-12), NEVER the interval floor.",
                "poisson_ge1_escaper_independence_sensitivity_only": round(p_surv_ge1_indep, 6),