OpenIslet

scripts/rank_islet1_stacks.py

Step 5 & 6: Project Islet-1 Sign-Sensitive, Endpoint-Oriented & Locus-Penalized Evaluator (v0.6.9).

script Release v0.8.0 gen-eb955f8266035aba 638 KB · 42 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/rank_islet1_stacks.py · SHA-256: c05d5fe606219e88…

                            "stage0_gate_0d_indirect_apc_co_primary_assay": (
                                "Freeze-thawed / cytokine-stressed SC-islet lysate, isolated Stage-7 SC-islet secretory exosomes (Cianciaruso et al. 2017 PMID:27872147), and synthetic HLA-E/HLA-C SCT (G4S)3-4 linker-junction peptides "
                                "(with semi-direct intact-exosome MHC cross-dressing controls and a project-defined Stage-0 Gate 0d 2.0 ug/mL exogenous human beta2m W6/32 + CD8+ CTL challenge grounded in Vitiello et al. 1990 PMID:2124002, Rock et al. 1991 PMID:1986378, Bix & Raulet 1992 PMID:1512546, and Demaria et al. 1994 PMID:8120026, alongside HIP-DQ8 controls per Bhattacharjee et al. 2024 PMID:39554513) co-cultured with primary HLA-DQ2+, HLA-DQ8+, and HLA-DR4+ human monocyte-derived dendritic cells and macrophages "
                                "and insulin-B:9-23 / HIP-reactive and recipient polyclonal CD4+ T-cell responder lines across both active SA-FasL (100-150 ng/uL) + SA-THBD microgels (ARM3_CONTINUOUSLY_ACTIVE; Lei et al. 2022 Sci Adv PMID:35559682) and the blocked three-history post-adjunct-depletion sibling-aliquot rechallenge (ARM1_NEVER_CONDITIONED vs ARM2_CONDITIONED_DEPLETED vs ARM3_CONTINUOUSLY_ACTIVE; Headen et al. 2018 PMID:29867165; IIP-0012 / DEC-091), "
                                "requiring CD4+ T-cell proliferation Stimulation Index SI <= 1.5, IFN-gamma ELISpot/ELISA SI <= 2.0, >= 80% FasL-mediated apoptosis of activated CD25+CD95+ effector CD4+ T cells in active Arm 3 (exempted on verified functionally depleted Arm 2, which requires verified bound+supernatant SA-FasL/SA-THBD bioactivity depletion, declared SA-FHL-1 status, non-pooled decay vs washout modes, separated retained vs fresh responder histories and MHC-II CD4+ vs MHC-I CD8+ cross-presentation readouts, viable beta recovery >= 85%, 20% NHS C5b-9 <= 5.0%, and perifusion GSIS SI >= 2.5), "
                                "transwell bystander SC-beta Annexin-V+ apoptosis <= 15%, and full-evidence Stage-0 promotion gating (AUDIT-REF, AUDIT-REF, AUDIT-REF, L2B-NUM-02 & IIP-0012 [DEC-044/DEC-045/DEC-046/DEC-078/DEC-091])."
                            ),
                        },
                    },
                },
            },
            "tier2_radical_outside_the_box_wildcards_20pct_focus": {
                "Y_Radical_ZeroDSB_and_Active_Indirect_Cloak_Wildcard": {
                    "slot": "Y",
                    "role": "Radical Biology & Genome Engineering Wildcard within shared <= 20% Y/Z Stage-0 allocation (unscored; zero change to core Blueprints A/B/X; IIP-0023 / DEC-102)",
                    "wildcard_comparator_fasta": "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta",
                    "wildcard_comparator_fasta_sha256": "c7f54b824a73cf9d40247d4fd251cb5c28a8eca4a1530b9661284200bb4cbabc",
                    "architecture_summary": (
                        "No-intended-exposed-DSB, AAV-free clonal hPSC landing-pad candidate (two-step eePASSIGE polarity: 73-bp B2M Exon-1 TwinPE excision -> 52-bp attP in genome + "
                        "backbone-free 11,066-bp 7-cistron 0x-2A DESIGN_Y_CORE_CD200_IEC attB-minicircle [or 11,859-bp +CD59 and 12,555-bp CD39 comparators], paired head-to-head with "
                        "2-locus SpCas9-NGG TadCBEd [CIITA Exon 10 p.W334* / Exon 2 p.Q53* on NM_001286402.1 + CXCL10 p.M1I, requiring full C>T + A>G + indel haplotype NGS per PMID:36357719] "
                        "vs CRISPRoff [reconciling 201-bp CIITA-pIV TSS CGI Obs/Exp=0.7982 vs 601-bp 0.5154 and non-CGI CXCL10 Obs/Exp=0.1520; PMID:33838111], while auditing paired-nick "
                        "DSB intermediates, pseudo-site integration, and 7-unit transcriptional supercoiling; PMID:38858586, PMID:42749803, PMID:23416946)"
                    ),
                    "stage0_quantitative_kill_gates_muse_r1": [
                        "Y-01 (60-Day Pan-Lineage Classical HLA-A/B/C, HLA-II & CXCL10 Silence + TadCBEd Haplotype Gate): Across >= 60-day total culture/challenge age (>= 35-day differentiation + >= 14-day IFN-gamma/TNF-alpha/IL-1beta + hypoxia across beta, alpha, delta, and CDH5+ iEC lineages, >= 10,000 cells/lineage), classical HLA-A/B/C (excluding intentional HLA-E SCT), HLA-DR/DP/DQ, and CXCL10 protein escape upper95 <= 1.0%, full TadCBEd C>T + A>G (ruling out CAG->TGG Trp rescue) + indel haplotype verification with rhAmpSeq off-target upper95 <= 0.10% (or >= 90% CpG methylation if CRISPRoff comparator is run), and CAST-Seq < 1e-5",
                        "Y-02 (eePASSIGE attP-in-Genome Homozygous Clonal Fidelity Gate): Prospective Stage-0 hPSC pre-enrichment knock-in target lower95 >= 3.0% (explicitly separated from Pandey et al. 2025 PMID:38858586 experimental contexts), clonal ddPCR CN 95% CI in [1.90, 2.10], phased homologous 15-25 kb ONT >= 99.0% intactness with residual WT B2M allele fraction upper95 <= 0.001, bacterial kanR/ori VAF upper95 <= 0.0001, observed k = 0 pseudo-site insertions across OT1/OT2/OT4 and callable long-read WGS, and duplex TP53/PPM1D/BCOR VAF < 1e-4",
                        "Y-03 (Human ADORA1/ADORA2A Paracrine Physics & hCDH5 + 4x miR-375 CD200 Gate): Replaces rodent A1/A3 carryover with human islet Gi-ADORA1 (inhibiting GSIS) and Gs-ADORA2A (promoting glucagon; PMID:42660457, PMID:38879678, PMID:42791925; source-flux lambda_ADO = 20-118 um across 5-20 um iEC-beta gaps), requiring iEC:SC-beta CD200 ratio lower95 >= 50.0, beta AGO2 miR-375 retention >= 90.0% (PMID:35297680), 100 uM AMP/ATP co-culture coupon GSIS SI >= 2.5 (preserving full-product Readout 2 SI >= 3.0) and >= 90.0% retention, supernatant adenosine <= 25.0 nM, and 100 nM / 1 uM DPCPX GSIS shift <= 10.0%",
                        "Y-04 (60-Day 7-Unit Co-Expression, Complement, CD200R1/KIR+ Immune & Tier-6B 3e8 Clonogenic Escape Gate): At >= 60 days across all 4 lineages (GY-009), single-cell 5-cloak SC-beta and 6-cloak CDH5+ iEC co-positivity lower95 >= 95.0%, 20% NHS C5b-9 <= 5.0%, indirect HLA-DQ2/DQ8 APC CD4 SI <= 1.5 with anti-CD200 reversal check (PMID:40251154) plus NKG2A- KIR+ primary NK lysis upper95 <= 8.0%, and k = 0 clonogenic survivors across N_eff = N * f_clonogenic * eta >= 299,573,228 (exact Poisson upper95 <= 1.0e-8) under 10 nM AP1903 + 1% O2 + cytokines",
                    ],
                },
                "Z_Radical_ZeroCaO2_Microvascular_Ribbon_Wildcard": {
                    "slot": "Z",
                    "role": "Radical Biophysical & Vascular Niche Wildcard competing to dethrone X as #1 Contender",
                    "architecture_summary": (
                        "Zero-CaO2, zero-H2O2, zero-alkali pleated microvascular ribbon (<=120 um total thickness, L_half = 60 um <= passive Krogh limit) "
                        "housing <=80 um tri-hormonal micro-islets with 10% v/v perfluorooctyl bromide (PFOB) passive oxygen-shuttle nanoemulsion "
                        "(20x aqueous O2 solubility without chemical hydrolysis, equilibrium storage capacity alpha_eff/alpha_aq = 2.90x, steady-state partial-pressure Maxwell-Garnett permeability P_eff/P_aq = 1.2836x at D_PFC=D_aq [bounded above by 4/3 = 1.3333x as r->inf vs 6/7 = 0.8571x for impermeable spheres], apparent concentration diffusivity D_app/D_aq = 0.4426x; AUDIT-REF) and pre-inosculated iEC:iPericyte vascular cords (target t_50 <= 24 h)"
                    ),
                    "stage0_quantitative_kill_gates_muse_r1": [
                        "Z-01 (Permeation, Storage Capacity & Emulsion Stability Coupon): Steady-state partial-pressure Maxwell-Garnett permeability P_eff/P_aq in [1.20x, 1.33x] (1.2836x at D_PFC=D_aq, phi=0.10, K_p=20) with equilibrium O2 storage capacity alpha_eff/alpha_aq = 2.90x and DLS droplet Z-average <= 220 nm with <10% Ostwald ripening over 14 days at 37 C (AUDIT-REF)",
                        "Z-02 (72-h Hypoxic Chamber Survival Without CaO2): Under pO2_ext = 25 mmHg and 0 mg CaO2, 80 um micro-islet core pO2 >= 5.0 mmHg, cell viability >= 90%, and perifusion SI >= 2.5",
                        "Z-03 (PFOB Innate Macrophage & Complement Screen): Primary human macrophage IL-1beta/TNF-alpha and serum C3a/C5a generation <=1.5x blank clinical-grade alginate/PEG hydrogel",
                        "Z-04 (Microfluidic Inosculation Kinetics): Perfusable iEC + pericyte microvascular lumen anastomosis within t_50 <= 24-36 h",
                    ],
                },
            },
            "q5_dual_clock_governance_and_screen_confirm_firewall_sonnet55_r1": {
                "d1_d2_screen_confirm_firewall_q5_p1": (
                    "Stage-0 / Stage-1 HIP-Core (Runs 01-36 / 01-40) is strictly a Discovery Screen (Dataset D1) used to select a single locked "
                    "winner genotype G*; promotion to IND-enabling GLP studies requires an independent Confirmatory Cohort (Dataset D2: n >= 6 new "
                    "independent differentiation batches x n >= 6 unseen HLA/KIR/SIRPA-typed human immune donors, exact one-sided binomial/t gate "
                    "with zero post-hoc tuning; AUDIT-REF)."
                ),
                "quantitative_tournament_promotion_and_budget_firewall_rules_muse_r1": {
                    "promotion_posterior_superiority_rule": (
                        "A contender (X displacing A/B, or Y/Z displacing X) must demonstrate a pre-registered Bayesian posterior superiority probability "
                        "P(Delta_primary >= +5.0 pp | D2) > 0.95 on its target bottleneck gate on the unseen Confirmatory Cohort D2 while satisfying "
                        "a strict -3.0 pp non-inferiority margin across all other co-primary gates (GSIS SI, core pO2, HDR yield, genomic safety, and iCasp9 >=99.9% lethality)."
                    ),
                    "quarterly_slot_freeze_cadence": "Wildcard slots Y and Z are frozen on a quarterly review cadence; literature-only proposals cannot overwrite X without wet-lab Stage-0 kill-coupon clearance.",
                    "wildcard_budget_and_fte_cap": "Strict <=20% bench-capacity and experimental-run firewall on Tier-2 wildcards (Y/Z) so >=80% of Stage-0 bench capacity remains locked on the A/B/X execution triad.",
                    "canine_track_stage_gate_dependency": "No in vivo client-owned diabetic dog study proceeds until (1) human D1 winner lock G* is achieved and (2) the in vitro Canine Homology Gate (DLA-88/CD94-NKG2A + canine CD47/SIRPa KD <= 2.0 uM + <=10% canine PBMC killing) passes.",
                },
                "dual_clock_timeline_and_budget_envelope_q5_p2": {
                    "optimistic_parallel_fast_track_clock": "2026-2030 (parallelized Stage 0-1 bench and validation critical path)",
                    "conservative_sequential_risk_adjusted_clock": "54-78 months (sequential Stage 0-1 validation through Phase I/IIa FIH)",
                },
                "canine_dla88_cd47_sirpa_homology_gate_q5_p4": (
                    "Before initiating the client-owned diabetic dog veterinary track, require an in vitro Canine Homology Gate: "
                    "(1) SPR + flow verification that canine DLA-88 leader/SCT engages canine CD94/NKG2A and canine CD47-IgV-GPI binds canine SIRPa "
                    "with KD <= 2.0 uM (and zero human SIRPa xeno-incompatibility), and (2) canine PBMC/NK/macrophage killing <=10%."
                ),
            },
        },
    }

    return champion_challenger_portfolio



