OpenIslet

scripts/verify_iip0041_clinical_h1_cd64t_siglec.py

EXP-028 (CAND-031 / Target IIP-0041 — Bucket 2A) Remediated Verification Suite

script Release v0.8.0 gen-eb955f8266035aba 984 KB · 69 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_iip0041_clinical_h1_cd64t_siglec.py · SHA-256: f004cf6d8259b8b4…

                "Non-DTT IgM-preserved T1D serum + IgG2 + 5-10 mg/mL polyclonal human IgG saturation (cis-Fc competition mechanism)",
                "CD64t turnover panel: immune-complex surface half-life, soluble CD64t shedding ELISA, macrophage trogocytosis/stripping, and functional ADCC/CDC pass after 7-day pre-loading in 10 mg/mL polyclonal IgG",
                "Pending empirical FcRgamma (FCER1G) co-IP & phospho-Syk/ITAM negative check + baseline FCER1G RNA/protein audit",
                "CD274p::IL1RN IFN-gamma titration matrix (0, 0.5, 2, 10, 50 ng/mL IFN-gamma at fixed IL-1beta + hIAPP, plus TYK2 P1104A het/hom background cross-linked to GY-001)",
                "Combination macrophage efferocytosis & necrotic debris-clearance guard (exact-stack >= 80.0% abs and >= 70.0% WT per GY-025/GY-010)",
            ],
        },
        "mandatory_gy025_standing_criteria_full_traceability": [
            "GY-025 status remains PENDING until exact-product wet-lab qualification clears (exploratory bulk-kill micro-screen is distinct from full product-switch qualification)",
            "PLVAP+ iEC morphogenesis and viability: t50 <= 36.0 h AND viability >= 85.0%",
            "Exact-stack macrophage efferocytosis: >= 80.0% absolute AND >= 70.0% matched WT",
            "Gate 0G pericyte retention/viability: >= 70.0%",
            "CIITA Exon 5 (78 bp, divisible by 3) Ex4->Ex6 in-frame skipping audit + quantitative KI/KO informative transcript recovery",
            "16p13.13 cis sentinel 90% TOST equivalence (SOCS1, DEXI, CLEC16A) + lineage-matched WT Stage-7 HLA-DR/DP/DQ IFN-gamma inducibility >= 50%",
            "Promoter-specific 5'-RACE (>= 3,689 effective UMIs) + 3'-RACE verifying polyadenylation cleavage efficiency of mutated HGAPDH_PA_HARD (pos 11, 59, 92 [+19 nt past AATAAA], 115) and HPRT1_PA_HARD (pos 48, 85, 138)",
            "Stage 0-7 CpG methylation & CTCF ChIP across HOXA_CTCF_C5_80 and DM1_RC80",
            "Reconciled AAV6 packaged species (>= 80% monomer, < 10% truncated, <= 15% dimer summing to 100%)",
        ],
    }

    return {
        "fasta_filename": FASTA_OUT.name,
        "fasta_sha256": fasta_sha,
        "active_construct_count": len(p1_audits),
        "single_cargo_controls_2ctcf_symmetric": True,
        "gy023_gy025_gy026_strictly_enforced": True,
        "shared_ciita_arms_byte_identical_to_iip0031_and_iip0035": True,
        "locus2_arbitration_and_graveyard_contract": locus2_contract,
        "gate_p1_constructs": p1_audits,
        "gate_p2_topology_and_disulfides": p2_topology,
        "gate_p3_swissprot_and_gnomad": p3_swissprot,
        "gate_p4_experimental_pdb_interfaces": p4_pdb,
    }


