scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py · SHA-256: d5b98e2ba1310333…
"poisson_ge1_escaper_frechet_upper": round(p_surv_ge1_frechet_hi, 6),
},
"wunderlich_2022_pmid35795779_exact_u95": {
"observed_biallelic_escapes": 0,
"cells_tested": wunderlich_cells,
"exact_binomial_clopper_pearson_u95": wunderlich_u95_binomial,
"exact_binomial_u95_rounded_12dp": round(wunderlich_u95_binomial, 12),
"exact_binomial_u95_scientific": f"{wunderlich_u95_binomial:.9e}",
"poisson_approximation_u95": wunderlich_u95_poisson,
"one_sided_95pct_u95_scientific_3sf": f"{wunderlich_u95_binomial:.2e}",
"scope_limitation": "Observed in undifferentiated hiPSCs with AAVS1 biallelic iCasp9 (different locus and single-switch configuration); exact Clopper-Pearson zero-event formula 1 - 0.05**(1/0.8e9) = 3.744665335e-9 (Poisson -ln(0.05)/0.8e9 agrees to 3 significant figures). Neither Wunderlich 2022 nor Liang 2018 (PMID:30429614, undifferentiated pluripotent cells) estimates a joint escape bound for differentiated candidate islet grafts.",
},
"clopper_pearson_positive_count_benchmarks": {
"solver_method": "pure_stdlib_decimal_prec75_stirling_lentz_certified_bracket_upward_float",
"k4_n100000_exact_u95": cp_k4_n100k,
"k4_n100000_le_1e4_gate": bool(cp_k4_n100k <= 1.0e-4),
"k5_n100000_exact_u95": cp_k5_n100k,
"k5_n100000_exceeds_1e4_gate": bool(cp_k5_n100k > 1.0e-4),
"k10_n100000_exact_u95": cp_k10_n100k,
"k10_n100000_exceeds_1e4_gate": bool(cp_k10_n100k > 1.0e-4),
"k99983552_n1e12_exact_u95": cp_k99983552_n1e12,
"k99983552_n1e12_le_1e4_gate": bool(cp_k99983552_n1e12 <= 1.0e-4),
"k99983553_n1e12_exact_u95": cp_k99983553_n1e12,
"k99983553_n1e12_exceeds_1e4_gate": bool(cp_k99983553_n1e12 > 1.0e-4),
"k100000_n1005216927_exact_u95": cp_k100k_n1005m,
"k100000_n1005216927_exceeds_1e4_gate": bool(cp_k100k_n1005m > 1.0e-4),
"live_blueprint_s7_oq012_min_effective_trials": GATE5_OQ012_MIN_EFFECTIVE_TRIALS,
"live_blueprint_s7_oq012_k0_n299573228_u95": oq012_k0_n299573228,
"live_blueprint_s7_oq012_k0_n299573227_u95_held_underpowered": oq012_k0_n299573227,
"live_blueprint_s7_oq012_k0_n400m_u95": oq012_k0_n400m,
"acute_potency_screen_k0_n100k_u95_insufficient_for_oq012": acute_k0_n100k,
},
"clonogenic_detection_limit_note": "Acute Stage-0 hypoxic/normoxic switch-potency screens (U95 <= 1e-4, e.g. 0/100,000 cells -> U95 = 2.9957e-5) NEVER satisfy clinical Gate 5 rare-escape release: live Blueprint Section 7 OQ-012 requires strict k = 0 survivors, explicit recovery parameters f in (0,1] and eta >= 0.30, effective clonogenic trials n_eff <= floor(n*f*eta) with n_eff >= 299,573,228, and exact 75-digit Decimal Clopper-Pearson U95(0, n_eff) <= 1e-8 (otherwise governed HOLD or FAIL with promotion_authorized=False), paired with live GY-030 5-lineage whole-graft Gate 0V release.",
"quiescent_g0_caveat": "CDK1::HSV-TK ablates strictly dividing (CDK1+) cells; quiescent G0 beta/stromal cells rely solely on pan-lineage TBP/ACTB::iCasp9/iCasp8.",
},
"clinical_pk_clearance_audit": {
"rimiducid_AP1903": {
"reference_pmids": ["11504275", "22047558"],
"regimen": "0.4 mg/kg single 2-h IV infusion",
"cmax_nM": ap1903_cmax_nM,
"ec90_nM": ap1903_ec90_nM,
"cmax_to_ec90_ratio": round(ap1903_cmax_nM / ap1903_ec90_nM, 1),
"iuliucci_2001_multiphasic_human_pk_pct_of_peak": {"at_0p5h": 18.0, "at_2h": 7.0, "at_10h": 1.0},
"assumed_monoexponential_extrapolation_only": {
"assumed_t_half_h": ap1903_assumed_monoexp_t_half_h,
"extrapolated_99pct_clearance_h": ap1903_monoexp_t99_h,
"caveat": "Single-exponential calculation is a simplifying extrapolation ONLY; published human AP1903 kinetics (Iuliucci et al. 2001, PMID:11504275) are multiphasic and plasma washout does not establish hypoxic intragraft exposure or kill.",
},
"clinical_tcell_precedent_pmid22047558": ">90% donor T-cell ablation within 30 min in pediatric GVHD trial (non-islet precedent).",
},
"ganciclovir_GCV": {
"reference_pmid": "30429614",
"regimen": "5 mg/kg IV q12h x 7-14 days",
"cmax_uM": gcv_cmax_uM,
"ctrough_uM": gcv_ctrough_uM,
"hsvtk_ic90_uM_range": [1.0, 5.0],
"ctrough_pct_of_upper_ic90_5uM": gcv_ctrough_pct_of_upper_ic90,
"ctrough_below_upper_ic90_5uM": bool(gcv_ctrough_uM < gcv_ic90_upper_uM),
"trough_coverage_caveat": "Modeled 3.0 uM GCV trough is BELOW the 5.0 uM upper IC90 (60.0%); direct intragraft exposure-kill testing is required rather than assuming continuous >=IC90 coverage across the 12-h dosing interval.",
"assumed_monoexponential_t_half_h": gcv_t_half_h,
"extrapolated_99pct_clearance_h": gcv_monoexp_t99_h,
"renal_clearance_and_monitoring": ">90% renal excretion; CrCl dose adjustment & reversible neutropenia CBC monitoring required.",
},
},
}
# =============================================================================
# PART C — PROSPECTIVE VIRAL-RECEPTOR-AVOIDANCE COMPLEMENT SPLIT (TM-mini-FH-mono-v2 + CD59) & Y-v3
# =============================================================================
def verify_part_c_minifh_complement_split_and_design_yv3(arm_manifest: Dict[str, Any]) -> Dict[str, Any]:
pro = EMBEDDED_AUTHENTIC_ASSETS["proteins"]
rep = EMBEDDED_AUTHENTIC_ASSETS["repaired_constructs"]
seq_cfh = pro["CFH_P08603"]
seq_cd8a = pro["CD8A_P01732"]
seq_pdgfrb = pro["PDGFRB_P09619"]
seq_cd59 = pro["CD59_P13987"]
require_cond(len(seq_cfh) == 1231 and len(seq_cd8a) == 235 and len(seq_cd59) == 128, "UniProt complement protein length fail")
cfh_sp = seq_cfh[0:18]
cfh_scr1_4_k265 = seq_cfh[18:265] # 247 aa (retains Lys265 boundary/linker residue annotated in PDB:5O32)
g4s4 = "GGGGS" * 4 # 20 aa
cfh_scr19_20 = seq_cfh[1106:1231] # 125 aa
require_cond(cfh_scr1_4_k265.endswith("EK") and cfh_scr1_4_k265.count("C") == 16 and cfh_scr19_20.count("C") == 8, "CFH SCR Cys/Lys265 check failed")
# Lead 1 (Short Non-Mucin Stalk): PDGFRB[531..561]
pdgfrb_stalk = ("GGGGS" * 3) + seq_pdgfrb[530:561]
tm_pdgfrb_pre = cfh_sp + cfh_scr1_4_k265 + g4s4 + cfh_scr19_20 + pdgfrb_stalk
tm_pdgfrb_mat = tm_pdgfrb_pre[18:]
require_cond(tm_pdgfrb_mat.count("C") == 24, "TM-mini-FH-v2-PDGFRB total Cys != 24")
require_cond(translate(rep["cds_tm_pdgfrb"], 0) == tm_pdgfrb_pre + "*", "TM-mini-FH-v2-PDGFRB CDS translation mismatch")
# Co-Lead / Comparator 2: Monomeric CD8A(C164S, C181S)
cd8a_wt = seq_cd8a[137:206]
require_cond(cd8a_wt[164 - 138] == "C" and cd8a_wt[181 - 138] == "C", "CD8A WT C164/C181 check failed")
cd8a_mono = cd8a_wt[: 164 - 138] + "S" + cd8a_wt[165 - 138 : 181 - 138] + "S" + cd8a_wt[182 - 138 :]
tm_cd8a_pre = cfh_sp + cfh_scr1_4_k265 + g4s4 + cfh_scr19_20 + cd8a_mono
tm_cd8a_mat = tm_cd8a_pre[18:]
ecd_cd8a = cfh_scr1_4_k265 + g4s4 + cfh_scr19_20 + cd8a_mono[:45]
require_cond(ecd_cd8a.count("C") == 24, "TM-mini-FH-v2-CD8A ECD Cys != 24")
require_cond(translate(rep["cds_tm_cd8a"], 0) == tm_cd8a_pre + "*", "TM-mini-FH-v2-CD8A CDS translation mismatch")
# Terminal MAC partner CD59 (P13987)
cd59_mat = seq_cd59[25:102]
require_cond(cd59_mat.count("C") == 10 and translate(rep["cds_cd59"], 0) == seq_cd59 + "*", "CD59 verification failed")
# Design Y-v3 & Z-EnSC multi-locus inventory strictly matching wave6_canonical_arm_manifest.json:
# 4 knock-in loci (chr15 B2M, chr13 CLYBL, chr6 TBP, chr10 CDK1) + chr16 CIITA RNP KO = 5 edited loci total!
y_manifest = arm_manifest["arms"]["Y"]
z_manifest = arm_manifest["arms"]["Z"]
require_cond(y_manifest["knockin_locus_count"] == 4 and y_manifest["total_edited_locus_count"] == 5, "Manifest Y locus count mismatch")
require_cond(z_manifest["knockin_locus_count"] == 4 and z_manifest["total_edited_locus_count"] == 5, "Manifest Z locus count mismatch")
y_v3_chr15_b2m_bp = 760 + (300 + 1503 + 837 + 360) + (250 + 942 + 180) + (300 + len(rep["cds_tm_pdgfrb"]) + len(rep["cds_cd59"]) + 360)
y_v3_chr13_clybl_bp = 5860
y_v3_chr6_tbp_aav6_pkg = 3670
y_v3_chr10_cdk1_aav6_pkg = 3613
require_cond(y_v3_chr15_b2m_bp == 7550 <= 7800, f"Design Y-v3 chr15 B2M expected 7550 bp, got {y_v3_chr15_b2m_bp}")
reduction_pct = round((1.0 - y_v3_chr15_b2m_bp / 17237.0) * 100.0, 2)
return {
"canonical_manifest_complement_alignment": {
"design_a": arm_manifest["arms"]["A"]["complement_module"] + " [governed v0.8.0 ref ISLET1_DESIGN_A_V080_REF retains pre-existing passive CaO2-PDMS + >=20 um planar recombinant human P04040 catalase barrier hydrogel (GY-013 / live GATE-31); zero additional drugs, biologics, or cuffs; legacy cell-intrinsic CD55+CD59 remains governed by GY-030 CD55_FULL_LENGTH viral addendum]",
"design_b": arm_manifest["arms"]["B"]["complement_module"],
"design_x": arm_manifest["arms"]["X"]["complement_module"] + " [legacy cell-intrinsic CD55+CD59 remains governed by GY-030 CD55_FULL_LENGTH viral addendum]",
"design_y_v3": arm_manifest["arms"]["Y"]["complement_module"] + " [prospective viral-entry-sparing hypothesis unqualified pending Stage-0 Gate 0V viral & functional assays]",
"design_d1b_lean_k2": arm_manifest["arms"]["D"]["complement_module"],
"arm_z_ensc": arm_manifest["arms"]["Z"]["complement_module"] + " [prospective viral-entry-sparing hypothesis unqualified pending Stage-0 Gate 0V viral & functional assays]",
"cd46_wt_and_cd55_overexpression_ban_on_yv3_and_z": "Prohibited on Y-v3 and Z-EnSC: CD46_WT binds HHV-6A/Measles/AdV-B; CD55 binds Coxsackievirus B3 (PMID:35046043) and >=20 Enterovirus B serotypes including Echovirus-6/11 (PMID:36560629).",
"harboe_2004_citation_scope_correction": "Harboe et al. 2004 (PMID:15544620) demonstrated >80% inhibition of classical-pathway-induced C5a and TCC in diluted human serum via selective FACTOR D blockade (mAb 166-32), NOT via Factor H or graft-expressed TM-mini-FH. AP amplification attenuation by TM-mini-FH-mono-v2 + terminal CD59 (closing CD64t IgM-CDC gap, PMID:41543848) is a gated hypothesis pending G34-03 20% NHS IgM/IgG CDC testing; Factor H has zero direct C4b2a cleavage (Schmidt & Lambris 2013, PMID:23616575). Live GY-023 paired IgG-ADCC and live GY-032 (DEC-129) decomposed TNF-alpha + IFN-gamma intrinsic apoptosis remain independently required alongside TM-mini-FH-mono-v2 + CD59.",
"cr3_myeloid_caveat": "Li et al. 2023 (PMID:37306457, domain_transfer_analog T5) shows mini-FH SCR19-20 engages myeloid CR3 (CD11b/CD18); flagged for Stage-0 orientation & macrophage safety verification.",
},
"pdb_structural_benchmarks": {
"PDB_2WII": PINNED_PDB_ATOMIC_BENCHMARKS["PDB_2WII_CFH_SCR1_4_DISULFIDES"],
"PDB_4ONT": PINNED_PDB_ATOMIC_BENCHMARKS["PDB_4ONT_CFH_SCR19_20_DISULFIDES"],
"PDB_2J8B": PINNED_PDB_ATOMIC_BENCHMARKS["PDB_2J8B_CD59_DISULFIDES"],
"PDB_5O32": PINNED_PDB_ATOMIC_BENCHMARKS["PDB_5O32_C3B_MINIFH_FI"],
},
"tm_minifh_mono_v2_pdgfrb_lead": {
"architecture": "CFH_SP[1..18] + CFH_SCR1-4_K265[19..265] + (G4S)4 + CFH_SCR19-20[1107..1231] + (G4S)3 + PDGFRB_TM[531..561]",
"precursor_aa": len(tm_pdgfrb_pre),
"mature_aa": len(tm_pdgfrb_mat),
"mature_mw_kda": protein_mw_kda(tm_pdgfrb_mat),
"mature_pI_disulfide_adjusted": protein_pi(tm_pdgfrb_mat, disulfide_cys_count=24),
"ecd_cys_total": 24,
"expected_ecd_disulfide_bonds": 12,
"disulfide_topology_status": "EXPECTED_NATIVE_TOPOLOGY_PENDING_EXPRESSION_AND_LCMS",
"expected_ecd_unpaired_cys": 0,
"tm_and_cyto_cys": 0,
"mucin_o_glycan_hoisting_eliminated": True,
"pigk_gpi_load": 0,
"cds_hygiene": audit_dna_hygiene(rep["cds_tm_pdgfrb"]),
"protein_sha256": sha256_str(tm_pdgfrb_mat),
},
"tm_minifh_mono_v2_cd8a_comparator": {
"architecture": "CFH_SP[1..18] + CFH_SCR1-4_K265[19..265] + (G4S)4 + CFH_SCR19-20[1107..1231] + CD8A[138..206](C164S, C181S)",
"precursor_aa": len(tm_cd8a_pre),
"mature_aa": len(tm_cd8a_mat),
"mature_mw_kda": protein_mw_kda(tm_cd8a_mat),
"mature_pI_disulfide_adjusted": protein_pi(tm_cd8a_mat, disulfide_cys_count=24),
"ecd_cys_total": 24,
"expected_ecd_disulfide_bonds": 12,
"disulfide_topology_status": "EXPECTED_NATIVE_TOPOLOGY_PENDING_EXPRESSION_AND_LCMS",
"expected_ecd_unpaired_cys": 0,
"tm_and_cyto_cys": 2,
"pigk_gpi_load": 0,
"cds_hygiene": audit_dna_hygiene(rep["cds_tm_cd8a"]),
"protein_sha256": sha256_str(tm_cd8a_mat),
},
"cd59_terminal_mac_partner": {
"uniprot": "P13987",
"mature_aa": len(cd59_mat),
"mature_mw_kda": protein_mw_kda(cd59_mat),
"mature_pI_disulfide_adjusted": protein_pi(cd59_mat, disulfide_cys_count=10),
"ecd_cys_total": 10,
"expected_ecd_disulfide_bonds": 5,
"disulfide_topology_status": "EXPECTED_NATIVE_TOPOLOGY_PENDING_EXPRESSION_AND_LCMS",
"expected_ecd_unpaired_cys": 0,
"pigk_gpi_load": 1,
"cds_hygiene": audit_dna_hygiene(rep["cds_cd59"]),
},
"design_y_v3_and_z_5locus_inventory": {
"rt2_gapdh_7p2kb_3utr_nmd_option_killed": True,
"knockin_locus_count": 4,
"rnp_knockout_locus_count": 1,
"total_edited_locus_count": 5,
"edited_loci_canonical": list(y_manifest["loci"]),
"delivery_category_and_deposition_status": {
"chr15_b2m_7550bp": "MULTI_LOCUS_NON_SINGLE_AAV6 (large-cargo integration e.g. eePASSIGE; >4,700 bp; full assembly NOT deposited in 26-record FASTA)",
"chr13_clybl_5860bp": "MULTI_LOCUS_NON_SINGLE_AAV6 (large-cargo integration; >4,700 bp; full assembly NOT deposited in 26-record FASTA)",
"chr6_tbp_3670bp_arith_pkg": "SINGLE_AAV6_ARITHMETIC_HEADROOM_VERIFIED (deposited in 26-record FASTA)",
"chr10_cdk1_3613bp_arith_pkg": "SINGLE_AAV6_ARITHMETIC_HEADROOM_VERIFIED (deposited in 26-record FASTA)",
"chr16_ciita_rnp_ko": "RNP_KNOCKOUT_NO_DONOR_CARGO",
},
"chr15_b2m_assembly_bp": y_v3_chr15_b2m_bp,
"chr15_size_reduction_vs_v2_17237bp_pct": reduction_pct,
"chr13_clybl_assembly_bp": y_v3_chr13_clybl_bp,
"chr6_tbp_aav6_icasp9_arithmetic_pkg_bp": y_v3_chr6_tbp_aav6_pkg,
"chr10_cdk1_aav6_hsvtk_arithmetic_pkg_bp": y_v3_chr10_cdk1_aav6_pkg,
"single_chr15_loh_switch_loss_eliminated": True,
"total_pigk_gpi_load": 1,
},
}
# =============================================================================
# PART D — D1B-LEAN-K2 (K=2, B=0, SINGLE-LAYER) & STRICT REPO HYGIENE AUDIT
# =============================================================================
def verify_part_d_d1bk2_and_repo_hygiene(
arm_manifest: Dict[str, Any],
repo_root: Path | None,
website_root: Path | None = None,
) -> Dict[str, Any]:
rep = EMBEDDED_AUTHENTIC_ASSETS["repaired_constructs"]
pro = EMBEDDED_AUTHENTIC_ASSETS["proteins"]
d_manifest = arm_manifest["arms"]["D"]
require_cond(d_manifest["dual_switch_required_for_release"] is False and d_manifest["dual_switch_wetlab_qualified"] is False, "Manifest D1b must be strictly single-switch and pre-wetlab unqualified")
require_cond(d_manifest["knockin_locus_count"] == 2 and d_manifest["total_edited_locus_count"] == 2, "Manifest D1b must be K=2, total=2")
d1b_l2 = rep["d1bk2_l2_cxcl10"]
d1b_l2_payload_h = audit_dna_hygiene(d1b_l2[425 : len(d1b_l2) - 425])
require_cond(d1b_l2_payload_h["passes_synthetic_v090_gates"], "D1b-K2 CXCL10 payload hygiene fail")
require_cond(len(d1b_l2) + AAV6_ITR_OVERHEAD_BP == 4218 <= AAV6_MAX_PACKAGED_BP, "D1b-K2 CXCL10 AAV6 arithmetic ceiling fail")
sb9_present = any((pro["SERPINB9_P50453"] + "*") in translate(d1b_l2, fr) for fr in range(3))
pdl1_present = any((pro["PDL1_Q9NZQ7"] + "*") in translate(d1b_l2, fr) for fr in range(3))
require_cond(sb9_present and pdl1_present, "D1b-K2 CXCL10 missing intact SERPINB9 or PD-L1")
# Fail-closed live repo audit: when --repo-root is supplied, ALL mandatory repo files MUST exist!
live_repo_findings: Dict[str, Any] = {"repo_cross_checked": False, "website_cross_checked": False}
if repo_root is not None:
require_cond(repo_root.is_dir(), f"FAIL_CLOSED: --repo-root is not a directory: {repo_root}")
wlc = repo_root / "scripts" / "wetlab_contract.py"
pdef = repo_root / "data" / "protocols" / "islet1_product_definitions_v0.8.0.json"
p42 = repo_root / "data" / "extracted" / "iip0042_master_multilayer_portfolio_crosswalk_v0.8.0.json"
for req_f in (wlc, pdef, p42):
require_cond(req_f.is_file(), f"FAIL_CLOSED: mandatory live repo file missing under --repo-root: {req_f.name}")
wlc_bytes = wlc.read_bytes()
pdef_bytes = pdef.read_bytes()
p42_bytes = p42.read_bytes()
wlc_txt = wlc_bytes.decode("utf-8")
pd_obj = load_strict_json_text(pdef_bytes.decode("utf-8"), pdef.name)
prods = pd_obj.get("product_definitions", pd_obj.get("products", {}))
if isinstance(prods, dict):
d1a = prods.get("ISLET1_D1_AUTO_V2_L1A_CIITA_CD64T_IL1RN", {})
elif isinstance(prods, list):