# =============================================================================
# IIP-0034 (DEC-113): Compatibility-Constrained Baseline-Invariant
# 2^(4N) Multi-Paradigm Portfolio Evaluator with Full 4,096-State Incumbent Parity
# (Emits data/extracted/islet1_multiparadigm_portfolio_v0.8.0.json; preserves live
# 3x2 OQ-016 headline odds +0.00 pp & Pareto SHA-256 bit-for-bit!)
# =============================================================================
ALLOWED_CELL_ROUTE_PAIRS_IIP0034: dict[str, frozenset[str]] = {
    'UNHARDENED_A_B_X': frozenset({'R1', 'R2'}),
    'UNEDITED_AUTO_NEGATIVE_CONTROL': frozenset({'R1', 'R2'}),
    'DESIGN_Y_FULLSTACK_V2': frozenset({'R3P'}),
    'DESIGN_Y_HYPOTHETICAL_R2_COUNTERFACTUAL': frozenset({'R1', 'R2'}),
    'D1B_AUTO_C_V2': frozenset({'R1', 'R2', 'R3P'}),
}


def _bivariate_bernoulli_iip0034(p1: float, p2: float, phi: float) -> dict[tuple[int, int], float]:
    """Exact marginal-preserving Frechet-Hoeffding mixture between independence (phi=0) & comonotonicity (phi=1)."""
    for nm, val in (("p1", p1), ("p2", p2), ("phi", phi)):
        if isinstance(val, bool) or not isinstance(val, (int, float)) or not math.isfinite(float(val)):
            raise ValueError(f"Non-finite bivariate Bernoulli parameter {nm}={val!r}")
    if not (0.0 <= p1 <= 1.0 + 1e-12 and 0.0 <= p2 <= 1.0 + 1e-12 and 0.0 <= phi <= 1.0):
        raise ValueError(f"Invalid bivariate Bernoulli parameters: p1={p1}, p2={p2}, phi={phi}")
    p1 = min(1.0, max(0.0, p1))
    p2 = min(1.0, max(0.0, p2))
    p11 = (1.0 - phi) * (p1 * p2) + phi * min(p1, p2)
    p10 = p1 - p11
    p01 = p2 - p11
    p00 = 1.0 - p1 - p2 + p11
    out = {(0, 0): p00, (1, 0): p10, (0, 1): p01, (1, 1): p11}
    if any(not math.isfinite(v) or v < -1e-12 for v in out.values()):
        raise ValueError(f"Invalid bivariate probability mass: {out}")
    return {k: max(0.0, v) for k, v in out.items()}


