scripts/verify_iip0057_foundry_v2_shield_invvax_insl82i_cuffv2.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0057_foundry_v2_shield_invvax_insl82i_cuffv2.py · SHA-256: 1c63dcf649c42be4…
"fcrn_45p66d_half_life_status": "MODELED_PARAMETER_PENDING_NHP_AND_HUMAN_PK",
"honest_solo_c3_lift_pp_range": [1.5, 2.2],
"honest_solo_c3_lift_pp_central": 1.8,
},
"linear_periodic_pk_simulations": pk_list,
"coupled_nonlinear_tmdd_ode_simulations": coupled_tmdd,
"kp_dln_sensitivity_LALAPG_LS_150mg_Q28D": kp_sens,
"converged_pan_dq_selectivity_proof": pan_dq_proof,
"ighg1_P01857_1_secreted_LALAPG_LS_KiH_fc_scaffold": {
"scope_disclosure": "FASTA supplies Fc heterodimer scaffolds ONLY; target anti-DQ2.5+HIP11 and anti-DQ8+InsB-R3 VH/VL domains and common light chain are pending Foundry wet-lab discovery.",
"uniprot_isoform": "P01857-1 (secreted VSP_061818 G446, EU 221..446, K447 clipped)",
"fc_knob_length_aa": len(knob_seq),
"fc_hole_length_aa": len(hole_seq),
"fc_knob_sha256": sha256_str(knob_seq),
"fc_hole_sha256": sha256_str(hole_seq),
"fc_heterodimer_total_cys": 14,
"fc_heterodimer_expected_disulfides": 7,
"fc_heterodimer_expected_unpaired_cys": 0,
"disulfide_status": "EXPECTED_TOPOLOGY_PENDING_EXPRESSED_LCMS_QC",
"fc_heterodimer_mw_kda": fc_dimer_mw_kda,
"n297_glycan_preserved": True,
"adcc_cdc_status": "EXPECTED_SILENCED_LALAPG_PENDING_EXPRESSED_CELLULAR_ASSAY",
},
"deterministic_rcsb_pdb_contact_audits": pdb_contacts,
}
# ---------------------------------------------------------------------------
# PART B: INS p.Leu82Ile (C-Peptide L26I) — PE2max + ELISA + DR4 + HLA-A*11:01
# ---------------------------------------------------------------------------
def verify_part_b() -> dict[str, Any]:
cds = INS_GRCH38_CANONICAL_CDS
flank = INS_GRCH38_FLANK_MINUS_243BP
prot_wt = UNIPROT_P01308_PREPROINSULIN
translated = "".join(CODON_TABLE[cds[i : i + 3]] for i in range(0, len(cds) - 3, 3))
require_cond(translated == prot_wt, "INS CDS translation must match UniProt P01308 100%")
wt_codon_82 = cds[243:246]
require_cond(wt_codon_82 == "CTG" and prot_wt[81] == "L", "INS codon 82 must be WT CTG (Leu)")
require_cond(flank[120:123] == "CTG", "GRCh38 chr11:2159939-2159941 (-1) must be CTG")
single_nt = []
ile_1nt = 0
for pos in range(3):
for b in "ACGT":
if b == wt_codon_82[pos]:
continue
cand = wt_codon_82[:pos] + b + wt_codon_82[pos + 1 :]
aa = CODON_TABLE[cand]
if aa == "I":
ile_1nt += 1
ed = "CBE" if (wt_codon_82[pos], b) in {("C", "T"), ("G", "A")} else (
"ABE" if (wt_codon_82[pos], b) in {("A", "G"), ("T", "C")} else "Transversion/PE"
)
single_nt.append({"cds_pos": 244 + pos, "change": f"{wt_codon_82}->{cand}", "aa": aa, "is_ile": aa == "I", "editor": ed})
require_cond(ile_1nt == 0 and len(single_nt) == 9, "Exactly 0/9 single-nt edits of CTG yield Ile")
require_cond(CODON_TABLE["TTA"] == "L", "CBE double C>T+G>A still yields synonymous Leu")
cds_mut = cds[:243] + "ATC" + cds[246:]
prot_mut = "".join(CODON_TABLE[cds_mut[i : i + 3]] for i in range(0, len(cds_mut) - 3, 3))
require_cond(prot_mut[81] == "I", "Mutant codon 82 must encode Ile")
require_cond(prot_mut[0:24] == prot_wt[0:24], "Signal peptide must stay 100% WT")
require_cond(prot_mut[24:54] == prot_wt[24:54], "Mature B-chain must stay 100% WT")
require_cond(prot_mut[54:56] == "RR" and prot_mut[87:89] == "KR", "PC1/3 and PC2 motifs must stay 100% WT")
require_cond(prot_mut[89:110] == prot_wt[89:110], "Mature A-chain must stay 100% WT")
ideal_bystanders = sum(1 for a, b in zip(prot_wt, prot_mut) if a != b) - 1
require_cond(ideal_bystanders == 0, f"Expected 0 ideal bystander AA changes, got {ideal_bystanders}")
flank_mut = flank[:120] + "ATC" + flank[123:]
sp1 = flank[101:121]
pam1_wt, pam1_mut = flank[121:124], flank_mut[121:124]
pbs1 = revcomp(flank[107:118])
rtt1 = revcomp(flank_mut[118:132])
require_cond(sp1 == "CAGCCTGCAGCCCTTGGCCC" and pam1_wt == "TGG" and pam1_mut == "TCG", "epegRNA-1 verification failed")
require_cond(pbs1 == "CCAAGGGCTGC" and rtt1 == "GGACCCCTCGATGG", "epegRNA-1 PBS/RTT mismatch")
rc_wt, rc_mut = revcomp(flank), revcomp(flank_mut)
sp2 = rc_wt[101:121]
pam2_wt, pam2_mut = rc_wt[121:124], rc_mut[121:124]
pbs2 = revcomp(rc_wt[106:118])
rtt2 = revcomp(rc_mut[118:132])
require_cond(sp2 == "GCTTCTGCAGGGACCCCTCC" and pam2_wt == "AGG" and pam2_mut == "ATG", "epegRNA-2 verification failed")
require_cond(pbs2 == "GGGGTCCCTGCA" and rtt2 == "CCCTTGGCCATCGA", "epegRNA-2 PBS/RTT mismatch")
wt_gt = [i for i in range(105, 130) if flank[i + 3 : i + 5] == "GT"]
mut_gt = [i for i in range(105, 130) if flank_mut[i + 3 : i + 5] == "GT"]
wt_ag = [i for i in range(98, 128) if flank[i + 12 : i + 14] == "AG"]
mut_ag = [i for i in range(98, 128) if flank_mut[i + 12 : i + 14] == "AG"]
require_cond(len(mut_gt) == len(wt_gt) and len(mut_ag) == len(wt_ag), "CTG->ATC must create 0 cryptic GT/AG splice motifs")
# Expanded 9-allele MHC-I scan INCLUDING HLA-A*11:01 (PMID:29343547 transfected K562 surrogate PPI 80-88 LALEGSLQK!)
mhci_motifs = {
"HLA-A*02:01": (set("LMIVQT"), set("VLI")),
"HLA-A*01:01": (set("TSD"), set("YF")),
"HLA-A*03:01": (set("LMVIT"), set("KYR")),
"HLA-A*11:01": (set("VILMTSAQ"), set("KR")),
"HLA-A*24:02": (set("YF"), set("FLI")),
"HLA-B*07:02": (set("P"), set("LFMVI")),
"HLA-B*08:01": (set("LKRI"), set("LMIV")),
"HLA-B*44:02": (set("E"), set("FYWL")),
"HLA-C*07:01": (set("RY"), set("YLFM")),
}
de_novo_mhci = 0
a0201_watch: list[str] = []
a1101_watch: list[str] = []
for k in (8, 9, 10, 11):
for s in range(max(0, 81 - k + 1), min(len(prot_wt) - k + 1, 82)):
pw, pm = prot_wt[s : s + k], prot_mut[s : s + k]
wt_h = {al for al, (p2, pc) in mhci_motifs.items() if pw[1] in p2 and pw[-1] in pc}
mut_h = {al for al, (p2, pc) in mhci_motifs.items() if pm[1] in p2 and pm[-1] in pc}
if mut_h - wt_h:
de_novo_mhci += 1
if "HLA-A*02:01" in mut_h:
a0201_watch.append(pm)
if "HLA-A*11:01" in mut_h:
a1101_watch.append(pm)
require_cond(de_novo_mhci == 0, f"Expected 0 de-novo MHC-I anchor gains across 9 alleles, got {de_novo_mhci}")
require_cond("LAIEGSLQK" in a1101_watch, "HLA-A*11:01 watch list must capture PPI 80-88 LAIEGSLQK")
require_cond(
set(a0201_watch) == set(MANDATORY_INS_HLA_TARGET_PEPTIDES["HLA-A*02:01"]),
f"HLA-A*02:01 governed target peptides must match P01308 L82I watch list: {a0201_watch}",
)
ppi_80_88_wt = prot_wt[79:88]
ppi_80_88_mut = prot_mut[79:88]
require_cond(ppi_80_88_wt == "LALEGSLQK" and ppi_80_88_mut == "LAIEGSLQK", "PPI 80-88 mismatch")
dq_gains = 0
for s in range(max(0, 81 - 8), min(len(prot_wt) - 8, 82)):
cw, cm = prot_wt[s : s + 9], prot_mut[s : s + 9]
if sum(cm[i] in "DE" for i in (3, 5, 6)) > sum(cw[i] in "DE" for i in (3, 5, 6)):
dq_gains += 1
if sum(cm[i] in "DE" for i in (0, 8)) > sum(cw[i] in "DE" for i in (0, 8)):
dq_gains += 1
require_cond(dq_gains == 0, "Expected 0 de-novo DQ2.5/DQ8 acidic anchors")
c19_a3_wt = "GSLQPLALEGSLQKRGIV"
c19_idx = prot_wt.index(c19_a3_wt)
c19_a3_mut = prot_mut[c19_idx : c19_idx + len(c19_a3_wt)]
l82_pos_in_c19_a3 = 82 - c19_idx
dr4_core_wt = "LALEGSLQK"
dr4_core_idx = prot_wt.index(dr4_core_wt)
dr4_core_mut = prot_mut[dr4_core_idx : dr4_core_idx + 9]
l82_pos_in_dr4_core = 82 - dr4_core_idx
require_cond(l82_pos_in_c19_a3 == 8 and c19_a3_mut == "GSLQPLAIEGSLQKRGIV", "C19-A3 pos-8 check failed")
require_cond(l82_pos_in_dr4_core == 3 and dr4_core_mut == "LAIEGSLQK", "DRB1*04:01 P3 core check failed")
u95_0_of_12_pct = round(_clopper_pearson_upper_95_pct(0, 12), 4)
u95_0_of_4_pct = round(_clopper_pearson_upper_95_pct(0, 4), 4)
require_cond(abs(u95_0_of_12_pct - 22.0922) < 1e-3, f"0/12 U95 mismatch: {u95_0_of_12_pct}")
require_cond(abs(u95_0_of_4_pct - 52.7129) < 1e-3, f"0/4 U95 mismatch: {u95_0_of_4_pct}")
return {
"grch38_locus": "chr11:2159939-2159941 (-1 strand, ENSG00000254647 / ENST00000381330.5 / NM_000207.3)",
"wt_codon_82": wt_codon_82,
"edited_codon_82": "ATC",
"single_nt_ile_outcomes": ile_1nt,
"base_editors_disqualified": True,
"gy021_mandatory_editor": "PE2max + epegRNA (100% MLH1dn-FREE; un-gated PE4max BANNED)",
"epegRNA_1": {"spacer": sp1, "wt_pam": pam1_wt, "edited_pam": pam1_mut, "pbs": pbs1, "rtt": rtt1, "polyT": any("TTTT" in x for x in (sp1, pbs1, rtt1))},
"epegRNA_2": {"spacer": sp2, "wt_pam": pam2_wt, "edited_pam": pam2_mut, "pbs": pbs2, "rtt": rtt2, "polyT": any("TTTT" in x for x in (sp2, pbs2, rtt2))},
"ideal_product_mature_B_A_PC1_3_PC2_100pct_wt": True,
"ideal_product_bystander_aa_changes": ideal_bystanders,
"ideal_vs_measured_scope_note": "Sequence enumeration verifies ideal CTG->ATC translation only; clonal bystander sequencing, RNA splicing (Delta PSI), proinsulin processing, and dynamic GSIS remain mandatory wet-lab measurements.",
"in_silico_cryptic_gt_donors_created": len(mut_gt) - len(wt_gt),
"in_silico_cryptic_ag_acceptors_created": len(mut_ag) - len(wt_ag),
"external_variant_db_provenance": {
"query_date_utc": "2026-12-01",
"locus_queried": "GRCh38 chr11:2159939-2159941 (-1 strand; +strand CAG->GAT; INS NM_000207.3:c.244_246delinsATC / p.Leu82Ile)",
"clinvar_query": {
"api_source": "NCBI ClinVar E-utilities",
"query_date_utc": "2026-12-01",
"gene_query": "INS[gene]",
"gene_total_variation_ids": 255,
"exact_codon82_query": "11[chr] AND 2159939:2159941[chrpos]",
"exact_codon82_variation_count": 0,
"flanking_control_query": "11[chr] AND 2159930:2159950[chrpos]",
"flanking_control_variation_count": 6,
"flanking_retrievable_variation_ids": [
{"variation_id": "5022809", "hgvs": "NM_000207.3(INS):c.243C>T (p.Ala81=)", "classification": "Likely benign"},
{"variation_id": "4714280", "hgvs": "NM_000207.3(INS):c.241dup (p.Ala81fs)", "classification": "Uncertain significance"},
{"variation_id": "3346944", "hgvs": "NM_000207.3(INS):c.242C>T (p.Ala81Val)", "classification": "Uncertain significance"},
{"variation_id": "2822542", "hgvs": "NM_000207.3(INS):c.249G>A (p.Glu83=)", "classification": "Likely benign"},
{"variation_id": "68729", "hgvs": "NM_000207.3(INS):c.250G>A (p.Gly84Arg)", "classification": "Uncertain significance"},
{"variation_id": "4537654", "hgvs": "NM_000207.3(INS):c.254C>G (p.Ser85Cys)", "classification": "Uncertain significance"},
],
},
"gnomad_v4p1_query": {
"dataset": "gnomad_r4 (gnomAD v4.1 GraphQL API)",
"query_date_utc": "2026-12-01",
"region_queried": "GRCh38 chr11:2159930-2159950",
"region_total_variants": 32,
"codon82_exome_an_denominator_range": [1445176, 1446030],
"flanking_genome_an_denominator_range": [152164, 152282],
"target_mnv_variant_id": "11-2159939-CAG-GAT",
"target_mnv_observed_records": 0,
"codon82_covered_alleles": [
{"variant_id": "11-2159939-C-G", "rsids": [], "coding_change": "c.246G>C (p.Leu82=)", "consequence": "synonymous_variant", "exome_ac": 1, "exome_an": 1446030},
{"variant_id": "11-2159939-C-T", "rsids": ["rs934790989"], "coding_change": "c.246G>A (p.Leu82=)", "consequence": "synonymous_variant", "exome_ac": 1, "exome_an": 1446030},
{"variant_id": "11-2159940-A-G", "rsids": [], "coding_change": "c.245T>C (p.Leu82Pro)", "consequence": "missense_variant", "exome_ac": 0, "exome_an": 1445176},
{"variant_id": "11-2159941-G-T", "rsids": [], "coding_change": "c.244C>A (p.Leu82Met)", "consequence": "missense_variant", "exome_ac": 0, "exome_an": 1445358},
],
},
"ensembl_vep_prediction": "SIFT = 0.38 (tolerated), PolyPhen = 0.502 (possibly_damaging — mandates human beta-cell processing & GSIS QC)",
"note": "Absence of p.Leu82Ile in ClinVar (0 at chr11:2159939-2159941) and gnomAD v4.1 (0 MNV records across ~1.445M exome alleles) does NOT prove clinical benignity; functional beta-cell qualification is mandatory.",
},
"mhci_alleles_scanned_count": len(mhci_motifs),
"mhci_alleles_scanned": sorted(mhci_motifs.keys()),
"de_novo_mhci_anchor_gains": de_novo_mhci,
"a0201_watch_peptides": a0201_watch,
"hla_a1101_surrogate_ppi80_88_audit": {
"primary_pmid": "PMID:29343547",
"citation": "Kronenberg-Versteeg et al. 2018 Diabetes (p. 10 & Supp. Fig. 2A: eluted from transfected K562 surrogate cells expressing HLA-A*11:01 — NOT endogenous primary human beta-cell elution)",
"biological_system": "TRANSFECTED_K562_SURROGATE_CELLS",
"endogenous_product_cell_elution_status": "PROSPECTIVE_STAGE0_GATE_PENDING_EDITED_PRODUCT_PEPTIDOMICS",
"p01308_1based_span": "80..88",
"peptide_wt": ppi_80_88_wt,
"peptide_mut": ppi_80_88_mut,
"l82i_position_in_9mer": 3,
"a1101_watch_peptides": a1101_watch,
"mandatory_in_pre_edit_hla_panel": True,
},
"de_novo_dq25_dq8_acidic_anchor_gains": dq_gains,
"mandatory_hla_dr4_c19_a3_audit": {
"epitope_wt": c19_a3_wt,
"epitope_mut": c19_a3_mut,
"p01308_1based_span": f"{c19_idx + 1}..{c19_idx + len(c19_a3_wt)}",
"l82i_position_in_c19_a3_1based": l82_pos_in_c19_a3,
"drb1_0401_core_wt": dr4_core_wt,
"drb1_0401_core_mut": dr4_core_mut,
"l82i_core_pocket": f"P{l82_pos_in_dr4_core}",
"pre_edit_binding_and_elispot_required": True,
},
"donor_panel_statistical_bound": {
"min_donors_per_mandatory_allele": 2,
"min_unique_donors_deduplicated": 12,
"exact_one_sided_95pct_U95_for_0_of_12_pct": u95_0_of_12_pct,
"exact_one_sided_95pct_U95_for_0_of_4_duplicate_panel_pct": u95_0_of_4_pct,
"interpretation": "Deduplicated unique donors across mandatory panels must be >= 12: 0/12 unique reactive donors gives exact one-sided 95% U95 = 22.0922% (whereas reusing 4 donors across 3 allele panels yields 0/4 U95 = 52.7129% -> FAIL).",
},
"preprint_disclosure": {
"pmid": "PMID:42523473",
"citation": "Elyanow et al. 2026 (PREPRINT — not yet peer-reviewed)",
"status": "PREPRINT",
},
"day1_pre_edit_cpeptide_elisa_gate": {
"platforms": list(MANDATORY_CPEP_ELISA_KITS),
"recovery_pct_bounds": [85.0, 115.0],
"target_clinical_span_nmol_L": [0.05, 5.00],
"mercodia_10_1136_01_published_operating_range_nmol_L": [0.10, 4.00],