# =============================================================================
# PART C — ZERO-EDIT (K=0) SIGLEC-7/-9 GLYCOENGINEERING & ST6GAL1 CONTRAST
# =============================================================================
def analyze_part_c_siglec_glycoengineering(sp_kmers: dict[int, set[str]]) -> dict[str, Any]:
    qtag = "GQQQLGGGGG"
    qtag_scan = {
        "peptide": qtag,
        "length_aa": len(qtag),
        "k8_total": len(qtag) - 7,
        "k8_foreign_vs_20429_swissprot": sum(1 for i in range(len(qtag) - 7) if qtag[i : i + 8] not in sp_kmers[8]),
        "k9_total": len(qtag) - 8,
        "k9_foreign_vs_20429_swissprot": sum(1 for i in range(len(qtag) - 8) if qtag[i : i + 9] not in sp_kmers[9]),
        "k10_total": 1,
        "k10_foreign_vs_20429_swissprot": int(qtag not in sp_kmers[10]),
        "foreign_9mers": [qtag[i : i + 9] for i in range(len(qtag) - 8) if qtag[i : i + 9] not in sp_kmers[9]],
    }

    # First-order exponential endothelial/beta-cell glycocalyx turnover retention model
    # Rana 2026 PMC13668765 P[9] / Fig. S14A-B observed progressive drop over 48h after rewarming
    half_lives_h = [12.0, 24.0, 36.0, 48.0, 72.0]
    timepoints_days = [2.0, 7.0, 14.0, 28.0, 90.0]
    turnover_table = []
    for hl in half_lives_h:
        row: dict[str, Any] = {"half_life_hours": hl}
        for d in timepoints_days:
            frac = 0.5 ** ((d * 24.0) / hl)
            row[f"day_{int(d)}_retained_pct"] = round(100.0 * frac, 4)
        # Hours until surface coverage drops below 10% (EC10 functional floor)
        row["days_to_10pct_remaining"] = round((hl * math.log2(10.0)) / 24.0, 2)
        turnover_table.append(row)

    return {
        "comparator_classification": "RESEARCH_COMPARATOR_ONLY_BOUNDED_DAY_0_TO_14_WINDOW_UNVALIDATED_FOR_ISLETS",
        "genetic_edit_cost_delta_k": 0,
        "assigned_permanent_graveyard_rule": {
            "guardrail_id": "OFFGRID_GUARD_019_ECTOPIC_ST6GAL1_SIALYLTRANSFERASE_NONSPECIFIC_GLYCAN_REMODELING",
            "graveyard_card_id": "GY-029",
            "severity_level": "BLOCK",
            "wave5_collision_check": "ZERO_COLLISION_CAND034_TAKES_GY030",
        },
        "primary_source": {
            "pmid": "42875686",
            "pmcid": "PMC13668765",
            "license": "CC-BY 4.0",
            "journal": "Adv Sci (Weinh)",
            "year": 2026,
            "chemistry": "Linear polyglycerol (LPG, 14.5 kDa) functionalized with 8% 2,3-sialyllactose (LQS8%, 0.56-1.5 mM) + synthetic peptide Q-tag GQQQLGGGGG covalently ligated to endothelial surface lysines via guinea-pig tissue transglutaminase (gtTGase, 60 min at 4 C in UW preservation solution).",
            "verified_in_vivo_endpoints": {
                "mouse_aorta_balbc_to_c57bl6": "Day 2 (~94% neutrophil reduction), Day 5, Day 15 (~63-67% Mac-3+ macrophage reduction; NKp46+ unchanged). Study terminated at Day 15.",
                "rat_kidney_aci_to_lewis_no_is": "Day 7 endpoint only (attenuated C4d, CD3/CD8 T cells, ATN, microvascular inflammation at 1.5 mM).",
                "in_vitro_stability_pmc13668765_p9_figs14": "Fluorescently labeled polymer tracked ONLY 48 h post-rewarming (progressive signal decline and supernatant release); fluorescence persistence does NOT establish duration of immune function or a demonstrated 14-day protective window.",
                "author_explicit_limitation_p60": "Authors explicitly state durability/longer-term retention under endothelial turnover and delayed humoral anti-conjugate immune responses were NOT evaluated; HLA-E was NOT measured and Fig. S20 leaves steric masking vs altered expression unresolved.",
            },
        },
        "surface_turnover_half_life_sensitivity": turnover_table,
        "qtag_swissprot_immunogenicity_audit": qtag_scan,
        "split_gate_28c_contract": {
            "operational_verifier_enforcement_status": "PRESPECIFIED_RESEARCH_CRITERIA_NOT_YET_WIRED_TO_LIMS_OR_RUNTIME_VERIFIER",
            "gate_28_c0_precell_biochemical_kill_fast": {
                "scope": "Prespecified research comparator criterion (not yet wired to an operational LIMS/runtime record evaluator); execute FIRST before any SC-islet or iEC expenditure.",
                "requirement": (
                    "Empirically verify GMP recombinant human TGM2 (required on its own terms by DEC-120 Gate 28-C0 to exclude "
                    "guinea-pig gtTGase; GY-013 is cited strictly as xenogeneic-protein rationale, as GY-013's standing rule governs catalase) "
                    "achieves >= 50% transamidation conversion of GQQQLGGGGG at 4 C in UW preservation buffer relative to a 37 C Ca2+-activated "
                    "positive control across n >= 3 independent enzyme lots (NH3/isopeptide assay), PLUS <= LOQ residual enzyme washout QC."
                ),
            },
            "gate_28_c1_cellular_titration_only_if_c0_passes": {
                "scope": "Prespecified research comparator criterion (not yet wired to an operational LIMS/runtime record evaluator); executed ONLY if linked Gate 28-C0 provenance passes.",
                "required_linked_c0_provenance_schema": [
                    "c0_record_sha256",
                    "c0_issuer_authority_id",
                    "rhtgm2_supplier_and_grade",
                    "enzyme_lot_ids",
                    "per_lot_conversion_pct_4c_uw_vs_37c_ca2_ctrl",
                    "washout_assay_method",
                    "washout_loq_value_and_units",
                    "per_lot_residual_rhtgm2_after_washout",
                    "washout_determination_protocol_id",
                ],
                "steric_masking_vs_expression_controls": (
                    "Explicitly resolve steric masking vs altered surface expression (matched pre-/post-ligation flow + non-competing/intracellular/mRNA controls) "
                    "using Fc-silent LALAPG or F(ab')2/Fab probes for SIRPalpha (CD47), NKG2A/CD94 (HLA-E — explicitly measured since Rana 2026 did not measure HLA-E), "
                    "and anti-CD64 Fab (preventing Fc-tagged probe confounding on CD64t+ cells)."
                ),
                "numeric_functional_and_safety_thresholds": (
                    "Titrate 0.1-1.5 mM LQS8% across n >= 3 primary human PBMC/NK donors and n >= 3 human sera on Stage-7 SC-islets and iECs. "
                    "Hard kill-switch if NO dose simultaneously achieves: (a) >= 50% reduction in human serum C3b deposition AND >= 50% reduction in "
                    "primary human PBMC/NK cytotoxicity vs matched sham-UW vehicle, (b) >= 85% retention of accessible CD47, HLA-E, and CD64t, "
                    "(c) dynamic perifusion GSIS >= 90% of matched sham-UW-treated Stage-7 SC-islet control, AND (d) exact-stack macrophage efferocytosis "
                    "debris-clearance guard (>= 80.0% abs, >= 70.0% WT)."
                ),
                "in_vivo_only_humoral_note": (
                    "Anti-LPG / anti-Q-tag (GQQQLGGGGG) IgG/IgM seroconversion is REMOVED from the in-vitro Stage-0 panel (vacuous in vitro) "
                    "and gated strictly on any future immunocompetent/humanized-mouse or NHP in-vivo arm if 28-C0 and 28-C1 both pass."
                ),
            },
        },
        "four_mandatory_veto_gates": [
            {
                "gate_id": "SIGLEC_VETO_1_CD47_AND_HLA_E_STERIC_MASKING_VS_EXPRESSION",
                "finding": "Rana 2026 PMC13668765 P[20]/P[23] & Fig. S20 observed progressively lower antibody-accessible CD47 and HLA-A,B,C signals on TNF-alpha-activated EA.hy926 cells across the protective 1.0-1.5 mM LQS8% dose window without resolving altered expression vs steric masking, and did NOT measure HLA-E.",
                "release_criterion": "Gate 28-C1 titration (0.1-1.5 mM) using Fc-silent/Fab probes proving >= 50% C3b reduction AND >= 50% PBMC/NK cytotoxicity reduction while retaining >= 85% accessible CD47, HLA-E, and CD64t without expression loss.",
            },
            {
                "gate_id": "SIGLEC_VETO_2_XENO_ENZYME_RHTGM2_4C_UW_FEASIBILITY_AND_QTAG_IMMUNOGENICITY",
                "finding": (
                    f"Protocol uses guinea-pig liver gtTGase (disallowed for Gate 28-C0 by DEC-120; GY-013 is cited strictly as "
                    f"xenogeneic-protein rationale because GY-013 governs catalase) plus synthetic Q-tag {qtag} "
                    f"({qtag_scan['k8_foreign_vs_20429_swissprot']}/{qtag_scan['k8_total']} absent 8-mers, "
                    f"{qtag_scan['k9_foreign_vs_20429_swissprot']}/{qtag_scan['k9_total']} absent 9-mers vs 20,429 human Swiss-Prot). "
                    f"Recombinant human TGM2 is tightly Ca2+-gated/GTP-inhibited and unproven at 4 C in UW buffer."
                ),
                "release_criterion": "Gate 28-C0 pre-cell biochemical proof of GMP rhTGM2 >= 50% ligation at 4 C in UW buffer (n >= 3 lots) + <= LOQ residual enzyme washout QC; anti-LPG/anti-Q-tag seroconversion gated in future in-vivo studies only.",
            },
            {
                "gate_id": "SIGLEC_VETO_3_ZERO_ISLET_GSIS_OR_ENDOCRINE_DATA",
                "finding": "PMC13668765 contains ZERO pancreatic islet, SC-islet, or GSIS data (exclusively vascular EA.hy926/HUVEC, mouse aorta, rat kidney).",
                "release_criterion": "Scope strictly as research comparator (preferentially on co-transplanted iEC vasculature) OR verify static + dynamic perifusion GSIS >= 90% of matched sham-UW-treated Stage-7 SC-islet control.",
            },
            {
                "gate_id": "SIGLEC_VETO_4_GENETIC_ST6GAL1_PERMANENTLY_BARRED_GY029",
                "finding": "Bhalerao et al. 2023 (JCI Insight; PMID:37643018, PMC10619436) is an oncogenic mouse GEMM / human PDAC xenograft result: (i) in KRASG12D GEMMs (KSC vs KC, n=10/group, P<0.0001), pancreatic ST6GAL1 OE cut median survival -68.4% (13.6 to 4.3 months, 3.16x shorter), with 5/9 adenocarcinoma and 6/9 metastases at 20 wk vs 0/9 KC; (ii) in nonmalignant WT-KRAS SC vs WT mice (wk20, n=3/group, Fig. 3D), ST6GAL1 upregulated EGFR (NES=2.22, FDR=0.003), MET (NES=2.04, FDR=0.010), and SOX9 networks; (iii) in human Suit2 PDAC xenografts (n=7/group), ST6GAL1 OE accelerated tumor growth/metastasis. Retained as a precautionary permanent disqualification without claiming a measured human graft cancer rate.",
                "release_criterion": "Assigned permanent Graveyard rule OFFGRID_GUARD_019_ECTOPIC_ST6GAL1_SIALYLTRANSFERASE_NONSPECIFIC_GLYCAN_REMODELING (GY-029; zero collision with CAND-034 GY-030): genetic ST6GAL1 overexpression is permanently barred in pancreatic/SC-islet grafts.",
            },
        ],
    }


