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…

    n6_one = [by_key[(6, p01, p10)]["exact_one_sided_power"] for (p01, p10) in corners]
    n16_one = [by_key[(16, p01, p10)]["exact_one_sided_power"] for (p01, p10) in corners]
    n24_one = [by_key[(24, p01, p10)]["exact_one_sided_power"] for (p01, p10) in corners]
    n24_null = [by_key[(24, p01, p10)]["matched_null_exact_type1_rate"] for (p01, p10) in corners]
    n29_one = [by_key[(29, p01, p10)]["exact_one_sided_power"] for (p01, p10) in corners]
    nuisance_24 = compute_mcnemar_nuisance_size_profile_iip_0028(24, alpha=0.05)
    phi_sweep = [
        compute_ab_frechet_dependence_2pow12_iip_0028(pa, pb, px, cv, phi_ab=w)
        for w in (0.0, 0.25, 0.50, 0.75, 1.0)
    ]
    bridge_unverified_ex = bridge_2x2_concordance_to_conditional_phi_ab_iip_0028(
        10, 1, 9, 4, common_shock_ceiling_c=0.87, b2_to_scored_b_hurdle_bridge_verified=False
    )
    bridge_verified_ex = bridge_2x2_concordance_to_conditional_phi_ab_iip_0028(
        14, 1, 5, 4, common_shock_ceiling_c=0.89, b2_to_scored_b_hurdle_bridge_verified=True
    )

    return {
        "proposal_id": "IIP-0028",
        "decision_id": "DEC-106",
        "headline_probabilities_invariant": True,
        "estimand_and_clustering_specification": {
            "discordance_01_direction": "Design A (ISLET1_A4_ARM1B) FAILS and staged ISLET1_B2_5LOCUS_BASE CLEARS on one prespecified primary donor-level composite immune outcome and conditioning history declared prior to enrollment",
            "discordance_10_direction": "Design A CLEARS and staged ISLET1_B2_5LOCUS_BASE FAILS on the same prespecified donor-level outcome and conditioning history",
            "feasibility_0_of_6_clopper_pearson_u95_pct": round(100.0 * clopper_pearson_u95_iip_0028(0, 6), 4),
            "feasibility_0_of_6_scope_note": "39.3038% one-sided 95% binomial upper bound applies strictly to one prespecified independent donor-level event",
            "crossed_design_clustering_rule": (
                "Primary McNemar inference treats each independent typed T1D responder donor block (1:1 paired Design A vs B2 Base) "
                "as the unit of analysis via prespecified within-donor aggregation; reusing donors, lots, sera, or wells across multiple "
                "pairs without donor-level collapse is prohibited unless analyzed with a preregistered clustered variance/power model."
            ),
            "assay_vs_hurdle_effect_size_scope_note": (
                "The 35-48 percentage-point discordant planning corners (p01 in [0.40, 0.50], p10 in [0.02, 0.05]) represent targeted "
                "KIR+/NKG2A- or DSA-stratified ex-vivo assay rescue contrasts, distinct from the portfolio tree's population-averaged "
                "hurdle marginal differences (+1 percentage point on H2: 0.79 vs 0.78; +7 percentage points on H3: 0.64 vs 0.57)."
            ),
        },
        "exact_conditional_mcnemar_summary": {
            "min_discordant_one_sided_pvalues": {
                "4_vs_0": round(exact_mcnemar_one_sided_pvalue_iip_0028(4, 0), 6),
                "5_vs_0": round(exact_mcnemar_one_sided_pvalue_iip_0028(5, 0), 6),
                "7_vs_1": round(exact_mcnemar_one_sided_pvalue_iip_0028(7, 1), 6),
            },
            "n6_one_sided_power_range_pct": [round(100.0 * min(n6_one), 2), round(100.0 * max(n6_one), 2)],
            "n16_one_sided_power_range_pct": [round(100.0 * min(n16_one), 2), round(100.0 * max(n16_one), 2)],
            "n24_one_sided_power_range_pct": [round(100.0 * min(n24_one), 2), round(100.0 * max(n24_one), 2)],
            "n24_matched_null_max_type1_pct": round(100.0 * max(n24_null), 2),
            "n24_global_nuisance_size_profile": nuisance_24,
            "n29_all_corners_ge_88pct": all(pw >= 0.88 for pw in n29_one),
            "corner_0p40_0p05_operating_points": {
                "n6_one_sided_pct": round(100.0 * by_key[(6, 0.40, 0.05)]["exact_one_sided_power"], 2),
                "n16_one_sided_pct": round(100.0 * by_key[(16, 0.40, 0.05)]["exact_one_sided_power"], 2),
                "n20_one_sided_pct": round(100.0 * by_key[(20, 0.40, 0.05)]["exact_one_sided_power"], 2),
                "n24_one_sided_pct": round(100.0 * by_key[(24, 0.40, 0.05)]["exact_one_sided_power"], 2),
                "n24_two_sided_pct": round(100.0 * by_key[(24, 0.40, 0.05)]["exact_two_sided_power"], 2),
                "n29_one_sided_pct": round(100.0 * by_key[(29, 0.40, 0.05)]["exact_one_sided_power"], 2),
                "n29_two_sided_pct": round(100.0 * by_key[(29, 0.40, 0.05)]["exact_two_sided_power"], 2),
            },
            "complete_30_cell_grid": grid_30,
        },
        "ab_frechet_conditional_dependence_2pow12_sweep": phi_sweep,
        "concordance_2x2_to_phi_ab_bridge_examples": {
            "assay_only_unbridged_example": bridge_unverified_ex,
            "verified_hurdle_bridge_example": bridge_verified_ex,
        },
    }