def _frechet_bernoulli_joint_iip0034(probs: list[float] | tuple[float, ...], phi: float) -> list[float]:
    """Exact marginal-preserving Frechet-Hoeffding mixture for m Bernoullis (phi=0 ind, phi=1 comonotonic)."""
    if isinstance(phi, bool) or not isinstance(phi, (int, float)) or not math.isfinite(float(phi)) or not (0.0 <= phi <= 1.0):
        raise ValueError(f"Invalid Frechet phi={phi!r}")
    for p in probs:
        if isinstance(p, bool) or not isinstance(p, (int, float)) or not math.isfinite(float(p)) or not (0.0 <= p <= 1.0 + 1e-12):
            raise ValueError(f"Invalid Bernoulli marginal probability={p!r}")
    m = len(probs)
    n_states = 1 << m
    d_ind = [0.0] * n_states
    for mask in range(n_states):
        w = 1.0
        for i in range(m):
            w *= probs[i] if (mask & (1 << i)) else (1.0 - probs[i])
        d_ind[mask] = w
    if phi == 0.0:
        return d_ind
    order = sorted(range(m), key=lambda i: probs[i])
    d_pos = [0.0] * n_states
    prev = 0.0
    for idx, i in enumerate(order):
        w = probs[i] - prev
        if w > 0.0:
            mask = sum(1 << j for j in order[idx:])
            d_pos[mask] += w
        prev = probs[i]
    d_pos[0] += 1.0 - prev
    return [(1.0 - phi) * d_ind[s] + phi * d_pos[s] for s in range(n_states)]