# =============================================================================
# PART D — EXACT OQ-016 2^12 CORE 3-ARM & 2^20 5-ARM PORTFOLIO ODDS
# =============================================================================
def eval_5arm_generalized_exact(
    label: str,
    *,
    c1: float,
    pa: tuple[float, float, float, float],
    pb: tuple[float, float, float, float],
    px: tuple[float, float, float, float],
    p_y: tuple[float, float, float, float],
    p_d1: tuple[float, float, float, float],
    c2_abx: float = 0.87,
    c2_y: float = 0.87,
    c2_univ: float = 0.95,
    c2_auto: float = 0.93,
    c3_abx: float = 0.89,
    c3_y: float = 0.89,
    phi_yx: float = 0.75,
    phi_c: float = 0.25,
    c4_univ: float = 0.92,
    c4_r3: float = 0.85,
) -> dict[str, Any]:
    """
    Exact 2^20 (32-state per hurdle) 5-arm portfolio evaluator using OpenIslet's exact
    rank_islet1_stacks.py Fréchet primitives + registered-route-only DP kernel,
    with fail-closed domain, ceiling-ordering, nonnegativity, and event-ceiling validation
    (rejecting reversed nested H2/H3/H4 ceilings or negative probability masses via ValueError!).
    """
    tol = 1e-12
    all_scalars = [
        ("c1", c1), ("c2_abx", c2_abx), ("c2_y", c2_y), ("c2_univ", c2_univ), ("c2_auto", c2_auto),
        ("c3_abx", c3_abx), ("c3_y", c3_y), ("phi_yx", phi_yx), ("phi_c", phi_c), ("c4_univ", c4_univ), ("c4_r3", c4_r3),
    ]
    for nm, val in all_scalars:
        if not isinstance(val, (int, float)) or isinstance(val, bool) or not math.isfinite(val):
            raise ValueError(f"{label}: non-finite scalar {nm}={val!r}")
        if not (0.0 <= val <= 1.0):
            raise ValueError(f"{label}: scalar {nm}={val} outside [0, 1]")
    for nm in ("c1", "c2_abx", "c2_y", "c2_univ", "c2_auto", "c3_abx", "c3_y", "c4_univ", "c4_r3"):
        if dict(all_scalars)[nm] <= 0.0:
            raise ValueError(f"{label}: denominator ceiling {nm} must be > 0")
    arms = [pa, pb, px, p_y, p_d1]
    arm_names = ("pa", "pb", "px", "p_y", "p_d1")
    for anm, avec in zip(arm_names, arms):
        if len(avec) != 4:
            raise ValueError(f"{label}: arm {anm} must have 4 hurdle probabilities")
        for h_i, v in enumerate(avec):
            if not isinstance(v, (int, float)) or isinstance(v, bool) or not math.isfinite(v) or not (0.0 <= v <= 1.0):
                raise ValueError(f"{label}: arm {anm}[{h_i}]={v!r} outside finite [0, 1]")
    # Strict zero-tolerance ceiling-ordering & marginal-vs-ceiling checks (ZERO 1e-12 slack on impossible orderings!)
    if c2_abx > c2_y:
        raise ValueError(f"{label}: reversed nested H2 ceilings rejected (c2_abx={c2_abx} > c2_y={c2_y})")
    if c2_y > c2_univ or c2_auto > c2_univ:
        raise ValueError(f"{label}: H2 sub-ceiling exceeds c2_univ ({c2_y}, {c2_auto} vs {c2_univ})")
    if c3_abx > c3_y:
        raise ValueError(f"{label}: reversed nested H3 ceilings rejected (c3_abx={c3_abx} > c3_y={c3_y})")
    if c4_r3 > c4_univ or 0.85 > c4_univ:
        raise ValueError(f"{label}: H4 sub-ceiling exceeds c4_univ (c4_r3={c4_r3}, 0.85 vs c4_univ={c4_univ})")
    # Strict arm marginal vs ceiling checks (zero upward slack!)
    if any(v[0] != c1 for v in (pa, pb, px, p_y)) or p_d1[0] > c1:
        raise ValueError(f"{label}: H1 marginal violates c1={c1}")
    if any(v[1] > c2_abx for v in (pa, pb, px)) or p_y[1] > c2_y or p_d1[1] > c2_auto:
        raise ValueError(f"{label}: H2 marginal exceeds assigned ceiling")
    if any(v[2] > c3_abx for v in (pa, pb, px)) or p_y[2] > c3_y or p_d1[2] > c3_y:
        raise ValueError(f"{label}: H3 marginal exceeds assigned ceiling")
    if any(v[3] > 0.85 for v in (pa, pb, px)) or p_y[3] > c4_r3 or p_d1[3] > c4_r3:
        raise ValueError(f"{label}: H4 marginal exceeds assigned ceiling")

    # H1 (32 states: bit0=A, bit1=B, bit2=X, bit3=Y, bit4=D1b)
    u_d1 = p_d1[0] / c1
    d1 = [0.0] * 32
    d1[0] = 1.0 - c1
    d1[15] = c1 * (1.0 - u_d1)
    d1[31] = c1 * u_d1

    # H2
    d2_inc = rank_mod._frechet_bernoulli_joint_iip0034([pa[1] / c2_abx, pb[1] / c2_abx, px[1] / c2_abx], 0.0)
    r2 = c2_abx / c2_y
    u_y2 = p_y[1] / c2_y
    d2_both = rank_mod._frechet_couple_new_arm_iip0034(d2_inc, u_y2, phi_yx, lambda mi: bool(mi & 4))
    d2_allo4 = [0.0] * 16
    for k in range(16):
        d2_allo4[k] += r2 * d2_both[k]
    d2_allo4[0] += (1.0 - r2) * (1.0 - u_y2)
    d2_allo4[8] += (1.0 - r2) * u_y2