def _build_odds_composition_and_profile_scope_audit_iip_0003() -> dict:
    """Re-judged four-hurdle conditional scenario specification, score/rank measure labels, and OQ-016 (IIP-0003; reassessed 2026-11-16 after IIP-0016..IIP-0020)."""
    h1_a, h1_b, h1_x, h1_3 = 0.88, 0.88, 0.88, 0.88
    h2_a, h2_b, h2_x, h2_3 = 0.78, 0.79, 0.82, 0.87
    h3_a, h3_b, h3_x, h3_3 = 0.57, 0.64, 0.73, 0.86
    h4_a, h4_b, h4_x, h4_3 = 0.69, 0.70, 0.69, 0.80
    pa_exact = round(h1_a * h2_a * h3_a * h4_a, 8)
    pb_exact = round(h1_b * h2_b * h3_b * h4_b, 8)
    px_exact = round(h1_x * h2_x * h3_x * h4_x, 8)
    p3_exact = round(h1_3 * h2_3 * h3_3 * h4_3, 8)
    active_tree = compute_common_shock_2pow12_portfolio_tree(
        [h1_a, h2_a, h3_a, h4_a],
        [h1_b, h2_b, h3_b, h4_b],
        [h1_x, h2_x, h3_x, h4_x],
        [0.88, 0.87, 0.89, 0.85],
    )
    active_tree_fixed_c3_088 = compute_common_shock_2pow12_portfolio_tree(
        [h1_a, h2_a, h3_a, h4_a],
        [h1_b, h2_b, h3_b, h4_b],
        [h1_x, h2_x, h3_x, h4_x],
        [0.88, 0.87, 0.88, 0.85],
    )
    dec098_ref_tree = compute_common_shock_2pow12_portfolio_tree(
        [0.88, 0.78, 0.56, 0.68],
        [0.88, 0.79, 0.64, 0.70],
        [0.88, 0.81, 0.70, 0.68],
        [0.88, 0.87, 0.88, 0.85],
    )
    return {
        "proposal_id": "IIP-0003",
        "title": (
            "The published chance-of-working estimate does not compute the quantity it states, "
            "and omits failure modes the blueprint already documents"
        ),
        "layer": "Layer 1 & Cross-Blueprint Odds Specification",
        "open_question_id": "OQ-016",
        "open_question_title": "Which assumptions and definition of success sit behind the four-hurdle odds estimate?",
        "status": "accepted_in_open_draft",
        "initial_reassessment_date": "2026-11-05",
        "reassessment_date": "2026-11-16",
        "reassessment_basis_iips": ["IIP-0003", "IIP-0012", "IIP-0015", "IIP-0016", "IIP-0017", "IIP-0018", "IIP-0019", "IIP-0020"],
        "credit": (
            "Linus Schumacher (ORCID 0000-0003-0797-3406, GitHub @ljschumacher, University of Edinburgh), "
            "IIP-0003, https://github.com/openislet/openislet/issues/3."
        ),
        "sequential_conditional_definition": {
            "one_design_label": "Each design on its own (Designs A, B and X modelled head to head)",
            "one_design_rule": (
                "Defined under IIP-0003 on 2026-11-05 and reassessed on 2026-11-16 across all three blueprints (A, B and X) "
                "incorporating accepted Stage-0 computational designs (IIP-0016..IIP-0020): for any single design tested alone, "
                "each step is the judged chance that that design clears the hurdle given that it cleared the earlier hurdles."
            ),
            "three_designs_label": "Three designs in parallel (A, B and X)",
            "three_designs_rule": (
                "Defined under IIP-0003 on 2026-11-05 and reassessed on 2026-11-16 from the exact 4,096-state (2^12) joint "
                "common-shock tree as a sequential surviving-portfolio conditional judgement: for Designs A, B and X "
                "advanced in parallel, each step is the judged chance that at least one same design still in the running clears that hurdle "
                "(the same design must clear every hurdle so far)."
            ),
            "composition_rule": (
                "Chance of getting past every hurdle = hurdle 1 x hurdle 2 x hurdle 3 x hurdle 4, "
                "each the chance that a design still in the running clears it."
            ),
        },
        "selected_hurdle_scope_and_excluded_pre_trial_conditions": {
            "selection_basis": (
                "The four hurdles are a deliberate selection covering the four in-body biological steps that have published human or modelled anchors. "
                "They assume this product's cells work as designed and pass the lab safety checks before any trial, and layering new untested edits "
                "together can shift earlier human-anchored steps too, so none of these figures is a lab measurement or the chance of a cure."
            ),
            "condition_line_short": (
                "Assumes the edited cells work as designed and pass the lab safety and DNA checks before any trial."
            ),
            "assumed_passed_outside_the_four_hurdles": [
                {
                    "id": "GATE1_PRODUCT_FUNCTION",
                    "description": (
                        "Product-specific Gate 1 endocrine function: OpenIslet's own edited 60:30:10 cells retain regulated "
                        "glucose-stimulated insulin secretion and rapid low-glucose shut-off (Hurdle 1 scores the class-level "
                        "human stem-cell-islet precedent from zimislecel PMID:40544428; product-specific function and Stage-0 construct "
                        "qualification gates are stated conditions)."
                    ),
                },
                {
                    "id": "OQ-012",
                    "description": (
                        "Pre-trial safety-switch qualification: biallelic AAVS1 iCasp9 clonogenic escape bound <= 1.0e-8 across "
                        "endocrine and vascular stromal lineages under combined 1% O2 hypoxia and inflammatory cytokines."
                    ),
                },
                {
                    "id": "OQ-006",
                    "description": (
                        "Pre-trial edited-line genomic stability at manufacturing scale (rule GY-006): >=63,000x target-enriched "
                        "duplex sequencing for TP53/PPM1D/BCOR, Chr20q11.21 ddPCR, 15-25 kb long-read LOH phasing, and CAST-Seq translocation checks."
                    ),
                },
            ],
        },
        "reassessed_hurdles": [
            {
                "hurdle_number": 1,
                "title": "Do lab-grown islet cells work as a treatment in people? (Gate 1)",
                "one_design_design_a": h1_a,
                "one_design_design_b": h1_b,
                "one_design_design_x": h1_x,
                "three_designs_parallel": h1_3,
                "decision": "kept_at_0p88_after_2026_11_15_reassessment",
                "reason_for_three_design_figure": (
                    "All three designs use the same lab-grown stem-cell islet cells and 60:30:10 cell mix, "
                    "so trying three designs adds no second route on this shared class step."
                ),
            },
            {
                "hurdle_number": 2,
                "title": "Does the genetic cloak stop rejection without anti-rejection drugs? (Gates 2A and 3)",
                "one_design_design_a": h2_a,
                "one_design_design_b": h2_b,
                "one_design_design_x": h2_x,
                "three_designs_parallel": h2_3,
                "decision": "reassessed_2026_11_16_after_iip_0016_iip_0017_and_iip_0020",
                "reason_for_three_design_figure": (
                    "Design A retains the canonical B2M/CIITA + HLA-E(VMAPRTLVL) + CD47 cloak (78%), Design B keeps one matched HLA-C gene "
                    "cleared against a 22-species Swiss-Prot-subtracted peptide census (79%; IIP-0017), and Design X pairs the 20-construct S10 "
                    "HLA-E selectivity panel (IIP-0016) with anti-PEG / streptavidin-free human CFH+THBD+Hexa-FasL microgel cuff challengers and "
                    "PEG-free carrier fallback (82%; IIP-0020), yielding an 87% surviving-portfolio conditional pass rate (exact 2^12 conditional 86.95%)."
                ),
            },
            {
                "hurdle_number": 3,
                "title": "Can the cells survive the autoimmune attack that caused the diabetes? (Gates 2B and 4)",
                "one_design_design_a": h3_a,
                "one_design_design_b": h3_b,
                "one_design_design_x": h3_x,
                "three_designs_parallel": h3_3,
                "decision": "reassessed_2026_11_16_after_iip_0012_iip_0017_iip_0018_and_iip_0020",
                "reason_for_three_design_figure": (
                    "Design A pairs a scar-free (2A-free) SERPINB9 comparator with DPR-ring-hydrolyzed, primed-serum-gated microgel cuffs (57%; IIP-0012/0015/0018/0020), "
                    "Design B dampens interferon signalling via protective TYK2 p.Pro1104Ala (64%; IIP-0017), and Design X combines cell-intrinsic "
                    "IL1R1 + FAS knockdown (IIP-0018) with a streptavidin-free human CFH[19-448] + THBD[363-497]-Cys + H1a ADIPOQ-Hexa-FasL cuff challenger "
                    "against Day-28 step-up humoral opsonization (73%; IIP-0020, easing effective H3 common shock c_3 from 0.88 to 0.89), lifting the "
                    "surviving-portfolio conditional pass rate to 86% (exact 2^12 conditional 86.06%; uncalibrated computational scenario)."
                ),
            },
            {
                "hurdle_number": 4,
                "title": "Does the oxygen layer keep the graft alive until blood vessels grow in? (Gate 5 oxygen bridge)",
                "one_design_design_a": h4_a,
                "one_design_design_b": h4_b,
                "one_design_design_x": h4_x,
                "three_designs_parallel": h4_3,
                "decision": "reassessed_2026_11_16_after_iip_0019_and_iip_0020",
                "reason_for_three_design_figure": (
                    "Designs A and X pair ordered microwells, wet-sieved <= 50 um CaO2 beads and >= 20 um catalase barrier films (IIP-0019) with a "
                    "fail-closed Gate P05 species lock to recombinant human CAT (UniProt P04040, 0% foreign peptides vs 50.6-99.9% xeno-catalase, "
                    "<=30% Day-7 shed mass; 69%; IIP-0020), while Design B tests an orthogonal 140 um chemical-free Zero-CaO2 pre-vascularized sheet "
                    "comparator (Design Z track; 70%), yielding an 80% conditional pass rate among designs surviving Hurdles 1-3 (exact 2^12 conditional 79.87%)."
                ),
            },
        ],
        "multiplied_conditional_totals": {
            "one_design_exact": pa_exact,
            "one_design_rounded_pct": 27,
            "design_a_exact": pa_exact,
            "design_a_rounded_pct": 27,
            "design_b_exact": pb_exact,
            "design_b_rounded_pct": 31,
            "design_x_exact": px_exact,
            "design_x_rounded_pct": 36,
            "three_designs_exact": p3_exact,
            "rounded_hurdle_factor_product_label": "DEPRECATED_ROUNDED_HURDLE_FACTOR_PRODUCT_USE_EXACT_2POW12_TREE",
            "three_designs_rounded_pct": 53,
            "three_designs_2pow12_locked_exact": round(active_tree["locked_3slot_2pow12_exact"], 4),
            "three_designs_stage0_modular_cell_x_pouch_exact": round(active_tree["legacy_modular_3slot_cell_x_pouch_exact"], 4),
            "iip_0024_donor_bank_h1_sensitivity_audit": compute_donor_bank_h1_sensitivity_iip_0024(0.25),
            "iip_0028_paired_mcnemar_and_phi_ab_concordance_audit": compute_paired_mcnemar_and_phi_ab_concordance_audit_iip_0028(),
            "iip_0020_sensitivity_and_calibration_notes": {
                "uncalibrated_engineering_scenario": True,
                "locked_2pow12_exact_6dp": round(active_tree["locked_3slot_2pow12_exact"], 6),
                "locked_2pow12_at_fixed_universal_c3_0p88": round(active_tree_fixed_c3_088["locked_3slot_2pow12_exact"], 6),
                "stage0_modular_3slot_legacy_exact_6dp": round(active_tree["legacy_modular_3slot_cell_x_pouch_exact"], 6),
                "stage0_modular_2route_shared_ax_pouch_exact_6dp": round(active_tree["modular_2route_shared_ax_pouch_exact"], 6),