def _frechet_couple_new_arm_iip0034(
    inc_dist_cond: list[float] | tuple[float, ...],
    u_new: float,
    phi_couple: float,
    target_mask_fn,
) -> list[float]:
    """Exact marginal- and incumbent-joint-preserving Frechet coupling of 1 new arm (bit m0) to event E(inc)."""
    if not all(isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(float(v)) and v >= -1e-12 for v in inc_dist_cond):
        raise ValueError("Non-finite or negative mass in inc_dist_cond")
    if isinstance(u_new, bool) or not isinstance(u_new, (int, float)) or not math.isfinite(float(u_new)):
        raise ValueError(f"Non-finite u_new={u_new!r}")
    if isinstance(phi_couple, bool) or not isinstance(phi_couple, (int, float)) or not math.isfinite(float(phi_couple)) or not (0.0 <= phi_couple <= 1.0):
        raise ValueError(f"Invalid phi_couple={phi_couple!r}")
    n0 = len(inc_dist_cond)
    u_new = min(1.0, max(0.0, u_new))
    p_e1 = sum(inc_dist_cond[mi] for mi in range(n0) if target_mask_fn(mi))
    p_e0 = 1.0 - p_e1

    d_ind = [0.0] * (2 * n0)
    for mi in range(n0):
        d_ind[mi] = inc_dist_cond[mi] * (1.0 - u_new)
        d_ind[mi | n0] = inc_dist_cond[mi] * u_new

    d_pos = [0.0] * (2 * n0)
    p_11 = min(p_e1, u_new)
    p_10 = p_e1 - p_11
    p_01 = max(0.0, u_new - p_e1)
    p_00 = p_e0 - p_01
    for mi in range(n0):
        w = inc_dist_cond[mi]
        if w == 0.0:
            continue
        if target_mask_fn(mi):
            frac = w / p_e1
            d_pos[mi] = p_10 * frac
            d_pos[mi | n0] = p_11 * frac
        else:
            frac = w / p_e0
            d_pos[mi] = p_00 * frac
            d_pos[mi | n0] = p_01 * frac

    out = [(1.0 - phi_couple) * d_ind[k] + phi_couple * d_pos[k] for k in range(2 * n0)]
    if any(not math.isfinite(v) or v < -1e-12 for v in out) or abs(sum(out) - 1.0) >= 1e-12:
        raise ValueError("Coupled distribution failed finiteness/normalization check")
    for mi in range(n0):
        if abs((out[mi] + out[mi | n0]) - inc_dist_cond[mi]) >= 1e-12:
            raise ValueError("Coupled distribution broke incumbent joint invariance")
    rec_new = sum(out[k] for k in range(2 * n0) if (k & n0))
    if abs(rec_new - u_new) >= 1e-12:
        raise ValueError("Coupled distribution failed new-arm marginal check")
    return out


def _live_incumbent_h4_cond_iip0034() -> list[float]:
    """Exact live {A, B, X} conditional H4 distribution given U_pouch=1 (prob 0.85): R1=(A,X) comonotonic, R2=(B) ind."""
    u_r1 = 0.69 / 0.85
    u_r2 = 0.70 / 0.85
    d4_inc = [0.0] * 8
    d4_inc[0] = (1.0 - u_r1) * (1.0 - u_r2)
    d4_inc[2] = (1.0 - u_r1) * u_r2
    d4_inc[5] = u_r1 * (1.0 - u_r2)
    d4_inc[7] = u_r1 * u_r2
    return d4_inc


def _live_canonical_incumbent_dists_iip0034() -> list[list[float]]:
    """Exact canonical 8-state distributions across H1..H4 defining the live 4,096-state {A, B, X} joint tree."""
    pa = (0.88, 0.78, 0.57, 0.69)
    pb = (0.88, 0.79, 0.64, 0.70)
    px = (0.88, 0.82, 0.73, 0.69)
    d1 = [0.0] * 8
    d1[0] = 0.12
    d1[7] = 0.88
    d2_c = _frechet_bernoulli_joint_iip0034([pa[1] / 0.87, pb[1] / 0.87, px[1] / 0.87], 0.0)
    d2 = [0.0] * 8
    d2[0] = 0.13
    for m in range(8):
        d2[m] += 0.87 * d2_c[m]
    d3_c = _frechet_bernoulli_joint_iip0034([pa[2] / 0.89, pb[2] / 0.89, px[2] / 0.89], 0.0)
    d3 = [0.0] * 8
    d3[0] = 0.11
    for m in range(8):
        d3[m] += 0.89 * d3_c[m]
    d4_c = _live_incumbent_h4_cond_iip0034()
    d4 = [0.0] * 8
    d4[0] = 0.15
    for m in range(8):
        d4[m] += 0.85 * d4_c[m]
    return [d1, d2, d3, d4]


def _run_dp_and_verify_parity_iip0034(
    label: str,
    arms: list[tuple[float, float, float, float]],