#!/usr/bin/env python3
"""
Layer 2: Single-Cell Perturbation & Regulatory Sequence Plane (v0.8.0)
======================================================================
Performs deterministic regulatory sequence grammar analysis, background-calibrated
JASPAR log-odds PWM motif scanning, quarantined archival-table metadata (no authenticated AVI model predictions),
authentic non-overlapping GRCh38 homology-arm & GenBank regulatory-element construct
assembly, translated/processed polypeptide ledger verification, and data-driven
Stage 0->7 Monte Carlo perturbation modeling across all 6 HIP-Core factors (X1..X6),
Scenario A (Arm 1A vs Arm 1B), Scenario B (HLA-C + TYK2 P1104A vs TYK2-/-), and
cadaveric UP421 benchmarks.

Outputs:
  - data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta
  - data/extracted/layer2_regulatory_and_perturbation_atlas.json
"""

from __future__ import annotations

import hashlib
import json
import math
import random
import re
import copy
import difflib
import sys
from collections import Counter
from pathlib import Path
from typing import Any, Dict, List, Optional, Set, Tuple

REPO_ROOT = Path(__file__).resolve().parents[1]
if str(REPO_ROOT) not in sys.path:
    sys.path.insert(0, str(REPO_ROOT))
from scripts.product_contract import get_product_definition
REF_PATH = REPO_ROOT / "data" / "raw" / "layer2_genomic_and_jaspar_reference.json"
AVI_ARCHIVE_PATH = REPO_ROOT / "data" / "raw" / "alphagenome_avi_3118_snvs_full_archive.json"
AVI_SEED_PATH = REPO_ROOT / "data" / "raw" / "alphagenome_avi_26_seed_anchors.json"
RING1_EFFECTS_PATH = REPO_ROOT / "data" / "extracted" / "ring1_atomic_effects_v0.5.jsonl"
FASTA_OUT = REPO_ROOT / "data" / "constructs" / "islet1_scenario_a_constructs_v0.7.0.fasta"
ATLAS_OUT = REPO_ROOT / "data" / "extracted" / "layer2_regulatory_and_perturbation_atlas.json"

AAV6_PACKAGING_LIMIT_BP = 4700
AAV2_TWO_ITRS_LENGTH_BP = 290  # 2 x 145 bp AAV2 inverted terminal repeats

# Human-optimized codon table avoiding canonical GTAAGT/GTGAGT splice donors and AATAAA/ATTAAA hexamers
CODON_TABLE = {
    "A": "GCC",
    "C": "TGC",
    "D": "GAC",
    "E": "GAG",
    "F": "TTC",
    "G": "GGC",
    "H": "CAC",
    "I": "ATC",
    "K": "AAG",
    "L": "CTG",
    "M": "ATG",
    "N": "AAC",
    "P": "CCC",
    "Q": "CAG",
    "R": "AGA",
    "S": "AGC",
    "T": "ACC",
    "V": "GTG",
    "W": "TGG",
    "Y": "TAC",
    "*": "TGA",
}

GENETIC_CODE = {
    "TTT": "F", "TTC": "F", "TTA": "L", "TTG": "L",
    "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L",
    "ATT": "I", "ATC": "I", "ATA": "I", "ATG": "M",
    "GTT": "V", "GTC": "V", "GTA": "V", "GTG": "V",
    "TCT": "S", "TCC": "S", "TCA": "S", "TCG": "S",
    "CCT": "P", "CCC": "P", "CCA": "P", "CCG": "P",
    "ACT": "T", "ACC": "T", "ACA": "T", "ACG": "T",
    "GCT": "A", "GCC": "A", "GCA": "A", "GCG": "A",
    "TAT": "Y", "TAC": "Y", "TAA": "*", "TAG": "*",
    "CAT": "H", "CAC": "H", "CAA": "Q", "CAG": "Q",
    "AAT": "N", "AAC": "N", "AAA": "K", "AAG": "K",
    "GAT": "D", "GAC": "D", "GAA": "E", "GAG": "E",
    "TGT": "C", "TGC": "C", "TGA": "*", "TGG": "W",
    "CGT": "R", "CGC": "R", "CGA": "R", "CGG": "R",
    "AGT": "S", "AGC": "S", "AGA": "R", "AGG": "R",
    "GGT": "G", "GGC": "G", "GGA": "G", "GGG": "G",
}

COMPLEMENT = str.maketrans("ACGTacgt", "TGCAtgca")

# Frozen native sequence identities for the four v0.7.0 reference donors. These
# match UniProt REST records checked on 2026-10-26; a new biological sequence
# requires a separately reviewed reference contract, not resealed local hashes.
REFERENCE_UNIPROT_SEQUENCE_SHA256 = {
    "P61769": "c319ce623de7d59e9e73c6daf7ec603d5e5ed48358f54b97d1eccdc3c9bf693b",
    "P13747": "c44ad4cd8d5338b0dfd0c9e1bf242e7a650b209b7af90aaf304e9f8a95f43903",
    "Q08722": "caa66c8069880514fd225b7c8673a1f4877dbfc3e15d10e69400cb453a226918",
    "P08174": "989a894cc61bee9971c93b7be051d4d3718d7955ce6e3bb5f2d157377072f96f",
    "P50453": "5941182405e96639c6b0faccdeee7b72d773cd2ab67405bb49143592bebc6567",
    "Q9NZQ7": "b1b17c7fca3cbab15bc66b90bd4c07f73617cb5a03db105b0a38084fe7bca48b",
    "P55211": "4abebcd6fb389b5c4032e147846f854685da6000c7028e0622e8a1612a03006c",
}
FKBP12_F36V_REFERENCE_AA = (
    "MGVQVETISPGDGRTFPKRGQTCVVHYTGMLEDGKKVDSSRDRNKPFKFMLGKQEVIRGWEEGVAQMSVGQRAKLTISPDYAYGATGHPGIIPPHATLVFDVELLKLE"
)
# Precursor pins also let a source-free Layer-3 replay validate the fixed donor
# contract without adding an undeclared dependency on the private raw registry.
REFERENCE_CODING_MODULE_SHA256 = {
    "HLAE_": "a55d6e121d4528648c606fab355bf63a701581116f04898af5249bbdbefe8177",
    "CD47_": "14c634833d8775819193419862c3950d6f54395c0e696d75748a0d06c3f767b3",
    "SERPINB9_": "5941182405e96639c6b0faccdeee7b72d773cd2ab67405bb49143592bebc6567",
    "PDL1_": "b1b17c7fca3cbab15bc66b90bd4c07f73617cb5a03db105b0a38084fe7bca48b",
    "iCasp9_": "9c658142531fb4fbad7b80d7c94d412118e2a878122ab6795bbac88035e836de",
    "GSG_P2A_": "e806ad4825f52e7cb20f76a0d30b20726f1195b96951f4037b298eefb4678fbe",
}
# These pins identify the existing engineered noncoding parts, not native
# authenticity or regulatory function. cHS4/WPRE/UCOE qualifications stay open.
REFERENCE_REGULATORY_PART_SHA256 = {
    "CBX3_A2UCOE_455bp_exact": "6a4a4ad89dc417532b4066c02f8ff660a30706d7e56691e1d376cfb72e79b0d9",
    "Chimeric_Intron_133bp": "a46bca743cba139b9cef7954e012f8ddf4b0609d56c47a5bb91d51d78dff58fb",
    "EEF1A1_core_promoter_230bp": "442aed90cfa20b0191ffeb9037d6016484b960efa959fb571504d02f66fc0745",
    "EEF1A1_core_promoter_230bp_antisense": "6c4b15213b228123bb51d8a26ddb45bd70bcf9f6b3cc67515e530885bd977808",
    "Kozak_9bp": "cf9f348bff321c0460f13f1a1fc4a193a633bd5532ab1676b2c2b77f01c0927f",
    "Kozak_9bp_antisense": "af1f38a376b2eadf7e730edd35940b6f843bd455fd23420d396675f8daec7185",
    "Kozak_9bp_sense": "cf9f348bff321c0460f13f1a1fc4a193a633bd5532ab1676b2c2b77f01c0927f",
    "SV40_late_polyA_122bp": "1e40252e8e5ff79ec2bbb84173ff4ff7e91623f30aef1666051ee98f6c8bc104",
    "SV40_late_polyA_122bp_antisense": "10ebd192b4edc8d91605d14f01d4edc42593a86406870c7d4088bdaa9f6435b9",
    "Syn_5xISRE_minP_148bp_sense": "03ec65848c93e23b8f5e830507c03a955b7e3c2fdce6c5e6c49ad06ad1afa759",
    "WPREmut6_589bp": "48fc761bd6537412375cbc56540b431a5d4206c72253177bd9f0223193703147",
    "bGH_polyA_225bp": "b63940ada3015ada7b956ccad4248b484fdd4a9ab43f6573d9bd6a76a5a492d7",
    "bGH_polyA_225bp_sense": "b63940ada3015ada7b956ccad4248b484fdd4a9ab43f6573d9bd6a76a5a492d7",
    "cHS4_core_insulator_250bp": "e75bdfa12a3b96c7a3611daf366d05bff61905e45f6433667f74feccfe38e357",
}
# All eight intervals and strand-specific sequences matched Ensembl GRCh38
# REST on 2026-10-26. The pin must not be supplied by the input it authenticates.
REFERENCE_HOMOLOGY_REGISTRY_SHA256 = "36c4f0ae286cb2f6421a99ee1126a9f66f175b12f91395f86d3d539079a456f2"


def revcomp(seq: str) -> str:
    return str(seq).upper().translate(COMPLEMENT)[::-1]


def sha256_str(s: str) -> str:
    return hashlib.sha256(s.encode("utf-8")).hexdigest()


def validated_reference_coding_modules(ref: Dict[str, Any]) -> Dict[str, str]:
    """Bind named precursor identities before applying expected processing slices.

    Native sequence identity supports the declared reference calculation; it
    does not establish signal cleavage, GPI attachment or 2A skipping in cells.
    """
    proteins = ref.get("uniprot_protein_sequences")
    if not isinstance(proteins, dict):
        raise ValueError("Reference UniProt protein records are required")
    native = {}
    for accession, digest in REFERENCE_UNIPROT_SEQUENCE_SHA256.items():
        entry = proteins.get(accession)
        sequence = entry.get("sequence") if isinstance(entry, dict) else None
        if (not isinstance(sequence, str) or sha256_str(sequence) != digest
                or entry.get("uniprot_id") != accession
                or type(entry.get("length_aa")) is not int or entry["length_aa"] != len(sequence)):
            raise ValueError(f"Native protein differs from the frozen reference identity: {accession}")
        native[accession] = sequence
    return {
        "HLAE_": (native["P61769"][:20] + "VMAPRTLVL" + "GGGGS" * 3
                  + native["P61769"][20:119] + "GGGGS" * 4 + native["P13747"][21:358]),
        "CD47_": native["Q08722"][:138] + native["P08174"][344:381],
        "SERPINB9_": native["P50453"],
        "PDL1_": native["Q9NZQ7"],
        "iCasp9_": FKBP12_F36V_REFERENCE_AA + "SGGGSG" + native["P55211"][134:416],
        "GSG_P2A_": "GSGATNFSLLKQAGDVEENPGP",
    }


def summarize_prior_draws(samples: List[float]) -> Dict[str, float]:
    """Empirical median and type-7 interpolated p10/p90 of finite prior draws."""
    if not isinstance(samples, (list, tuple)) or not samples:
        raise ValueError("Prior interval requires a nonempty sequence of finite numeric draws")
    try:
        if any(isinstance(x, bool) or not isinstance(x, (int, float)) for x in samples):
            raise ValueError("Prior draws must be numeric, not booleans or strings")
        values = sorted(float(x) for x in samples)
    except (TypeError, ValueError, OverflowError) as exc:
        raise ValueError("Prior draws exceed the finite numeric domain") from exc
    if not all(math.isfinite(x) for x in values):
        raise ValueError("Prior draws must be finite")

    def quantile(probability: float) -> float:
        index = (len(values) - 1) * probability
        lower = int(index)
        fraction = index - lower
        upper = min(lower + 1, len(values) - 1)
        return round((1.0 - fraction) * values[lower] + fraction * values[upper], 3)

    return {"median": quantile(0.5), "p10": quantile(0.1), "p90": quantile(0.9)}


def back_translate_clean(aa_seq: str, include_stop: bool = False) -> str:
    """Deterministically back-translate amino acid sequence to human codons."""
    if not isinstance(aa_seq, str) or not aa_seq or any(aa not in CODON_TABLE for aa in aa_seq):
        raise ValueError("A nonempty canonical amino-acid sequence is required")
    if type(include_stop) is not bool:
        raise TypeError("include_stop must be a boolean")
    codons = [CODON_TABLE[aa] for aa in aa_seq]
    if include_stop:
        codons.append("TGA")
    dna = "".join(codons)
    for bad in ("GTAAGT", "GTGAGT", "AATAAA", "ATTAAA"):
        if not (bad not in dna):
            raise ValueError(f"Unexpected motif {bad} in back-translated ORF")
    return dna


def translate_dna(dna: str) -> str:
    if not isinstance(dna, str) or not dna or any(base not in "ACGT" for base in dna):
        raise ValueError("Coding DNA must be a nonempty uppercase A/C/G/T sequence")
    if not (len(dna) % 3 == 0):
        raise ValueError(f"Coding DNA length {len(dna)} is not a multiple of 3")
    out = []
    for i in range(0, len(dna), 3):
        out.append(GENETIC_CODE[dna[i : i + 3]])
    return "".join(out)


def count_cpg(seq: str) -> Tuple[int, float, float]:
    n = len(seq)
    if n < 2:
        return 0, 0.0, 0.0
    c_cnt = seq.count("C")
    g_cnt = seq.count("G")
    gc_pct = 100.0 * (c_cnt + g_cnt) / n
    cpg_cnt = sum(1 for i in range(n - 1) if seq[i : i + 2] == "CG")
    expected = (c_cnt * g_cnt) / float(n) if (c_cnt * g_cnt) > 0 else 0.0
    oe_ratio = cpg_cnt / expected if expected > 0 else 0.0
    return cpg_cnt, round(gc_pct, 2), round(oe_ratio, 4)


def _parse_grch38_coord(source_acc: str) -> Optional[Tuple[str, int, int, str]]:
    """Parse `GRCh38:<chrom>:<start>-<end>:<strand>` from a construct part provenance string."""
    m = re.fullmatch(r"GRCh38:(chr(?:[1-9][0-9]*|X|Y|M)):(\d+)-(\d+):([+-]?1|[+-])", str(source_acc))
    if not m:
        return None
    chrom, s_str, e_str, strand = m.group(1), m.group(2), m.group(3), m.group(4)
    return chrom, int(s_str), int(e_str), "-1" if strand in ("-", "-1") else "+1"


CANONICAL_CONSTRUCT_IDS = frozenset({
    "LOCUS1_ARM1A_TPT2A_BICISTRONIC", "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01",
    "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01", "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17",
})

CANONICAL_FASTA_CONSTRUCT_IDS = {
    "ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp": "LOCUS1_ARM1A_TPT2A_BICISTRONIC",
    "ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp": "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01",
    "ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp": "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01",
    "ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp": "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17",
}


def parse_construct_fasta_text(text: str) -> Dict[str, str]:
    """Read exactly four reference donors without duplicate-ID or preamble loss."""
    if not isinstance(text, str):
        raise ValueError("Construct FASTA must be UTF-8 text")
    records: Dict[str, str] = {}
    metadata: Dict[str, Dict[str, str]] = {}
    current: Optional[str] = None
    for line_number, raw_line in enumerate(text.splitlines(), 1):
        line = raw_line.strip()
        if not line:
            continue
        if line.startswith(">"):
            tokens = line[1:].split()
            if not tokens or tokens[0] in records:
                raise ValueError(f"Missing or duplicate FASTA identifier at line {line_number}")
            current = tokens[0]
            if current not in CANONICAL_FASTA_CONSTRUCT_IDS:
                raise ValueError(f"Unknown reference construct FASTA identifier: {current}")
            records[current], metadata[current] = "", {}
            for token in tokens[1:]:
                key, sep, value = token.partition("=")
                if not sep or key not in {"length", "sha256"} or key in metadata[current]:
                    raise ValueError(f"Invalid or duplicate FASTA header metadata for {current}")
                metadata[current][key] = value
        else:
            if current is None or any(base not in "ACGT" for base in line):
                raise ValueError(f"FASTA sequence must follow a header and contain uppercase A/C/G/T at line {line_number}")
            records[current] += line
    if set(records) != set(CANONICAL_FASTA_CONSTRUCT_IDS):
        raise ValueError("Construct FASTA requires exactly the four canonical reference donor IDs")
    for key, sequence in records.items():
        expected_length = int(re.search(r"_(\d+)bp$", key).group(1))
        if len(sequence) != expected_length:
            raise ValueError(f"FASTA donor length disagrees with canonical identifier: {key}")
        declared = metadata[key]
        if "length" in declared and declared["length"] != str(len(sequence)):
            raise ValueError(f"FASTA header length mismatch: {key}")
        if "sha256" in declared and declared["sha256"] != sha256_str(sequence):
            raise ValueError(f"FASTA header SHA-256 mismatch: {key}")
    return records


def validate_construct_fasta_binding(construct_verification: Dict[str, Any], fasta_path: Path) -> Dict[str, Any]:
    """Bind expected processed products to translations of the current donor bytes.

    Self-consistent amino-acid hashes do not establish a connection to DNA.
    Processing slices are expected reference products, not measured cleavage.
    """
    data = Path(fasta_path).read_bytes()
    if hashlib.sha256(data).hexdigest() != construct_verification.get("fasta_sha256"):
        raise ValueError("Layer-2 linked FASTA hash differs from current construct bytes")
    records = parse_construct_fasta_text(data.decode("utf-8"))
    grammar = verify_construct_part_grammar(construct_verification)
    if not grammar["all_construct_grammars_verified"]:
        raise ValueError("Current donor construct grammar is invalid")
    constructs = {c["construct_id"]: c for c in construct_verification["constructs"]}
    coding: Dict[str, Dict[str, str]] = {}
    for record_id, cid in CANONICAL_FASTA_CONSTRUCT_IDS.items():
        sequence, construct = records[record_id], constructs[cid]
        if len(sequence) != construct["total_length_bp"] or sha256_str(sequence) != construct.get("donor_sha256"):
            raise ValueError(f"FASTA donor identity differs from construct ledger: {cid}")
        coding[cid] = {}
        for part in construct["part_ledger"]:
            sub = sequence[part["start_1based"] - 1:part["end_1based"]]
            if len(sub) != part["length_bp"] or sha256_str(sub) != part.get("sha256"):
                raise ValueError(f"FASTA component identity differs from part ledger: {cid}/{part['part_name']}")
            if part["part_type"] == "CDS":
                aa = translate_dna(sub if part["orientation"] == "+" else revcomp(sub))
                if aa != part.get("translated_aa_sequence"):
                    raise ValueError(f"FASTA translation differs from part ledger: {cid}/{part['part_name']}")
                coding[cid][part["part_name"]] = aa
    a, b, c, d = [coding[cid] for cid in CANONICAL_FASTA_CONSTRUCT_IDS.values()]

    for cid, modules in coding.items():
        for name, aa in modules.items():
            prefixes = [prefix for prefix in REFERENCE_CODING_MODULE_SHA256 if name.startswith(prefix)]
            if len(prefixes) != 1 or sha256_str(aa.removesuffix("*")) != REFERENCE_CODING_MODULE_SHA256[prefixes[0]]:
                raise ValueError(f"FASTA translation differs from the named reference precursor: {cid}/{name}")

    def one(parts: Dict[str, str], prefix: str) -> str:
        hits = [aa for name, aa in parts.items() if name.startswith(prefix)]
        if len(hits) != 1:
            raise ValueError(f"Expected one translated {prefix} module")
        return hits[0]

    hla_a, hla_b = one(a, "HLAE_"), one(b, "HLAE_")
    cd_a, cd_b = one(a, "CD47_"), one(b, "CD47_")
    if hla_a != hla_b[:-1] or cd_a != cd_b:
        raise ValueError("Arm 1A/1B shared protein modules differ")
    p2a_a, p2a_c = one(a, "GSG_P2A_"), one(c, "GSG_P2A_")
    if p2a_a != "GSGATNFSLLKQAGDVEENPGP" or p2a_c != p2a_a:
        raise ValueError("Reference GSG-P2A sequence differs")
    expected = {
        "HLAE_0103_VMAPRTLVL_SCT_Arm1B_mature_surface": hla_b[20:-1],
        "HLAE_0103_VMAPRTLVL_SCT_Arm1A_mature_with_cytosolic_P2A_stub": hla_a[20:] + p2a_a[:-1],
        "CD47_IgV_GPI_mature_cell_surface": cd_a[18:147],
        "SERPINB9_cytosolic_with_21aa_GSG_P2A_stub": one(c, "SERPINB9_") + p2a_c[:-1],
        "PDL1_mature_cell_surface": one(c, "PDL1_")[18:-1],
        "iCasp9_cytosolic_monomer": one(d, "iCasp9_")[:-1],
    }
    ledger = construct_verification.get("processed_polypeptide_ledger")
    if not isinstance(ledger, dict) or set(ledger) != set(expected):
        raise ValueError("Exactly six processed product records must bind to FASTA translations")
    for key, sequence in expected.items():
        entry = ledger[key]
        if not isinstance(entry, dict):
            raise ValueError(f"Processed product must be an object: {key}")
        lengths = [entry[name] for name in ("mature_length_aa", "processed_length_aa") if name in entry]
        if (sequence != entry.get("sequence") or sha256_str(sequence) != entry.get("sha256")
                or not lengths or any(type(value) is not int or value != len(sequence) for value in lengths)):
            raise ValueError(f"Processed polypeptide is not the expected product of current FASTA: {key}")
    if not expected["HLAE_0103_VMAPRTLVL_SCT_Arm1B_mature_surface"].startswith("VMAPRTLVL"):
        raise ValueError("Current HLA-E peptide differs from the named VMAPRTLVL reference analysis")
    return {"status": "FASTA_TRANSLATIONS_AND_SIX_EXPECTED_PROCESSED_PRODUCTS_BOUND",
            "fasta_sha256": hashlib.sha256(data).hexdigest(), "construct_count": len(records),
            "processed_product_count": len(expected), "processing_status": "EXPECTED_NOT_EMPIRICALLY_MEASURED"}


def validate_homology_arm_sources(ref: Dict[str, Any]) -> Dict[str, Any]:
    """Bind raw GRCh38 intervals and bases to the retained, separately pinned source registry."""
    elems = ref["ensembl_verified_homology_arms_and_elements"]
    registry = ref.get("validated_homology_arm_source_registry")
    required = {"B2M_HA_L_800bp", "B2M_HA_R_800bp", "B2M_HA_L_600bp", "B2M_HA_R_600bp",
                "CXCL10_HA_L_600bp_minus", "CXCL10_HA_R_600bp_minus", "AAVS1_HA_L_600bp_minus", "AAVS1_HA_R_600bp_minus"}
    if not isinstance(registry, dict) or set(registry) != required:
        raise ValueError("Complete pinned eight-arm source registry is required")
    if sha256_str(json.dumps(registry, sort_keys=True, separators=(",", ":"), allow_nan=False)) != REFERENCE_HOMOLOGY_REGISTRY_SHA256:
        raise ValueError("Homology source registry differs from the frozen GRCh38 reference")
    for key in sorted(required):
        entry, pin = elems[key], registry[key]
        start, end, strand = entry.get("start_1based"), entry.get("end_1based"), entry.get("strand")
        seq = entry.get("sequence", "")
        if entry.get("assembly") != "GRCh38":
            raise ValueError(f"Homology assembly must be explicitly GRCh38: {key}")
        if type(start) is not int or type(end) is not int or not 1 <= start <= end:
            raise ValueError(f"Invalid ordered homology interval: {key}")
        if type(strand) is not int or strand not in (-1, 1) or end - start + 1 != len(seq):
            raise ValueError(f"Homology arm length/strand mismatch: {key}")
        region = f"GRCh38:{entry.get('chrom')}:{start}-{end}:strand={strand:+d}"
        if entry.get("region") != region:
            raise ValueError(f"Raw interval string disagrees with typed fields: {key}")
        actual = {"assembly": entry["assembly"], "chrom": entry["chrom"], "start_1based": start,
                  "end_1based": end, "strand": strand, "length_bp": len(seq), "sequence_sha256": sha256_str(seq)}
        if actual != pin or entry.get("length_bp") != len(seq) or (entry.get("sha256") and entry["sha256"] != actual["sequence_sha256"]):
            raise ValueError(f"Homology arm source identity differs from retained registry: {key}")
    for left, right in [("B2M_HA_L_800bp", "B2M_HA_R_800bp"), ("B2M_HA_L_600bp", "B2M_HA_R_600bp"),
                        ("CXCL10_HA_L_600bp_minus", "CXCL10_HA_R_600bp_minus"), ("AAVS1_HA_L_600bp_minus", "AAVS1_HA_R_600bp_minus")]:
        a, b = registry[left], registry[right]
        if a["assembly"] != b["assembly"] or a["chrom"] != b["chrom"] or a["strand"] != b["strand"]:
            raise ValueError(f"Homology pair locus/orientation mismatch: {left}/{right}")
        if max(a["start_1based"], b["start_1based"]) <= min(a["end_1based"], b["end_1based"]):
            raise ValueError(f"Overlapping homology arms: {left}/{right}")
    return copy.deepcopy(registry)


def compute_chs4_alignment(insert: str, ref: Dict[str, Any]) -> Dict[str, Any]:
    """Compute the native/adapted sequence ledger; coordinates are not literal proof flags."""
    native = ref["primary_accession_references"]["U78775.2"]
    sequence = native["sequence"]
    if sha256_str(sequence) != native["sha256"]:
        raise ValueError("U78775.2 primary sequence hash mismatch")
    matcher = difflib.SequenceMatcher(a=insert, b=sequence, autojunk=False)
    block = matcher.find_longest_match(0, len(insert), 0, len(sequence))
    # Anchor the flank audit at the maximal exact block. Unconstrained short matches
    # elsewhere in the 1,211-bp accession do not establish adjacent native provenance.
    tail_start = block.a + block.size
    native_tail_start = block.b + block.size
    tail = insert[tail_start:]
    best_following = (0, 0)
    for skipped in range(min(8, len(sequence) - native_tail_start) + 1):
        matched = 0
        while (matched < len(tail) and native_tail_start + skipped + matched < len(sequence)
               and tail[matched] == sequence[native_tail_start + skipped + matched]):
            matched += 1
        if matched > best_following[0]:
            best_following = (matched, skipped)
    matched, skipped = best_following
    flank_ledger = {
        "left_outside_block_sequence": insert[:block.a],
        "left_outside_block_classification": "short sequence also present in native accession; synthetic origin not established",
        "right_outside_block_sequence": tail,
        "native_bases_omitted_before_following_exact_match": sequence[native_tail_start:native_tail_start + skipped],
        "native_omission_interval_1based_closed": ([native_tail_start + 1, native_tail_start + skipped] if skipped else None),
        "following_exact_native_sequence": tail[:matched],
        "following_match_insert_interval_1based_closed": ([tail_start + 1, tail_start + matched] if matched else None),
        "following_match_native_interval_1based_closed": ([native_tail_start + skipped + 1, native_tail_start + skipped + matched] if matched else None),
        "remaining_engineered_tail_sequence": tail[matched:],
        "remaining_tail_contains_sacii_recognition_motif": "CCGCGG" in tail[matched:],
        "classification_scope": "computed sequence adaptation ledger, not an acquisition or design-intent receipt",
    }
    return {
        "native_accession": "U78775.2", "native_accession_sequence_sha256": native["sha256"],
        "insert_sequence_sha256": sha256_str(insert), "longest_exact_contiguous_match_bp": block.size,
        "insert_start_1based": block.a + 1, "insert_end_1based": block.a + block.size,
        "reference_start_1based": block.b + 1, "reference_end_1based": block.b + block.size,
        "left_flank_outside_match_bp": block.a, "right_flank_outside_match_bp": len(insert) - block.a - block.size,
        "anchored_native_adjacent_adaptation_ledger": flank_ledger,
        "alignment_method": "maximal exact contiguous match plus anchored adjacent-flank audit; global SequenceMatcher diagnostics are not a phylogenetic alignment",
        "alignment_operations": [{"operation": tag, "insert_interval_0based_half_open": [i1, i2],
                                  "reference_interval_0based_half_open": [j1, j2]} for tag, i1, i2, j1, j2 in matcher.get_opcodes()],
        "classification": "ENGINEERED_CHS4_DERIVED_VARIANT_NOT_EXACT_NATIVE_FRAGMENT",
        "functional_insulation_status": "PREREGISTERED_PENDING",
        "scope": "Outside-match bases may include native-adjacent sequence and engineered adaptation; they are not all claimed synthetic adapters.",
    }


DONOR_FREQ_SS87: List[Dict[str, float]] = [
    {"A": 0.33, "C": 0.36, "G": 0.19, "T": 0.12},  # -3 (C/A)
    {"A": 0.60, "C": 0.13, "G": 0.13, "T": 0.14},  # -2 (A)
    {"A": 0.09, "C": 0.03, "G": 0.80, "T": 0.08},  # -1 (G)
    {"A": 0.00, "C": 0.00, "G": 1.00, "T": 0.00},  # +1 (G invariant in GT)
    {"A": 0.00, "C": 0.00, "G": 0.00, "T": 1.00},  # +2 (T invariant in GT)
    {"A": 0.59, "C": 0.03, "G": 0.35, "T": 0.03},  # +3 (A/G purine)
    {"A": 0.71, "C": 0.07, "G": 0.11, "T": 0.11},  # +4 (A)
    {"A": 0.07, "C": 0.05, "G": 0.84, "T": 0.04},  # +5 (G)
    {"A": 0.16, "C": 0.15, "G": 0.21, "T": 0.48},  # +6 (T)
]
DONOR_MIN_SS87 = sum(min(pos.values()) for pos in DONOR_FREQ_SS87)
DONOR_MAX_SS87 = sum(max(pos.values()) for pos in DONOR_FREQ_SS87)
U1_CONSENSUS_9MER = "CAGGTAAGT"

ALLOWED_LAYER3_PDB_IDS_IIP0015 = {
    "3CDG", "1MHE", "3BZE",  # Complex 1: HLA-E SCT / CD94-NKG2A
    "2JJS", "4CMM", "4KJY",  # Complex 2: CD47 / SIRPA V1-V2
    "1IAU", "4GA7", "8ZCR",  # Complex 3: SERPINB9 / Granzyme B
    "4ZQK",                  # Complex 4: PD-L1 / PD-1
    "1BL4", "1JXQ", "1NW9",  # Locus 4 Ref: iCasp9 domain references (FULL_FUSION_UNRESOLVED)
}


def score_5prime_donor_9mer(nine_mer: str) -> Dict[str, Any]:
    """
    Open 5' splice donor metrics on a 9-mer spanning exonic [-3..-1] | intronic [+1..+6]:
      - Shapiro-Senapathy consensus value (Shapiro & Senapathy 1987 PMID:3658675)
      - Log2-odds bits vs uniform 0.25 background (Yeo & Burge 2004 PMID:15285897)
      - Antiparallel U1 snRNA Watson-Crick + G:U/G:psi wobble pairing count across [-3..+6]
        (Roca et al. 2013 PMID:23348838; heuristic prioritization rule noting
        canonical GC-AG, AT-AC, and bulged/shifted U1 registers exist outside this 9-mer model).
    """
    s = nine_mer.upper()
    if len(s) != 9:
        raise ValueError(f"Expected 9-mer for 5' splice donor scoring, got length {len(s)}")
    if s[3:5] != "GT":
        return {
            "nine_mer": f"{s[:3]}|{s[3:]}",
            "is_canonical_gt": False,
            "ss87_cv": 0.0,
            "pwm_bits": -99.0,
            "u1_wc_matches_of_9": 0,
            "u1_wc_or_wobble_of_9": 0,
        }
    raw_sum = sum(DONOR_FREQ_SS87[i][s[i]] for i in range(9))
    cv = 100.0 * (raw_sum - DONOR_MIN_SS87) / (DONOR_MAX_SS87 - DONOR_MIN_SS87)
    bits = sum(math.log2(max(DONOR_FREQ_SS87[i][s[i]], 0.005) / 0.25) for i in range(9))
    wc = sum(1 for i in range(9) if s[i] == U1_CONSENSUS_9MER[i])
    wobble_allowed = {
        0: {"C", "T"},  # -3 vs U1 G11
        1: {"A", "G"},  # -2 vs U1 U10
        2: {"G"},       # -1 vs U1 C9
        3: {"G"},       # +1 vs U1 C8
        4: {"T"},       # +2 vs U1 A7
        5: {"A", "G"},  # +3 vs U1 psi6
        6: {"A", "G"},  # +4 vs U1 psi5
        7: {"G"},       # +5 vs U1 C4
        8: {"T"},       # +6 vs U1 A3 (pairs U/T only)
    }
    wc_gu = sum(1 for i in range(9) if s[i] in wobble_allowed[i])
    return {
        "nine_mer": f"{s[:3]}|{s[3:]}",
        "is_canonical_gt": True,
        "ss87_cv": round(cv, 2),
        "pwm_bits": round(bits, 3),
        "u1_wc_matches_of_9": wc,
        "u1_wc_or_wobble_of_9": wc_gu,
    }


def score_3prime_acceptor_23mer(twentythree_mer: str) -> Dict[str, Any]:
    """
    Explicitly labelled heuristic 3' splice-acceptor index (0..100) on [-20..-1] | [+1..+3]
    where [-2..-1] == 'AG':
      0.60 * (polypyrimidine count in [-18..-4] / 15)
      + 0.25 * (-3 pyrimidine preference weight / 0.78)
      + 0.15 * (+1 G preference weight / 0.52).
    """
    s = twentythree_mer.upper()
    if len(s) != 23:
        raise ValueError(f"Expected 23-mer for 3' splice acceptor scoring, got length {len(s)}")
    if s[18:20] != "AG":
        return {
            "context": f"{s[10:18]}{s[18:20]}|{s[20:23]}",
            "is_canonical_ag": False,
            "heuristic_acceptor_index": 0.0,
            "ppt_pyr_count_of_15": 0,
        }
    ppt = s[2:17]
    pyr_cnt = sum(1 for b in ppt if b in ("C", "T"))
    minus3 = s[17]
    plus1 = s[20]
    m3_w = {"C": 0.78, "T": 0.72, "A": 0.22, "G": 0.02}[minus3]
    p1_w = {"G": 0.52, "A": 0.24, "T": 0.12, "C": 0.12}[plus1]
    idx_val = 100.0 * (0.60 * (pyr_cnt / 15.0) + 0.25 * (m3_w / 0.78) + 0.15 * (p1_w / 0.52))
    return {
        "context": f"{s[10:18]}{s[18:20]}|{s[20:23]}",
        "is_canonical_ag": True,
        "minus3_base": minus3,
        "plus1_base": plus1,
        "ppt_pyr_count_of_15": pyr_cnt,
        "heuristic_acceptor_index": round(idx_val, 2),
    }


def scan_donors_and_acceptors_both_strands(
    seq: str,
    cargo_bounds_1based: Tuple[int, int] = (601, -600),
    min_donor_cv: float = 74.0,
    min_acc_idx: float = 68.0,
) -> Dict[str, Any]:
    """Descriptive two-strand open motif census across '+' and '-' strands."""
    s_plus = seq.upper()
    s_minus = revcomp(s_plus)
    seq_len = len(s_plus)
    c_lo = cargo_bounds_1based[0]
    c_hi = (seq_len + cargo_bounds_1based[1]) if cargo_bounds_1based[1] < 0 else cargo_bounds_1based[1]

    donors: List[Dict[str, Any]] = []
    acceptors: List[Dict[str, Any]] = []

    for strand, cur in [("+", s_plus), ("-", s_minus)]:
        for i in range(3, seq_len - 6):
            if cur[i : i + 2] == "GT":
                sc = score_5prime_donor_9mer(cur[i - 3 : i + 6])
                if sc["ss87_cv"] >= min_donor_cv or sc["u1_wc_or_wobble_of_9"] >= 7:
                    pos1_plus = i if strand == "+" else (seq_len - i + 1)
                    donors.append(
                        {
                            "strand_relative_to_input": strand,
                            "exon_end_1based_on_input_plus": pos1_plus,
                            "in_cargo": bool(c_lo <= pos1_plus <= c_hi),
                            **sc,
                        }
                    )
        for i in range(20, seq_len - 3):
            if cur[i - 2 : i] == "AG":
                sc = score_3prime_acceptor_23mer(cur[i - 20 : i + 3])
                if sc["heuristic_acceptor_index"] >= min_acc_idx:
                    pos1_plus = (i + 1) if strand == "+" else (seq_len - i)
                    acceptors.append(
                        {
                            "strand_relative_to_input": strand,
                            "exon_start_1based_on_input_plus": pos1_plus,
                            "in_cargo": bool(c_lo <= pos1_plus <= c_hi),
                            **sc,
                        }
                    )

    donors.sort(key=lambda r: (r["ss87_cv"], r["u1_wc_or_wobble_of_9"]), reverse=True)
    acceptors.sort(key=lambda r: r["heuristic_acceptor_index"], reverse=True)
    return {
        "total_donors": len(donors),
        "donors_cv_ge_74": sum(1 for d in donors if d["ss87_cv"] >= 74.0),
        "cargo_donors": sum(1 for d in donors if d["in_cargo"]),
        "cargo_donors_plus_strand": sum(1 for d in donors if d["in_cargo"] and d["strand_relative_to_input"] == "+"),
        "cargo_donors_minus_strand": sum(1 for d in donors if d["in_cargo"] and d["strand_relative_to_input"] == "-"),
        "total_acceptors": len(acceptors),
        "cargo_acceptors": sum(1 for a in acceptors if a["in_cargo"]),
        "donors": donors,
        "acceptors": acceptors,
    }


def diff_edit_created_neosites(parent_seq: str, mutant_seq: str) -> Dict[str, List[Dict[str, Any]]]:
    """Identify any donor (CV >= 70 or U1 >= 7) or acceptor (index >= 68) newly created by sequence edits."""
    p_scan = scan_donors_and_acceptors_both_strands(parent_seq, min_donor_cv=70.0, min_acc_idx=68.0)
    m_scan = scan_donors_and_acceptors_both_strands(mutant_seq, min_donor_cv=70.0, min_acc_idx=68.0)
    p_d_keys = {(d["strand_relative_to_input"], d["exon_end_1based_on_input_plus"], d["nine_mer"]) for d in p_scan["donors"]}
    p_a_keys = {(a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"], a["context"]) for a in p_scan["acceptors"]}
    neo_d = [d for d in m_scan["donors"] if (d["strand_relative_to_input"], d["exon_end_1based_on_input_plus"], d["nine_mer"]) not in p_d_keys]
    neo_a = [a for a in m_scan["acceptors"] if (a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"], a["context"]) not in p_a_keys]
    return {"created_donors_cv70_or_u1_7": neo_d, "created_acceptors_idx68": neo_a}


def longest_repeats(seq: str, min_k: int = 12) -> Dict[str, Any]:
    """
    Deterministic scan for longest overlapping direct repeat, longest disjoint direct repeat,
    and longest disjoint inverted repeat >= min_k bp.
    """
    s = seq.upper()
    rc_s = revcomp(s)
    n = len(s)

    lo, hi = min_k, n // 2
    best_dir_ov = ("", -1, -1)
    while lo <= hi:
        mid = (lo + hi) // 2
        seen: Dict[str, int] = {}
        found = None
        for i in range(n - mid + 1):
            sub = s[i : i + mid]
            if sub in seen:
                found = (sub, seen[sub] + 1, i + 1)
                break
            seen[sub] = i
        if found:
            best_dir_ov = found
            lo = mid + 1
        else:
            hi = mid - 1

    lo, hi = min_k, n // 2
    best_dir_disj = ("", -1, -1)
    while lo <= hi:
        mid = (lo + hi) // 2
        first_pos: Dict[str, int] = {}
        found = None
        for i in range(n - mid + 1):
            sub = s[i : i + mid]
            if sub in first_pos:
                if i - first_pos[sub] >= mid:
                    found = (sub, first_pos[sub] + 1, i + 1)
                    break
            else:
                first_pos[sub] = i
        if found:
            best_dir_disj = found
            lo = mid + 1
        else:
            hi = mid - 1

    lo, hi = min_k, n // 2
    best_inv = ("", -1, -1)
    while lo <= hi:
        mid = (lo + hi) // 2
        rc_map: Dict[str, List[int]] = {}
        for j in range(n - mid + 1):
            orig_start0 = n - (j + mid)
            rc_map.setdefault(rc_s[j : j + mid], []).append(orig_start0)
        found = None
        for i in range(n - mid + 1):
            sub = s[i : i + mid]
            if sub in rc_map:
                for o0 in rc_map[sub]:
                    if abs(o0 - i) >= mid:
                        a1, b1 = min(i + 1, o0 + 1), max(i + 1, o0 + 1)
                        found = (sub, a1, b1)
                        break
            if found:
                break
        if found:
            best_inv = found
            lo = mid + 1
        else:
            hi = mid - 1

    return {
        "longest_direct_repeat_ge_12bp": {
            "overlap_mode": "overlapping_allowed_tandem_or_array",
            "length_bp": len(best_dir_ov[0]),
            "sequence": best_dir_ov[0],
            "pos1_a": best_dir_ov[1],
            "pos1_b": best_dir_ov[2],
        },
        "longest_disjoint_direct_repeat_ge_12bp": {
            "overlap_mode": "strictly_disjoint",
            "length_bp": len(best_dir_disj[0]),
            "sequence": best_dir_disj[0],
            "pos1_a": best_dir_disj[1],
            "pos1_b": best_dir_disj[2],
        },
        "longest_disjoint_inverted_repeat_ge_12bp": {
            "overlap_mode": "strictly_disjoint",
            "length_bp": len(best_inv[0]),
            "sequence": best_inv[0],
            "pos1_a": best_inv[1],
            "pos1_b": best_inv[2],
        },
    }


def nearest_neighbor_tm_sl98(seq: str, na_mm: float = 50.0, oligo_nm: float = 250.0) -> float:
    """SantaLucia 1998 unified nearest-neighbor Tm (50 mM Na+, 250 nM oligo)."""
    nn = {
        "AA": (-7.9, -22.2), "TT": (-7.9, -22.2), "AT": (-7.2, -20.4), "TA": (-7.2, -21.3),
        "CA": (-8.5, -22.7), "TG": (-8.5, -22.7), "GT": (-8.4, -22.4), "AC": (-8.4, -22.4),
        "CT": (-7.8, -21.0), "AG": (-7.8, -21.0), "GA": (-8.2, -22.2), "TC": (-8.2, -22.2),
        "CG": (-10.6, -27.2), "GC": (-9.8, -24.4), "GG": (-8.0, -19.9), "CC": (-8.0, -19.9),
    }
    s = seq.upper()
    dh = sum(nn[s[i : i + 2]][0] for i in range(len(s) - 1))
    ds = sum(nn[s[i : i + 2]][1] for i in range(len(s) - 1))
    for end in (s[0], s[-1]):
        if end in "GC":
            dh += 0.1
            ds += -2.8
        else:
            dh += 2.3
            ds += 4.1
    ds_salt = ds + 0.368 * (len(s) - 1) * math.log(na_mm / 1000.0)
    return round((dh * 1000.0) / (ds_salt + 1.987 * math.log(oligo_nm * 1e-9 / 4.0)) - 273.15, 2)


def translate_strict_cds(cds: str, expect_terminal_stop: bool) -> str:
    s = cds.upper()
    if len(s) == 0 or len(s) % 3 != 0:
        raise ValueError(f"Invalid CDS length: {len(s)}")
    aa = "".join(GENETIC_CODE[s[i : i + 3]] for i in range(0, len(s), 3))
    if expect_terminal_stop:
        if not aa.endswith("*") or "*" in aa[:-1]:
            raise ValueError("Expected single terminal stop codon")
    else:
        if "*" in aa:
            raise ValueError("Unexpected stop codon in stop-less upstream 2A cistron")
    return aa


def enumerate_junction_peptides(left_aa: str, linker_aa: str, right_aa: str) -> Dict[str, Any]:
    """
    Deterministically enumerate all unique-position 8..11-mer (Class I) and 15-mer (Class II)
    sliding windows that cross a single boundary (when linker_aa == '') or overlap BOTH a
    synthetic linker segment AND at least one flanking residue (when linker_aa != '').
    """
    full = left_aa + linker_aa + right_aa
    len_left = len(left_aa)
    len_link = len(linker_aa)
    n = len(full)

    def _windows_for_k(k: int) -> List[str]:
        wins = []
        for s in range(0, n - k + 1):
            e = s + k
            if len_link == 0:
                if s <= len_left - 1 and e - 1 >= len_left:
                    wins.append(full[s:e])
            else:
                overlaps_linker = (s <= len_left + len_link - 1) and (e - 1 >= len_left)
                overlaps_flank = (s < len_left) or (e - 1 >= len_left + len_link)
                if overlaps_linker and overlaps_flank:
                    wins.append(full[s:e])
        return wins

    w_by_k = {k: _windows_for_k(k) for k in (8, 9, 10, 11, 15)}
    return {
        "count_8_to_11mer": sum(len(w_by_k[k]) for k in (8, 9, 10, 11)),
        "counts_by_length": {str(k): len(w_by_k[k]) for k in (8, 9, 10, 11, 15)},
        "count_15mer": len(w_by_k[15]),
        "sample_9mers": w_by_k[9][:5],
        "sample_15mers": w_by_k[15][:3],
    }


def validate_p1_to_p4_fail_closed(
    design_id: str,
    donor_seq: str,
    expected_orfs: List[Dict[str, Any]],
    junction_specs: List[Dict[str, Any]],
    parent_8_11mer_count: int,
    parent_15mer_count: int,
    r01_canonical_8_11mer_count: int,
    r01_canonical_15mer_count: int,
    pdb_refs: List[str],
    unresolved_structural_flags: List[str],
) -> Dict[str, Any]:
    """
    Fail-closed 4-point protein/packaging/provenance validator (P1-P4) for knock-in donors:
      - P1: Rejects empty donor/ORFs, enforces packaged AAV6 <= 4,700 bp, binds every declared
            ORF to its exact donor slice & parent protein, and rejects undeclared >=300-nt
            Kozak-initiated cargo ORFs on either strand.
      - P2: Enforces strict sequence/domain/length signatures on every topology_kind.
      - P3: Auto-derives required chimeric/2A/linker junction counts from donor polypeptides.
      - P4: Binds each topology_kind to its target-specific Layer-3 PDB subset.
    """
    if not donor_seq or not expected_orfs:
        raise ValueError(f"[{design_id}] Fail-closed P1: donor_seq and expected_orfs must be non-empty")

    aav6_bp = len(donor_seq) + 290
    if aav6_bp > 4700:
        raise ValueError(f"[{design_id}] Fail-closed P1: packaged AAV6 length {aav6_bp} bp exceeds 4,700 bp engineering cap")

    target_pdb_map: Dict[str, Any] = {
        "TYPE1_TM_HLAE_SCT": {"3CDG", "1MHE", "3BZE"},
        "GPI_ANCHORED_CD47_IGV": {"2JJS", "4CMM", "4KJY"},
        "CYTOSOLIC_SERPINB9": {"1IAU", "4GA7", "8ZCR"},
        "TYPE1_TM_PDL1": {"4ZQK"},
        "CYTOSOLIC_ICASP9": {"1BL4", "1JXQ", "1NW9"},
    }

    p1_orfs = []
    p2_checks = []
    declared_intervals_by_strand: Dict[str, List[Tuple[int, int]]] = {"+": [], "-": []}
    present_topologies = set()
    required_junction_count = 0

    for spec in expected_orfs:
        name = spec["name"]
        s0 = int(spec["start_0based"])
        e0 = int(spec["end_0based"])
        strand = spec["strand"]
        has_stop = bool(spec["has_stop"])
        parent_cds = spec["parent_cds"].upper()

        if strand not in ("+", "-") or not (0 <= s0 < e0 <= len(donor_seq)):
            raise ValueError(f"[{design_id}] Fail-closed P1: ORF {name} span [{s0}:{e0}] ({strand}) invalid")

        extracted_cds = donor_seq[s0:e0].upper() if strand == "+" else revcomp(donor_seq[s0:e0])
        if len(extracted_cds) != len(parent_cds):
            raise ValueError(f"[{design_id}] Fail-closed P1: ORF {name} length mismatch vs parent")

        mut_aa = translate_strict_cds(extracted_cds, expect_terminal_stop=has_stop)
        wt_aa = translate_strict_cds(parent_cds, expect_terminal_stop=has_stop)
        if mut_aa != wt_aa:
            raise ValueError(f"[{design_id}] Fail-closed P1/P2: Non-synonymous AA change in {name}")

        declared_intervals_by_strand[strand].append((s0, e0))
        aa_nostop = mut_aa[:-1] if has_stop else mut_aa
        nt_edits = [
            {"pos_1based_cds": i + 1, "ref": parent_cds[i], "alt": extracted_cds[i]}
            for i in range(len(parent_cds))
            if parent_cds[i] != extracted_cds[i]
        ]
        p1_orfs.append(
            {
                "orf_name": name,
                "donor_span_1based": [s0 + 1, e0],
                "strand_in_donor": strand,
                "cds_length_bp": len(extracted_cds),
                "cds_sha256": sha256_str(extracted_cds),
                "protein_aa_length": len(aa_nostop),
                "protein_sha256": sha256_str(mut_aa),
                "aa_substitutions_vs_parent": 0,
                "synonymous_nt_edits": nt_edits,
            }
        )

        topo_kind = spec["topology_kind"]
        if topo_kind not in target_pdb_map:
            raise ValueError(f"[{design_id}] Fail-closed P2: Unknown topology_kind: {topo_kind}")
        present_topologies.add(topo_kind)
        has_downstream_2a = bool(spec.get("has_downstream_2a", False))
        if has_downstream_2a:
            if has_stop:
                raise ValueError(f"[{design_id}] Fail-closed P2: ORF {name} cannot have both terminal stop and downstream 2A")
            tail_2a = (
                donor_seq[e0 : e0 + 66].upper()
                if strand == "+"
                else revcomp(donor_seq[max(0, s0 - 66) : s0])
            )
            if len(tail_2a) < 54 or "NPGP" not in "".join(
                GENETIC_CODE[tail_2a[k : k + 3]] for k in range(0, len(tail_2a) - len(tail_2a) % 3, 3)
            ):
                raise ValueError(f"[{design_id}] Fail-closed P2: Missing canonical NPGP 2A motif downstream of {name}")
            required_junction_count += 1

        if topo_kind == "GPI_ANCHORED_CD47_IGV":
            if has_downstream_2a:
                raise ValueError(f"[{design_id}] Fail-closed P2: 2A peptide forbidden downstream of GPI signal")
            if (
                len(aa_nostop) != 175
                or not aa_nostop.startswith("MWPLVAALLLGSACCGSA")
                or aa_nostop[138:147] != "PNKGSGTTS"
                or aa_nostop[146] != "S"
                or aa_nostop[147:] != "GTTRLLSGHTCFTLTGLLGTLVTMGLLT"
            ):
                raise ValueError(f"[{design_id}] Fail-closed P2: CD47-IgV-GPI Ser147 omega-site or Gly148..Thr175 propeptide corrupted")
            required_junction_count += 1
            p2_checks.append(
                {
                    "orf_name": name,
                    "signal_peptide_1_18": aa_nostop[:18],
                    "mature_n_term_res19": aa_nostop[18],
                    "cd55_stalk_139_147": aa_nostop[138:147],
                    "gpi_omega_residue_1based": "Ser147 (native CD55 Ser353; cleaved 28-aa propeptide is Gly148..Thr175)",
                    "cleaved_propeptide_148_175_len": 28,
                    "sequence_topology_valid": True,
                    "biological_processing_qualification": "PENDING_WETLAB_SEC11_PIGK_QUANTIBRITE",
                }
            )
        elif topo_kind == "TYPE1_TM_PDL1":
            if not aa_nostop.startswith("MRIFAVFIFMTYWHLLNA") or aa_nostop[18] != "F" or len(aa_nostop) != 290:
                raise ValueError(f"[{design_id}] Fail-closed P2: PD-L1 SP (1..18) or mature Phe19/290-aa topology corrupted")
            p2_checks.append(
                {
                    "orf_name": name,
                    "signal_peptide_1_18": aa_nostop[:18],
                    "mature_n_term_res19": "Phe19",
                    "cytoplasmic_c_tail_intact": aa_nostop[-15:],
                    "has_downstream_2a": has_downstream_2a,
                    "sequence_topology_valid": True,
                    "biological_processing_qualification": "PENDING_WETLAB_SURFACE_PDL1_FLOW_AND_SHEDDING",
                }
            )
        elif topo_kind == "TYPE1_TM_HLAE_SCT":
            if (
                len(aa_nostop) < 495
                or not aa_nostop.startswith("MSRSVALAVLALLSLSGLEA")
                or not aa_nostop.endswith("AEWSDSAQGSESHSL")
                or aa_nostop.count("GGGGSGGGGSGGGGSGGGGS") < 1
            ):
                raise ValueError(f"[{design_id}] Fail-closed P2: HLA-E SCT B2M-SP, G4S linkers, or cytoplasmic tail corrupted")
            required_junction_count += 4
            p2_checks.append(
                {
                    "orf_name": name,
                    "b2m_signal_peptide_1_20": aa_nostop[:20],
                    "tethered_peptide_21_29": aa_nostop[20:29],
                    "precursor_length_aa": len(aa_nostop),
                    "cytoplasmic_tail_intact": "AEWSDSAQGSESHSL",
                    "has_downstream_2a": has_downstream_2a,
                    "sequence_topology_valid": True,
                    "biological_processing_qualification": "PENDING_WETLAB_QUANTIBRITE_HLAE_AND_NK_GATE",
                }
            )
        elif topo_kind == "CYTOSOLIC_SERPINB9":
            if len(aa_nostop) != 376 or not aa_nostop.startswith("METLSNASGTFAIRLLKILC"):
                raise ValueError(f"[{design_id}] Fail-closed P2: CYTOSOLIC_SERPINB9 requires 376-aa leaderless human PI-9 sequence")
            p2_checks.append(
                {
                    "orf_name": name,
                    "compartment": "cytosolic_leaderless",
                    "has_c_terminal_2a_stub": has_downstream_2a,
                    "sequence_topology_valid": True,
                    "biological_processing_qualification": "PENDING_WETLAB_GZMB_KINETICS",
                }
            )
        elif topo_kind == "CYTOSOLIC_ICASP9":
            if len(aa_nostop) != 396 or not aa_nostop.startswith("MGVQVETISPGDGRTFPKRG") or aa_nostop[108:114] != "SGGGSG":
                raise ValueError(f"[{design_id}] Fail-closed P2: CYTOSOLIC_ICASP9 requires 396-aa FKBP12(F36V)-SGGGSG-dCasp9 sequence")
            required_junction_count += 1
            p2_checks.append(
                {
                    "orf_name": name,
                    "compartment": "cytosolic_leaderless",
                    "has_c_terminal_2a_stub": has_downstream_2a,
                    "sequence_topology_valid": True,
                    "biological_processing_qualification": "PENDING_WETLAB_AP1903_KILL_AND_TIER6B_ESCAPE",
                }
            )

    if len(donor_seq) >= 1800:
        c_start, c_end = 580, len(donor_seq) - 580
        cargo_plus = donor_seq[c_start:c_end].upper()
        cargo_minus = revcomp(cargo_plus)
        c_len = len(cargo_plus)
        for st, c_str in (("+", cargo_plus), ("-", cargo_minus)):
            search_from = 0
            while True:
                k_pos = c_str.find("CCACCATG", search_from)
                if k_pos == -1:
                    break
                atg_idx = k_pos + 5
                search_from = atg_idx + 3
                end_idx = atg_idx
                while end_idx + 3 <= c_len and GENETIC_CODE[c_str[end_idx : end_idx + 3]] != "*":
                    end_idx += 3
                if end_idx + 3 <= c_len and (end_idx + 3 - atg_idx) >= 300:
                    if st == "+":
                        g_s0, g_e0 = c_start + atg_idx, c_start + end_idx + 3
                    else:
                        g_s0, g_e0 = c_start + (c_len - (end_idx + 3)), c_start + (c_len - atg_idx)
                    span_len = g_e0 - g_s0
                    covered = sum(
                        max(0, min(g_e0, ds1) - max(g_s0, ds0))
                        for ds0, ds1 in declared_intervals_by_strand[st]
                    )
                    if covered < 0.80 * span_len:
                        raise ValueError(
                            f"[{design_id}] Fail-closed P1: Undeclared Kozak-initiated cargo ORF on '{st}' [{g_s0}:{g_e0}] ({span_len} nt, covered={covered} nt)"
                        )

    if len(junction_specs) < required_junction_count:
        raise ValueError(
            f"[{design_id}] Fail-closed P3: Expected >= {required_junction_count} chimeric/2A/linker junction_specs from donor ORFs, got {len(junction_specs)}"
        )
    j_enum = []
    tot_8_11 = 0
    tot_15 = 0
    for j in junction_specs:
        if len(j.get("left_aa", "")) < 8 or len(j.get("right_aa", "")) < 8:
            raise ValueError(f"[{design_id}] Fail-closed P3: Invalid flanking peptide lengths in {j.get('junction_id')}")
        res = enumerate_junction_peptides(j["left_aa"], j["linker_aa"], j["right_aa"])
        tot_8_11 += res["count_8_to_11mer"]
        tot_15 += res["count_15mer"]
        j_enum.append({"junction_id": j["junction_id"], **res})

    if not pdb_refs:
        raise ValueError(f"[{design_id}] Fail-closed P4: pdb_refs must be non-empty")
    bad_pdbs = [p for p in pdb_refs if p not in ALLOWED_LAYER3_PDB_IDS_IIP0015]
    if bad_pdbs:
        raise ValueError(f"[{design_id}] Fail-closed P4: Unverified/misattributed PDB IDs rejected: {bad_pdbs}")
    allowed_for_present = set()
    for tk in present_topologies:
        req_set = target_pdb_map[tk]
        if not (set(pdb_refs) & req_set):
            raise ValueError(f"[{design_id}] Fail-closed P4: Missing target-specific Layer-3 PDB reference for {tk}")
        allowed_for_present |= req_set
    wrong_target_pdbs = [p for p in pdb_refs if p not in allowed_for_present]
    if wrong_target_pdbs:
        raise ValueError(f"[{design_id}] Fail-closed P4: PDB IDs {wrong_target_pdbs} do not match any protein target in {sorted(present_topologies)}")

    return {
        "design_id": design_id,
        "gate_P1_sequence_and_aav6_budget": {
            "donor_length_bp": len(donor_seq),
            "packaged_aav6_bp_with_2x145_itrs": aav6_bp,
            "within_4700bp_engineering_cap": True,
            "headroom_below_4700bp": 4700 - aav6_bp,
            "donor_sha256": sha256_str(donor_seq),
            "bound_orf_verifications": p1_orfs,
            "deterministic_sequence_check_passed": True,
            "aav6_genome_integrity_and_hdr_yield_status": "PENDING_WETLAB_AAV_GENOME_QC",
        },
        "gate_P2_membrane_and_2a_topology": {
            "checks": p2_checks,
            "sequence_topology_inherited_valid": True,
            "exact_product_trafficking_status": "PENDING_WETLAB",
        },
        "gate_P3_chimeric_junction_neoepitopes": {
            "portfolio_9boundary_reproduced_8_11mer": 326,
            "portfolio_9boundary_reproduced_15mer": 112,
            "portfolio_10boundary_with_hlac_15mer": 126,
            "legacy_snippet_scoped_15mer_constant": 136,
            "required_chimeric_junction_count_from_orfs": required_junction_count,
            "construct_enumerated_junctions": j_enum,
            "construct_total_8_11mer": tot_8_11,
            "construct_total_15mer": tot_15,
            "delta_8_11mer_vs_immediate_parent": tot_8_11 - parent_8_11mer_count,
            "delta_15mer_vs_immediate_parent": tot_15 - parent_15mer_count,
            "delta_8_11mer_vs_canonical_r01_locus_equivalent": tot_8_11 - r01_canonical_8_11mer_count,
            "delta_15mer_vs_canonical_r01_locus_equivalent": tot_15 - r01_canonical_15mer_count,
            "aberrant_rna_isoform_immunogenicity_status": "REQUIRES_5_3_RACE_AND_FULL_CDNA_VERIFICATION",
        },
        "gate_P4_3d_structural_provenance": {
            "verified_layer3_pdb_ids": pdb_refs,
            "intended_polypeptide_identical_to_layer3_entry": True,
            "carried_forward_unresolved_constraints": unresolved_structural_flags,
            "qualification_status": "REFERENCE_GEOMETRY_CARRY_FORWARD_ONLY_EXACT_FUNCTION_PENDING_WETLAB",
        },
    }


def run_adversarial_validator_selftests(
    l3_donor: str,
    serpinb9_nostop: str,
    pdl1_cds: str,
    l4_donor: str,
    icasp9_cds: str,
    astar_donor: str,
    cd47_cds: str,
) -> List[Dict[str, Any]]:
    """Verify all 11 fail-closed negative-control probes are rejected by validate_p1_to_p4_fail_closed."""
    probes: List[Dict[str, Any]] = []

    def _expect_reject(name: str, fn) -> None:
        try:
            fn()
            raise AssertionError(f"Adversarial probe '{name}' failed to raise ValueError")
        except ValueError as exc:
            probes.append({"probe": name, "rejected_as_expected": True, "error": str(exc)})

    idx_pdl1 = l3_donor.find(pdl1_cds)
    good_l3_orfs = [
        {"name": "SERPINB9_nostop", "start_0based": 609, "end_0based": 1737, "strand": "+", "has_stop": False, "parent_cds": serpinb9_nostop, "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": True},
        {"name": "PDL1_stop", "start_0based": idx_pdl1, "end_0based": idx_pdl1 + len(pdl1_cds), "strand": "+", "has_stop": True, "parent_cds": pdl1_cds, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False},
    ]
    good_l3_junc = [{"junction_id": "SERPINB9|P2A", "left_aa": "A" * 376, "linker_aa": "", "right_aa": "B" * 21}]

    _expect_reject("1_empty_orf_list", lambda: validate_p1_to_p4_fail_closed("P1", l3_donor, [], [], 0, 0, 0, 0, ["4ZQK"], []))
    _expect_reject(
        "2_orf_absent_from_donor_span",
        lambda: validate_p1_to_p4_fail_closed(
            "P2", l3_donor, [{"name": "FAKE", "start_0based": 0, "end_0based": len(pdl1_cds), "strand": "+", "has_stop": True, "parent_cds": pdl1_cds, "topology_kind": "TYPE1_TM_PDL1"}], [], 0, 0, 0, 0, ["4ZQK"], []
        ),
    )
    mut_donor = l3_donor[:idx_pdl1] + ("T" if pdl1_cds[0] != "T" else "C") + l3_donor[idx_pdl1 + 1 :]
    _expect_reject(
        "3_nonsynonymous_mutation",
        lambda: validate_p1_to_p4_fail_closed("P3", mut_donor, good_l3_orfs, good_l3_junc, 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], []),
    )
    for k_i, bad_pdb in enumerate(("7ST3", "1BLX"), start=4):
        _expect_reject(
            f"{k_i}_misattributed_pdb_{bad_pdb}",
            lambda bp=bad_pdb: validate_p1_to_p4_fail_closed("P_PDB", l3_donor, good_l3_orfs, good_l3_junc, 34, 14, 34, 14, [bp], []),
        )
    _expect_reject(
        "6_empty_junction_specs_with_2a",
        lambda: validate_p1_to_p4_fail_closed("P6", l3_donor, good_l3_orfs, [], 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], []),
    )
    _expect_reject(
        "7_wrong_target_pdb_4ZQK_on_icasp9",
        lambda: validate_p1_to_p4_fail_closed(
            "P7",
            l4_donor,
            [{"name": "iCasp9", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "parent_cds": icasp9_cds, "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": False}],
            [{"junction_id": "FKBP|SGGGSG|dCasp9", "left_aa": "A" * 108, "linker_aa": "SGGGSG", "right_aa": "B" * 282}],
            58, 20, 58, 20, ["4ZQK"], [],
        ),
    )
    _expect_reject(
        "8_pdl1_mislabelled_cytosolic_icasp9",
        lambda: validate_p1_to_p4_fail_closed(
            "P8",
            l3_donor,
            [dict(good_l3_orfs[1], topology_kind="CYTOSOLIC_ICASP9")],
            [{"junction_id": "FAKE", "left_aa": "A" * 108, "linker_aa": "SGGGSG", "right_aa": "B" * 176}],
            0, 0, 0, 0, ["1BL4"], [],
        ),
    )
    _expect_reject(
        "9_omitted_serpinb9_orf",
        lambda: validate_p1_to_p4_fail_closed("P9", l3_donor, [good_l3_orfs[1]], [], 0, 0, 0, 0, ["4ZQK"], []),
    )
    _expect_reject(
        "10_oversized_4710bp_packaged_aav6",
        lambda: validate_p1_to_p4_fail_closed("P10", l3_donor + ("A" * 330), good_l3_orfs, good_l3_junc, 34, 14, 34, 14, ["1IAU", "4ZQK"], []),
    )
    bad_cd47 = cd47_cds[: 3 * 174] + "CCA" + cd47_cds[3 * 175 :]
    bad_astar = astar_donor[:876] + revcomp(bad_cd47) + astar_donor[1404:]
    _expect_reject(
        "11_cd47_propeptide_Thr175_to_Pro175",
        lambda: validate_p1_to_p4_fail_closed(
            "P11",
            bad_astar,
            [{"name": "CD47", "start_0based": 876, "end_0based": 1404, "strand": "-", "has_stop": True, "parent_cds": bad_cd47, "topology_kind": "GPI_ANCHORED_CD47_IGV", "has_downstream_2a": False}],
            [{"junction_id": "CD47|stalk", "left_aa": "A" * 120, "linker_aa": "", "right_aa": "PNKGSGTTS"}],
            33, 9, 33, 9, ["2JJS"], [],
        ),
    )
    return probes


def _build_two_strand_splice_census_and_challenger_manifest_iip_0015(
    ref: Dict[str, Any],
    construct_verification: Dict[str, Any],
    arm1a_can: str,
    arm1b_can: str,
    l3_can: str,
    l4_can: str,
) -> Dict[str, Any]:
    """
    Deterministic open two-strand knock-in splice-grammar census, synthesis-ready Mode-B
    challenger manifest (unshielded reference derivations + PAM/seed-shielded counterparts
    + unconfounded 2x2 Locus-4 orientation x A72T/C73A controls + separated 505-aa vs 500-aa
    Locus-1 stop-seam comparators), fail-closed P1-P4 protein/packaging checks, and UMI/RT-PCR
    isoform gate geometry (IIP-0015 / DEC-092).
    """
    if score_5prime_donor_9mer("CAGGTGGGT")["u1_wc_or_wobble_of_9"] != 9:
        raise ValueError("U1 pairing calibration mismatch on CAGGTGGGT")
    if score_5prime_donor_9mer("CAGGTGAGA")["u1_wc_or_wobble_of_9"] != 8:
        raise ValueError("U1 pairing calibration mismatch on CAGGTGAGA")
    if score_5prime_donor_9mer("CCTGTGAGC")["u1_wc_or_wobble_of_9"] != 6:
        raise ValueError("U1 pairing calibration mismatch on CCTGTGAGC")
    if score_5prime_donor_9mer("CCGGTTCGT")["u1_wc_or_wobble_of_9"] != 6:
        raise ValueError("U1 pairing calibration mismatch on CCGGTTCGT")
    if score_5prime_donor_9mer("TGAGTAGGT")["u1_wc_or_wobble_of_9"] != 8:
        raise ValueError("U1 pairing calibration mismatch on TGAGTAGGT")

    c_by_id = {c["construct_id"]: c for c in construct_verification["constructs"]}
    codon_tbl = c_by_id["LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01"]["arm1b_vs_arm1x_codon_coordinate_table"]
    challengers = next(v for k, v in codon_tbl.items() if k.startswith("single_variable_challenger_arms_"))
    astar_wt = next(
        v for k, v in challengers.items() if k.startswith("Arm_1B_Sense_Readthrough_Terminator_Shield_")
    )["embodiment_a_star_combined_4143bp_donor_sequence"].upper()
    l3_sf_wt = next(
        v for k, v in challengers.items() if k.startswith("Locus3_ScarFree_Dual_Promoter_SERPINB9_PDL1_")
    )["assembled_3799bp_spaced_donor_sequence"].upper()
    l3_bfb_wt = next(
        v for k, v in challengers.items() if k.startswith("Locus3_BasalFloor_ScarFree_SERPINB9_PDL1_")
    )["l3_bfb_assembled_4078bp_pam_shielded_donor_sequence"].upper()
    dxs_arm1c_block = next(
        v for k, v in challengers.items() if k.startswith("DX_S_Split_Cassette_Arm1C_HLAE_plus_Locus4_CD47_")
    )
    dxs_l4_wt = dxs_arm1c_block["locus4_icasp9_p2a_cd47_donor_sequence"].upper()
    dxs_arm1c_3300 = dxs_arm1c_block["locus1_arm1c_constitutive_eef1a1_intron_donor_sequence"].upper()
    dxs_arm1c_native_3300 = dxs_arm1c_block["locus1_arm1c_constitutive_native_parts_3300bp_donor_sequence"].upper()
    dxs_arm1c_3459 = dxs_arm1c_block["locus1_arm1c_promoter_trapped_wpre3_3459bp_donor_sequence"].upper()

    gencode = ref["gencode_v46_transcript_models_pinned"]
    b2m_ex2_obj = gencode["B2M"]["exon_2_sequence_chr15_44715423_44715701"]
    b2m_ex2_seq = b2m_ex2_obj["sequence"].upper()
    if len(b2m_ex2_seq) != 279 or sha256_str(b2m_ex2_seq) != b2m_ex2_obj["sequence_sha256"]:
        raise ValueError("Pinned B2M Exon 2 sequence hash mismatch in layer2_genomic_and_jaspar_reference.json")
    art3_model = gencode["ART3"]
    cbx3_win_a_model = gencode["CBX3_UPSTREAM_WINDOW_A_ISOFORM"]

    serpinb9_nostop = l3_can[609:1737]
    gsg_p2a_cds = l3_can[1737:1803]
    pdl1_wt = l3_can[1803:2676]
    wpre_wt = l3_can[2676:3265]
    bgh_wt = l3_can[3265:3490]

    chs4_250 = l4_can[600:850]
    wina_wt = l4_can[850:1305]
    eef_wt = l4_can[1305:1535]
    kozak_9 = l4_can[1535:1544]
    icasp9_wt = l4_can[1544:2735]
    sv40_122 = l4_can[2735:2857]

    hlae_astar_wt = astar_wt[1800:3318]
    cd47_astar_wt = revcomp(astar_wt[876:1404])
    hlae_arm1b_wt = arm1b_can[1646:3149]

    pdl1_syn2 = pdl1_wt[:719] + "T" + pdl1_wt[720:722] + "C" + pdl1_wt[723:]
    pdl1_syn4 = pdl1_syn2[:857] + "T" + pdl1_syn2[858:860] + "C" + pdl1_syn2[861:]
    if not (translate_strict_cds(pdl1_wt, True) == translate_strict_cds(pdl1_syn2, True) == translate_strict_cds(pdl1_syn4, True)):
        raise ValueError("PD-L1 synonymous edit translation check failed")

    bgh_hard = bgh_wt[:139] + "T" + bgh_wt[140:142] + "TT" + bgh_wt[144:]
    wpre_hard = wpre_wt[:260] + "A" + wpre_wt[261:]
    wina_codir_hard = wina_wt[:31] + "TC" + wina_wt[33:443] + "TCC" + wina_wt[446:]
    wina_2strand_hard = wina_codir_hard[:71] + "TA" + wina_codir_hard[73:]
    eef_230a_historical = eef_wt[:222] + "C" + eef_wt[223:228] + "CA"
    eef_230c = eef_wt[:222] + "C" + eef_wt[223:228] + "CC"

    # Separate 505-aa Embodiment A* (G1515C, G1517A) vs 500-aa Arm 1B / DX-S Arm 1C (G1500C, G1502A)
    hlae_astar_stop = hlae_astar_wt[:1514] + "C" + hlae_astar_wt[1515] + "A" + hlae_astar_wt[1517]
    hlae_arm1b_stop = hlae_arm1b_wt[:1499] + "C" + hlae_arm1b_wt[1500] + "A" + hlae_arm1b_wt[1502]
    if translate_strict_cds(hlae_astar_wt, True) != translate_strict_cds(hlae_astar_stop, True):
        raise ValueError("Embodiment A* 505-aa stop-only edit changed translation")
    if translate_strict_cds(hlae_arm1b_wt, True) != translate_strict_cds(hlae_arm1b_stop, True):
        raise ValueError("Arm 1B/1C 500-aa stop-only edit changed translation")

    if not (eef_wt.count("CG") == eef_230c.count("CG") == 19 and wina_wt.count("CG") == wina_codir_hard.count("CG") == wina_2strand_hard.count("CG") == 47):
        raise ValueError("Window A / EEF1A1 internal CpG preservation check failed")
    if (eef_230c + kozak_9).count("CG") - (eef_wt + kozak_9).count("CG") != 1:
        raise ValueError("Expected +1 junctional CpG across EEF1A1[230C]|Kozak[1] seam")

    icasp9_cds13_acceptor = score_3prime_acceptor_23mer(l4_can[1544 + 12 - 20 : 1544 + 12 + 3])
    if not (icasp9_cds13_acceptor["is_canonical_ag"] and icasp9_cds13_acceptor["heuristic_acceptor_index"] >= 68.0):
        raise ValueError("Expected canonical iCasp9 CDS[11..12] AG acceptor")

    chs4_fii_80 = chs4_250[16:96]  # GenBank U78775.2:24-103; inserted in reverse-complement orientation at 600|601
    l3_can_syn2 = l3_can[:1803] + pdl1_syn2 + wpre_wt + bgh_wt + l3_can[3490:]
    l3_can_syn4 = l3_can[:1803] + pdl1_syn4 + wpre_wt + bgh_wt + l3_can[3490:]
    l3_can_bgh_only = l3_can[:1803] + pdl1_wt + wpre_wt + bgh_hard + l3_can[3490:]
    l3_can_wpre_only = l3_can[:1803] + pdl1_wt + wpre_hard + bgh_wt + l3_can[3490:]
    l3_sf_syn4_only = l3_sf_wt[:2101] + pdl1_syn4 + bgh_wt + l3_sf_wt[3199:]
    l3_sf_syn4_bgh = l3_sf_wt[:2101] + pdl1_syn4 + bgh_hard + l3_sf_wt[3199:]
    l3_sf_syn4_1xfii80 = l3_sf_syn4_only[:600] + revcomp(chs4_fii_80) + l3_sf_syn4_only[600:]
    l3_sf_syn4_bgh_1xfii80 = l3_sf_syn4_bgh[:600] + revcomp(chs4_fii_80) + l3_sf_syn4_bgh[600:]

    l4_wina_only = l4_can[:850] + wina_codir_hard + eef_wt + l4_can[1535:]
    l4_eef230c_only = l4_can[:850] + wina_wt + eef_230c + l4_can[1535:]
    l4_splice_230c = l4_can[:850] + wina_codir_hard + eef_230c + l4_can[1535:]
    l4_codir_7nt_230c = l4_can[:850] + wina_2strand_hard + eef_230c + l4_can[1535:]

    # Pure offline GRCh38 chr19:+ homology arms from canonical chr19:- Locus 4 homology arms:
    # chr19:55115168..55115767 (+) == revcomp(l4_can[-600:]) and chr19:55115768..55116367 (+) == revcomp(l4_can[:600])
    wt4_plus_ha_l = revcomp(l4_can[-600:])
    wt4_plus_ha_r = revcomp(l4_can[:600])
    cargo_wt = l4_can[600:2857]
    cargo_5nt_230c = chs4_250 + wina_codir_hard + eef_230c + kozak_9 + icasp9_wt + sv40_122
    cargo_7nt_230c = chs4_250 + wina_2strand_hard + eef_230c + kozak_9 + icasp9_wt + sv40_122

    l4_conv_wt_plus = wt4_plus_ha_l + cargo_wt + wt4_plus_ha_r
    l4_conv_wt_minus = l4_can[:600] + revcomp(cargo_wt) + l4_can[2857:]
    l4_conv_5nt_230c_plus = wt4_plus_ha_l + cargo_5nt_230c + wt4_plus_ha_r
    l4_conv_5nt_230c_minus = l4_can[:600] + revcomp(cargo_5nt_230c) + l4_can[2857:]
    l4_conv_2strand_230c = wt4_plus_ha_l + cargo_7nt_230c + wt4_plus_ha_r
    l4_conv_2strand_230c_minus = l4_can[:600] + revcomp(cargo_7nt_230c) + l4_can[2857:]

    if revcomp(l4_conv_2strand_230c_minus) != l4_conv_2strand_230c:
        raise ValueError("Convergent Locus 4 chr19:+ vs chr19:- reverse-complement identity failed")
    if revcomp(l4_conv_5nt_230c_minus) != l4_conv_5nt_230c_plus or revcomp(l4_conv_wt_minus) != l4_conv_wt_plus:
        raise ValueError("Convergent Locus 4 2x2 matrix reverse-complement identity failed")
    if not sha256_str(l4_conv_2strand_230c).startswith("70424667") or not sha256_str(l4_conv_2strand_230c_minus).startswith("977495f1"):
        raise ValueError("Convergent Locus 4 SHA-256 prefix verification failed (expected 70424667 / 977495f1)")
    if l4_can.count("CG") != 202 or l4_splice_230c.count("CG") != 203:
        raise ValueError(f"Expected construct-wide Locus 4 CpGs 202 -> 203, got {l4_can.count('CG')} -> {l4_splice_230c.count('CG')}")

    eef_dxs_wt = dxs_l4_wt[1305:1535]
    eef_dxs_230c = eef_dxs_wt[:222] + "C" + eef_dxs_wt[223:228] + "CC"
    dxs_l4_splice_230c_nospa = dxs_l4_wt[:850] + wina_codir_hard + eef_dxs_230c + dxs_l4_wt[1535:]

    astar_stop_only = astar_wt[:1800] + hlae_astar_stop + bgh_wt + astar_wt[3543:]
    astar_full_230c = astar_wt[:1413] + revcomp(eef_230c) + astar_wt[1643:1800] + hlae_astar_stop + bgh_hard + astar_wt[3543:]

    # Verify the verified hash prefixes across primary challengers
    expected_prefixes = {
        "S3_L3_CAN_PDL1_SYN2_4090": (l3_can_syn2, "3cb5ce72"),
        "S3_L3_CAN_PDL1_SYN4_4090": (l3_can_syn4, "ccd86d6a"),
        "S3_L3_CAN_BGH_ONLY_4090": (l3_can_bgh_only, "304a08d9"),
        "S3_L3_SF_PDL1_SYN4_3799": (l3_sf_syn4_only, "a678fade"),
        "S3_L3_SF_SYN4_1xFII80_3879": (l3_sf_syn4_1xfii80, "6d594329"),
        "S3_L4_SPLICE_230C_NOSPA_3457": (l4_splice_230c, "3bc15171"),
        "S3_L4_CONVERGENT_2STRAND_230C_3457": (l4_conv_2strand_230c, "70424667"),
        "S3_L1_ASTAR_STOP_ONLY_4143": (astar_stop_only, "aff2ec0d"),
    }
    for exp_id, (exp_seq, exp_pref) in expected_prefixes.items():
        got_sha = sha256_str(exp_seq)
        if not got_sha.startswith(exp_pref):
            raise ValueError(f"{exp_id} SHA-256 mismatch: expected prefix {exp_pref}, got {got_sha}")

    # Synthesis-ready PAM/seed-shielded comparators (per Stage-0 Playbook unconditional co-conversion rule)
    def _shield_l3_har17(seq_l3: str) -> str:
        har_start = len(seq_l3) - 600
        if seq_l3[har_start + 16] != "G":
            raise ValueError("Expected G at CXCL10_HA_R 1-based position 17 before PAM-shield co-conversion")
        return seq_l3[: har_start + 16] + "C" + seq_l3[har_start + 17 :]

    def _shield_l4_minus_har14(seq_l4_minus: str) -> str:
        har_start = len(seq_l4_minus) - 600
        if seq_l4_minus[har_start + 13] != "G":
            raise ValueError("Expected G at AAVS1_HA_R 1-based position 14 before PAM-shield co-conversion")
        return seq_l4_minus[: har_start + 13] + "C" + seq_l4_minus[har_start + 14 :]

    def _shield_l4_plus_hal587(seq_l4_plus: str) -> str:
        if seq_l4_plus[586] != "C":
            raise ValueError("Expected C at chr19:+ HA_L 1-based position 587 before PAM-shield co-conversion")
        return seq_l4_plus[:586] + "G" + seq_l4_plus[587:]

    b2m_ha_l_600 = arm1b_can[:600]
    b2m_ha_l_s3_only_600 = (
        b2m_ha_l_600[:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:]
    )
    if astar_wt[:600] != b2m_ha_l_s3_only_600:
        raise ValueError("Embodiment A* left homology arm expected to carry S3 PAM+seed shield")

    idx_bfb_pdl1 = l3_bfb_wt.find(pdl1_wt)
    if idx_bfb_pdl1 < 0:
        raise ValueError("Could not locate PD-L1 CDS in L3_BFB_BASALFLOOR_4078")
    l3_bfb_syn4_pam_shielded = l3_bfb_wt[:idx_bfb_pdl1] + pdl1_syn4 + l3_bfb_wt[idx_bfb_pdl1 + len(pdl1_wt) :]

    # 500-aa Arm 1B (3,974 bp) and DX-S Arm 1C constitutive (3,300 bp) G1500C/G1502A stop-only comparators
    arm1b_stop_unshielded_3974 = arm1b_can[:1646] + hlae_arm1b_stop + arm1b_can[3149:]
    arm1b_s3_only_wt_3974 = b2m_ha_l_s3_only_600 + arm1b_can[600:]
    arm1b_stop_s3_only_3974 = b2m_ha_l_s3_only_600 + arm1b_stop_unshielded_3974[600:]
    arm1c_3300_stop_s3_shielded = dxs_arm1c_3300[:972] + hlae_arm1b_stop + dxs_arm1c_3300[2475:]
    arm1c_3300_stop_unshielded = dxs_arm1c_native_3300[:972] + hlae_arm1b_stop + dxs_arm1c_native_3300[2475:]

    pam_shielded_manifest = {
        "policy": (
            "Stage-0 Execution Playbook requires unconditional PAM/seed-shield co-conversion for synthesized HDR donors. "
            "Every Mode-B challenger below is paired with its exact PAM/seed-shielded synthesis-ready donor and matched "
            "PAM/seed-shielded parental control, while preserving the unshielded derivations as reproducible reference hashes."
        ),
        "locus3_cxcl10_ha_r_nt17_g_to_c_pam_shielded": [
            {
                "construct_id": "L3_CAN_WT_PAM_SHIELDED_CONTROL_4090",
                "shield_edit_donor_1based": "G3507C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp",
                "unshielded_sha256": sha256_str(l3_can),
                "donor_length_bp": 4090,
                "packaged_aav6_bp": 4380,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_can)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_can),
            },
            {
                "construct_id": "L3_CAN_PDL1_SYN2_PAM_SHIELDED_4090",
                "shield_edit_donor_1based": "G3507C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "S3_L3_CAN_PDL1_SYN2_4090",
                "unshielded_sha256": sha256_str(l3_can_syn2),
                "donor_length_bp": 4090,
                "packaged_aav6_bp": 4380,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_can_syn2)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_can_syn2),
            },
            {
                "construct_id": "L3_CAN_PDL1_SYN4_PAM_SHIELDED_4090",
                "shield_edit_donor_1based": "G3507C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "S3_L3_CAN_PDL1_SYN4_4090",
                "unshielded_sha256": sha256_str(l3_can_syn4),
                "donor_length_bp": 4090,
                "packaged_aav6_bp": 4380,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_can_syn4)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_can_syn4),
            },
            {
                "construct_id": "L3_CAN_BGH_ONLY_PAM_SHIELDED_4090",
                "shield_edit_donor_1based": "G3507C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "S3_L3_CAN_BGH_ONLY_4090",
                "unshielded_sha256": sha256_str(l3_can_bgh_only),
                "donor_length_bp": 4090,
                "packaged_aav6_bp": 4380,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_can_bgh_only)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_can_bgh_only),
            },
            {
                "construct_id": "L3_CAN_WPRE_ONLY_PAM_SHIELDED_4090",
                "shield_edit_donor_1based": "G3507C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "S3_L3_CAN_WPRE_ONLY_4090",
                "unshielded_sha256": sha256_str(l3_can_wpre_only),
                "donor_length_bp": 4090,
                "packaged_aav6_bp": 4380,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_can_wpre_only)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_can_wpre_only),
            },
            {
                "construct_id": "L3_SF_WT_PAM_SHIELDED_CONTROL_3799",
                "shield_edit_donor_1based": "G3216C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "ISLET1_A4_L3_SCARFREE_3799",
                "unshielded_sha256": sha256_str(l3_sf_wt),
                "donor_length_bp": 3799,
                "packaged_aav6_bp": 4089,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_sf_wt)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_sf_wt),
            },
            {
                "construct_id": "L3_SF_PDL1_SYN4_PAM_SHIELDED_3799",
                "shield_edit_donor_1based": "G3216C (CXCL10_HA_R nt 17 G>C)",
                "unshielded_reference_id": "S3_L3_SF_PDL1_SYN4_3799",
                "unshielded_sha256": sha256_str(l3_sf_syn4_only),
                "donor_length_bp": 3799,
                "packaged_aav6_bp": 4089,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_sf_syn4_only)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_sf_syn4_only),
            },
            {
                "construct_id": "L3_SF_SYN4_1xFII80_PAM_SHIELDED_3879",
                "shield_edit_donor_1based": "G3296C (CXCL10_HA_R nt 17 G>C; 1xFII80 inserted as revcomp(U78775.2:24-103) at 601..680)",
                "unshielded_reference_id": "S3_L3_SF_SYN4_1xFII80_3879",
                "unshielded_sha256": sha256_str(l3_sf_syn4_1xfii80),
                "donor_length_bp": 3879,
                "packaged_aav6_bp": 4169,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_sf_syn4_1xfii80)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_sf_syn4_1xfii80),
            },
            {
                "construct_id": "L3_SF_SYN4_BGH_1xFII80_PAM_SHIELDED_3879",
                "shield_edit_donor_1based": "G3296C (CXCL10_HA_R nt 17 G>C; 1xFII80 inserted as revcomp(U78775.2:24-103) at 601..680)",
                "unshielded_reference_id": "S3_L3_SF_SYN4_BGH_1xFII80_3879",
                "unshielded_sha256": sha256_str(l3_sf_syn4_bgh_1xfii80),
                "donor_length_bp": 3879,
                "packaged_aav6_bp": 4169,
                "pam_shielded_sha256": sha256_str(_shield_l3_har17(l3_sf_syn4_bgh_1xfii80)),
                "pam_shielded_donor_sequence": _shield_l3_har17(l3_sf_syn4_bgh_1xfii80),
            },
            {
                "construct_id": "L3_BFB_PDL1_SYN4_PAM_SHIELDED_4078",
                "shield_edit_donor_1based": "G3495C (inherited CXCL10_HA_R nt 17 G>C on L3_BFB_BASALFLOOR_4078)",
                "unshielded_reference_id": "L3_BFB_BASALFLOOR_4078 (parental already PAM-shielded)",
                "parent_pam_shielded_sha256": sha256_str(l3_bfb_wt),
                "donor_length_bp": 4078,
                "packaged_aav6_bp": 4368,
                "pam_shielded_sha256": sha256_str(l3_bfb_syn4_pam_shielded),
                "pam_shielded_donor_sequence": l3_bfb_syn4_pam_shielded,
            },
        ],
        "locus4_aavs1_pam_shielded_and_unconfounded_2x2_orientation_matrix": {
            "factorial_design_rule": (
                "Isolates orientation (CO_DIRECTIONAL_MINUS vs CONVERGENT_PLUS) from Window A A72T/C73A mutation "
                "via a full 2x2 factorial matrix (5-nt Window A vs 7-nt Window A in both orientations, plus WT-cargo "
                "convergent control and retained IIP-0011 Window B [chr7:26191826-26192280] and No-UCOE arms). "
                "Every convergent arm pins BOTH the GRCh38 chr19:+ representation (55115168..55116367) and its exact "
                "reverse-complement canonical chr19:- representation (l4_can[:600] + revcomp(cargo_601_2857) + l4_can[2857:])."
            ),
            "arms": [
                {
                    "arm_id": "L4_CODIR_WT_PARENTAL_3457",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WT_0NT",
                    "eef1a1_allele": "WT_0NT",
                    "unshielded_chr19_minus_sha256": sha256_str(l4_can),
                    "pam_shielded_chr19_minus_edit": "G2871C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(l4_can)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(l4_can),
                },
                {
                    "arm_id": "L4_CONVERGENT_WT_CARGO_CONTROL_3457",
                    "orientation": "CONVERGENT_PLUS",
                    "window_a_allele": "WT_0NT",
                    "eef1a1_allele": "WT_0NT",
                    "unshielded_chr19_plus_sha256": sha256_str(l4_conv_wt_plus),
                    "unshielded_chr19_minus_revcomp_sha256": sha256_str(l4_conv_wt_minus),
                    "unshielded_chr19_plus_sequence": l4_conv_wt_plus,
                    "pam_shielded_chr19_plus_edit": "C587G (revcomp of AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_plus_sha256": sha256_str(_shield_l4_plus_hal587(l4_conv_wt_plus)),
                    "pam_shielded_chr19_minus_revcomp_sha256": sha256_str(_shield_l4_minus_har14(l4_conv_wt_minus)),
                    "pam_shielded_chr19_plus_sequence": _shield_l4_plus_hal587(l4_conv_wt_plus),
                },
                {
                    "arm_id": "L4_WINA_ONLY_5NT_CODIR_3457",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WINA_CODIR_5NT (A32T,G33C,A444T,G445C,G446C)",
                    "eef1a1_allele": "WT_0NT",
                    "unshielded_chr19_minus_sha256": sha256_str(l4_wina_only),
                    "pam_shielded_chr19_minus_edit": "G2871C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(l4_wina_only)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(l4_wina_only),
                },
                {
                    "arm_id": "L4_EEF230C_ONLY_CODIR_3457",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WT_0NT",
                    "eef1a1_allele": "EEF_230C_3NT (G223C,A229C,G230C)",
                    "unshielded_chr19_minus_sha256": sha256_str(l4_eef230c_only),
                    "pam_shielded_chr19_minus_edit": "G2871C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(l4_eef230c_only)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(l4_eef230c_only),
                },
                {
                    "arm_id": "L4_2X2_CELL1_CODIR_5NT_230C_3457",
                    "alias_construct_id": "S3_L4_SPLICE_230C_NOSPA_3457",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WINA_CODIR_5NT (A32T,G33C,A444T,G445C,G446C)",
                    "eef1a1_allele": "EEF_230C_3NT (G223C,A229C,G230C)",
                    "unshielded_chr19_minus_sha256": sha256_str(l4_splice_230c),
                    "pam_shielded_chr19_minus_edit": "G2871C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(l4_splice_230c)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(l4_splice_230c),
                },
                {
                    "arm_id": "L4_2X2_CELL2_CODIR_7NT_230C_3457",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WINA_2STRAND_7NT (A32T,G33C,A72T,C73A,A444T,G445C,G446C)",
                    "eef1a1_allele": "EEF_230C_3NT (G223C,A229C,G230C)",
                    "unshielded_chr19_minus_sha256": sha256_str(l4_codir_7nt_230c),
                    "unshielded_chr19_minus_sequence": l4_codir_7nt_230c,
                    "pam_shielded_chr19_minus_edit": "G2871C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(l4_codir_7nt_230c)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(l4_codir_7nt_230c),
                },
                {
                    "arm_id": "L4_2X2_CELL3_CONVERGENT_5NT_230C_3457",
                    "orientation": "CONVERGENT_PLUS",
                    "window_a_allele": "WINA_CODIR_5NT (A32T,G33C,A444T,G445C,G446C)",
                    "eef1a1_allele": "EEF_230C_3NT (G223C,A229C,G230C)",
                    "unshielded_chr19_plus_sha256": sha256_str(l4_conv_5nt_230c_plus),
                    "unshielded_chr19_minus_revcomp_sha256": sha256_str(l4_conv_5nt_230c_minus),
                    "unshielded_chr19_plus_sequence": l4_conv_5nt_230c_plus,
                    "pam_shielded_chr19_plus_edit": "C587G (revcomp of AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_plus_sha256": sha256_str(_shield_l4_plus_hal587(l4_conv_5nt_230c_plus)),
                    "pam_shielded_chr19_minus_revcomp_sha256": sha256_str(_shield_l4_minus_har14(l4_conv_5nt_230c_minus)),
                    "pam_shielded_chr19_plus_sequence": _shield_l4_plus_hal587(l4_conv_5nt_230c_plus),
                },
                {
                    "arm_id": "L4_2X2_CELL4_CONVERGENT_7NT_230C_3457",
                    "alias_construct_id": "S3_L4_CONVERGENT_2STRAND_230C_3457",
                    "orientation": "CONVERGENT_PLUS",
                    "window_a_allele": "WINA_2STRAND_7NT (A32T,G33C,A72T,C73A,A444T,G445C,G446C)",
                    "eef1a1_allele": "EEF_230C_3NT (G223C,A229C,G230C)",
                    "unshielded_chr19_plus_sha256": sha256_str(l4_conv_2strand_230c),
                    "unshielded_chr19_minus_revcomp_sha256": sha256_str(l4_conv_2strand_230c_minus),
                    "pam_shielded_chr19_plus_edit": "C587G (revcomp of AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_plus_sha256": sha256_str(_shield_l4_plus_hal587(l4_conv_2strand_230c)),
                    "pam_shielded_chr19_minus_revcomp_sha256": sha256_str(_shield_l4_minus_har14(l4_conv_2strand_230c_minus)),
                    "pam_shielded_chr19_plus_sequence": _shield_l4_plus_hal587(l4_conv_2strand_230c),
                },
                {
                    "arm_id": "L4_DXS_SPLICE_230C_NOSPA_PAM_SHIELDED_4048",
                    "alias_construct_id": "S3_L4_DXS_SPLICE_230C_NOSPA_4048",
                    "orientation": "CO_DIRECTIONAL_MINUS",
                    "window_a_allele": "WINA_CODIR_5NT (A32T,G33C,A444T,G445C,G446C)",
                    "eef1a1_allele": "EEF_5TOP_230C (CTTTTT->CAGAGA + G223C,A229C,G230C)",
                    "unshielded_chr19_minus_sha256": sha256_str(dxs_l4_splice_230c_nospa),
                    "pam_shielded_chr19_minus_edit": "G3462C (AAVS1_HA_R nt 14 G>C)",
                    "pam_shielded_chr19_minus_sha256": sha256_str(_shield_l4_minus_har14(dxs_l4_splice_230c_nospa)),
                    "pam_shielded_chr19_minus_sequence": _shield_l4_minus_har14(dxs_l4_splice_230c_nospa),
                },
            ],
        },
        "locus1_505aa_vs_500aa_stop_seam_comparators": {
            "numbering_separation_rule": (
                "Embodiment A* (4,143 bp) encodes a 505-aa HLA-E SCT precursor (20-aa L1 = (G4S)4, 1,518-bp CDS) whose "
                "stop-seam ablation is SCT-local G1515C/G1517A (Leu505-Stop506 CTG-TGA -> CTC-TAA; already S3 PAM+seed shielded). "
                "Canonical Arm 1B (3,974 bp) and DX-S Arm 1C (3,300 bp / 3,459 bp) encode a 500-aa HLA-E SCT precursor "
                "(15-aa L1 = (G4S)3, 1,503-bp CDS) whose analogous stop-seam ablation is SCT-local G1500C/G1502A "
                "(Leu500-Stop501 CTG-TGA -> CTC-TAA)."
            ),
            "materialized_arms": [
                {
                    "construct_id": "S3_L1_ASTAR_STOP_ONLY_4143",
                    "sct_precursor_aa": 505,
                    "sct_local_edits_1based": ["G1515C", "G1517A"],
                    "donor_edits_1based": ["G3315C", "G3317A"],
                    "pam_seed_shield_status": "ALREADY_S3_SHIELDED (B2M_HA_L T583C,C589A,G592C,G595A)",
                    "donor_length_bp": 4143,
                    "packaged_aav6_bp": 4433,
                    "donor_sha256": sha256_str(astar_stop_only),
                },
                {
                    "construct_id": "L1_ARM1B_STOP_ONLY_UNSHIELDED_REF_3974",
                    "sct_precursor_aa": 500,
                    "sct_local_edits_1based": ["G1500C", "G1502A"],
                    "donor_edits_1based": ["G3146C", "G3148A"],
                    "pam_seed_shield_status": "UNSHIELDED_REFERENCE_DERIVATION",
                    "parent_sha256": sha256_str(arm1b_can),
                    "donor_length_bp": 3974,
                    "packaged_aav6_bp": 4264,
                    "donor_sha256": sha256_str(arm1b_stop_unshielded_3974),
                    "donor_sequence": arm1b_stop_unshielded_3974,
                },
                {
                    "construct_id": "L1_ARM1B_STOP_ONLY_S3_PAM_SHIELDED_3974",
                    "sct_precursor_aa": 500,
                    "sct_local_edits_1based": ["G1500C", "G1502A"],
                    "donor_edits_1based": ["T583C", "C589A", "G592C", "G595A", "G3146C", "G3148A"],
                    "pam_seed_shield_status": "SYNTHESIS_READY_S3_PAM_SEED_SHIELDED",
                    "matched_s3_parent_sha256": sha256_str(arm1b_s3_only_wt_3974),
                    "matched_s3_parent_sequence": arm1b_s3_only_wt_3974,
                    "donor_length_bp": 3974,
                    "packaged_aav6_bp": 4264,
                    "donor_sha256": sha256_str(arm1b_stop_s3_only_3974),
                    "donor_sequence": arm1b_stop_s3_only_3974,
                },
                {
                    "construct_id": "L1_DXS_ARM1C_CONSTITUTIVE_STOP_ONLY_S3_SHIELDED_3300",
                    "sct_precursor_aa": 500,
                    "sct_local_edits_1based": ["G1500C", "G1502A"],
                    "donor_edits_1based": ["G2472C", "G2474A (on S3+uORF+5'TOP shielded 3,300-bp parent)"],
                    "pam_seed_shield_status": "SYNTHESIS_READY_S3_UORF_5TOP_SHIELDED",
                    "matched_shielded_parent_sha256": sha256_str(dxs_arm1c_3300),
                    "donor_length_bp": 3300,
                    "packaged_aav6_bp": 3590,
                    "donor_sha256": sha256_str(arm1c_3300_stop_s3_shielded),
                    "donor_sequence": arm1c_3300_stop_s3_shielded,
                },
                {
                    "construct_id": "L1_DXS_ARM1C_CONSTITUTIVE_STOP_ONLY_UNSHIELDED_REF_3300",
                    "sct_precursor_aa": 500,
                    "sct_local_edits_1based": ["G1500C", "G1502A"],
                    "donor_edits_1based": ["G2472C", "G2474A (on native-parts unshielded 3,300-bp parent)"],
                    "pam_seed_shield_status": "UNSHIELDED_REFERENCE_DERIVATION",
                    "parent_sha256": sha256_str(dxs_arm1c_native_3300),
                    "donor_length_bp": 3300,
                    "packaged_aav6_bp": 3590,
                    "donor_sha256": sha256_str(arm1c_3300_stop_unshielded),
                    "donor_sequence": arm1c_3300_stop_unshielded,
                },
            ],
        },
    }

    selftests = run_adversarial_validator_selftests(
        l3_can_syn2, serpinb9_nostop, pdl1_syn2, l4_splice_230c, icasp9_wt, astar_wt, cd47_astar_wt
    )
    if len(selftests) != 11:
        raise ValueError(f"Expected 11/11 adversarial P1-P4 probes rejected, got {len(selftests)}")

    serpinb9_aa = translate_strict_cds(serpinb9_nostop, False)
    gsg_p2a_stub_aa = translate_strict_cds(gsg_p2a_cds, False)[:-1]
    icasp9_aa = translate_strict_cds(icasp9_wt, True)[:-1]
    hlae_astar_aa = translate_strict_cds(hlae_astar_wt, True)[:-1]
    hlae_arm1b_aa = translate_strict_cds(hlae_arm1b_wt, True)[:-1]
    cd47_aa = translate_strict_cds(cd47_astar_wt, True)[:-1]

    # Offline verification of cryptic HLA-E SCT -> B2M Exon 2 (chr15:44715423) readthrough polypeptide
    def _audit_b2m_exon2_cryptic_tail(sct_cds: str, sct_aa: str, splice_nt: int) -> Dict[str, Any]:
        aberrant_mrna = sct_cds[:splice_nt] + b2m_ex2_seq
        codons = []
        for idx_c in range(0, len(aberrant_mrna) - 2, 3):
            aa_c = GENETIC_CODE[aberrant_mrna[idx_c : idx_c + 3]]
            codons.append(aa_c)
            if aa_c == "*":
                break
        ab_aa = "".join(codons[:-1])
        tail_aa = ab_aa[len(sct_aa) :]
        j_cross = enumerate_junction_peptides(sct_aa, "", tail_aa)
        touch_8_11 = sum(1 for k in (8, 9, 10, 11) for s in range(0, len(ab_aa) - k + 1) if s + k > len(sct_aa))
        touch_15 = sum(1 for s in range(0, len(ab_aa) - 15 + 1) if s + 15 > len(sct_aa))
        return {
            "sct_precursor_aa": len(sct_aa),
            "donor_splice_nt_in_sct_cds": splice_nt,
            "appended_b2m_exon2_plus1_frame_tail_32aa": tail_aa,
            "total_chimeric_polypeptide_aa": len(ab_aa),
            "stop_codon_position_1based": len(ab_aa) + 1,
            "junction_crossing_candidate_windows": j_cross,
            "all_tail_touching_candidate_windows": {
                "count_8_to_11mer": touch_8_11,
                "count_15mer": touch_15,
            },
        }

    astar_tail_audit = _audit_b2m_exon2_cryptic_tail(hlae_astar_wt, hlae_astar_aa, 1514)
    arm1b_tail_audit = _audit_b2m_exon2_cryptic_tail(hlae_arm1b_wt, hlae_arm1b_aa, 1499)
    if (
        astar_tail_audit["total_chimeric_polypeptide_aa"] != 537
        or arm1b_tail_audit["total_chimeric_polypeptide_aa"] != 532
        or astar_tail_audit["appended_b2m_exon2_plus1_frame_tail_32aa"] != "YSKDSGLLTSSSREWKVKFPELLCVWVSSIRH"
        or arm1b_tail_audit["appended_b2m_exon2_plus1_frame_tail_32aa"] != "YSKDSGLLTSSSREWKVKFPELLCVWVSSIRH"
        or astar_tail_audit["junction_crossing_candidate_windows"]["count_8_to_11mer"] != 34
        or astar_tail_audit["junction_crossing_candidate_windows"]["count_15mer"] != 14
        or astar_tail_audit["all_tail_touching_candidate_windows"]["count_8_to_11mer"] != 128
        or astar_tail_audit["all_tail_touching_candidate_windows"]["count_15mer"] != 32
    ):
        raise ValueError("Offline B2M Exon-2 cryptic splice tail audit failed")

    portfolio_check = {
        "VMAPRTLVL_9aa__L1_20aa": enumerate_junction_peptides("VMAPRTLVL", "", "GGGGS" * 4),
        "GAVDPLLAL_9aa__L1_20aa": enumerate_junction_peptides("GAVDPLLAL", "", "GGGGS" * 4),
        "QYDDAVYKL_9aa__L1_20aa": enumerate_junction_peptides("QYDDAVYKL", "", "GGGGS" * 4),
        "CD47_IgV__CD55_stalk_9aa": enumerate_junction_peptides(cd47_aa[18:138], "", "PNKGSGTTS"),
        "L1__B2M": enumerate_junction_peptides("GGGGS" * 4, "", hlae_astar_aa[49:148]),
        "B2M__L2": enumerate_junction_peptides(hlae_astar_aa[49:148], "", "GGGGS" * 4),
        "L2__HLAE_alpha1": enumerate_junction_peptides("GGGGS" * 4, "", hlae_astar_aa[168:]),
        "SERPINB9__GSG_P2A_21aa": enumerate_junction_peptides(serpinb9_aa, "", gsg_p2a_stub_aa),
        "FKBP12__SGGGSG__dCasp9": enumerate_junction_peptides(icasp9_aa[:108], "SGGGSG", icasp9_aa[114:]),
    }
    portfolio_sum_8_11 = sum(v["count_8_to_11mer"] for v in portfolio_check.values())
    portfolio_sum_15 = sum(v["count_15mer"] for v in portfolio_check.values())
    if portfolio_sum_8_11 != 326 or portfolio_sum_15 != 112:
        raise ValueError("Portfolio 9-boundary peptide window audit failed")

    l3_can_juncs = [{"junction_id": "SERPINB9_365_376__GSG_P2A_21aa_stub", "left_aa": serpinb9_aa, "linker_aa": "", "right_aa": gsg_p2a_stub_aa}]
    l4_juncs = [{"junction_id": "FKBP12F36V__SGGGSG__dCasp9", "left_aa": icasp9_aa[:108], "linker_aa": "SGGGSG", "right_aa": icasp9_aa[114:]}]
    l1_astar_juncs = [
        {"junction_id": "VMAPRTLVL__G4S4_L1", "left_aa": hlae_astar_aa[20:29], "linker_aa": "", "right_aa": hlae_astar_aa[29:49]},
        {"junction_id": "G4S4_L1__B2M_mature", "left_aa": hlae_astar_aa[29:49], "linker_aa": "", "right_aa": hlae_astar_aa[49:148]},
        {"junction_id": "B2M_mature__G4S4_L2", "left_aa": hlae_astar_aa[49:148], "linker_aa": "", "right_aa": hlae_astar_aa[148:168]},
        {"junction_id": "G4S4_L2__HLAE_alpha1", "left_aa": hlae_astar_aa[148:168], "linker_aa": "", "right_aa": hlae_astar_aa[168:]},
        {"junction_id": "CD47_IgV_19_138__CD55_stalk_139_147", "left_aa": cd47_aa[18:138], "linker_aa": "", "right_aa": cd47_aa[138:147]},
    ]

    construct_specs = [
        ("S3_L3_CAN_PDL1_SYN2_4090", "L3 canonical coding-only challenger: single synonymous PD-L1 C720T/G723C (intact WPRE & bGH)", l3_can_syn2, l3_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L3_CANONICAL_4090)",
         [{"name": "SERPINB9_nostop", "start_0based": 609, "end_0based": 1737, "strand": "+", "has_stop": False, "parent_cds": serpinb9_nostop, "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": True},
          {"name": "PDL1_stop", "start_0based": 1803, "end_0based": 2676, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         l3_can_juncs, 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["SERPINB9_C_terminal_21aa_GSG_P2A_stub_requires_GzmB_kinetics_assay"]),
        ("S3_L3_CAN_PDL1_SYN4_4090", "L3 canonical dual-synonymous challenger: PD-L1 C720T/G723C/C858T/G861C (intact WPRE & bGH)", l3_can_syn4, l3_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L3_CANONICAL_4090)",
         [{"name": "SERPINB9_nostop", "start_0based": 609, "end_0based": 1737, "strand": "+", "has_stop": False, "parent_cds": serpinb9_nostop, "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": True},
          {"name": "PDL1_stop", "start_0based": 1803, "end_0based": 2676, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         l3_can_juncs, 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["SERPINB9_C_terminal_21aa_GSG_P2A_stub_requires_GzmB_kinetics_assay"]),
        ("S3_L3_CAN_BGH_ONLY_4090", "Single-factor L3 non-coding control: bGH G140T/G143T/G144T only", l3_can_bgh_only, l3_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L3_CANONICAL_4090)",
         [{"name": "SERPINB9_nostop", "start_0based": 609, "end_0based": 1737, "strand": "+", "has_stop": False, "parent_cds": serpinb9_nostop, "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": True},
          {"name": "PDL1_stop", "start_0based": 1803, "end_0based": 2676, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         l3_can_juncs, 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["bGH_proximal_downstream_edits_require_3RACE_cleavage_and_protein_verification"]),
        ("S3_L3_CAN_WPRE_ONLY_4090", "Single-factor L3 exploratory control: WPRE C261A (J04514.1:g.1353C>A) only; excluded from primary arms because it creates sense CAT|GTCAGC", l3_can_wpre_only, l3_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L3_CANONICAL_4090)",
         [{"name": "SERPINB9_nostop", "start_0based": 609, "end_0based": 1737, "strand": "+", "has_stop": False, "parent_cds": serpinb9_nostop, "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": True},
          {"name": "PDL1_stop", "start_0based": 1803, "end_0based": 2676, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         l3_can_juncs, 34, 14, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["WPRE_g1353C_to_A_excluded_from_primary_due_to_3UTR_and_neo_sense_donor"]),
        ("S3_L3_SF_PDL1_SYN4_3799", "Scar-free L3 coding-only challenger: dual synonymous PD-L1 C720T/G723C/C858T/G861C (intact bGH)", l3_sf_syn4_only, l3_sf_wt, "ISLET1_A4_L3_SCARFREE_3799",
         [{"name": "SERPINB9_scarfree_stop", "start_0based": 609, "end_0based": 1740, "strand": "+", "has_stop": True, "parent_cds": l3_sf_wt[609:1740], "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": False},
          {"name": "PDL1_stop", "start_0based": 2101, "end_0based": 2974, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         [], 0, 0, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["Dual_promoter_scarfree_expression_kinetics_pending_Readout4"]),
        ("S3_L3_SF_SYN4_1xFII80_3879", "Optional single-sided 80-bp cHS4 FII inserted as revcomp(U78775.2:24-103) at 601..680 + scar-free PD-L1 SYN4 (requires absolute resting and IFN-induced SERPINB9/PD-L1/CXCL9/CXCL11 gates)", l3_sf_syn4_1xfii80, l3_sf_wt, "ISLET1_A4_L3_SCARFREE_3799",
         [{"name": "SERPINB9_scarfree_stop", "start_0based": 689, "end_0based": 1820, "strand": "+", "has_stop": True, "parent_cds": l3_sf_wt[609:1740], "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": False},
          {"name": "PDL1_stop", "start_0based": 2181, "end_0based": 3054, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         [], 0, 0, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["Single_80bp_FII_revcomp_enhancer_blocker_not_barrier_insulator_pending_Readout4"]),
        ("S3_L3_SF_SYN4_BGH_1xFII80_3879", "Optional single-sided 80-bp cHS4 FII revcomp(U78775.2:24-103) + scar-free PD-L1 SYN4 + bGH G140T/G143T/G144T comparator", l3_sf_syn4_bgh_1xfii80, l3_sf_wt, "ISLET1_A4_L3_SCARFREE_3799",
         [{"name": "SERPINB9_scarfree_stop", "start_0based": 689, "end_0based": 1820, "strand": "+", "has_stop": True, "parent_cds": l3_sf_wt[609:1740], "topology_kind": "CYTOSOLIC_SERPINB9", "has_downstream_2a": False},
          {"name": "PDL1_stop", "start_0based": 2181, "end_0based": 3054, "strand": "+", "has_stop": True, "parent_cds": pdl1_wt, "topology_kind": "TYPE1_TM_PDL1", "has_downstream_2a": False}],
         [], 0, 0, 34, 14, ["1IAU", "4GA7", "8ZCR", "4ZQK"], ["Single_80bp_FII_revcomp_and_bGH_edits_pending_Readout4"]),
        ("S3_L4_WINA_ONLY_3457", "Single-factor L4 control: Window A A32T/G33C/A444T/G445C/G446C only (47 CpGs, intact EEF1A1, NO SPA)", l4_wina_only, l4_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L4_WINA_CODIR_3457)",
         [{"name": "iCasp9_stop", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "parent_cds": icasp9_wt, "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": False}],
         l4_juncs, 58, 20, 58, 20, ["1BL4", "1JXQ", "1NW9"], ["FULL_FUSION_UNRESOLVED_IIP_0011", "WindowA_anti_silencing_transfer_pending_Readout6"]),
        ("S3_L4_EEF230C_ONLY_3457", "Single-factor L4 control: corrected EEF1A1 G223C/A229C/G230C only (19 part CpGs, +1 seam CpG, construct CpGs 203 vs 202, NO SPA)", l4_eef230c_only, l4_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L4_WINA_CODIR_3457)",
         [{"name": "iCasp9_stop", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "parent_cds": icasp9_wt, "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": False}],
         l4_juncs, 58, 20, 58, 20, ["1BL4", "1JXQ", "1NW9"], ["FULL_FUSION_UNRESOLVED_IIP_0011", "EEF1A1_5UTR_edits_require_translation_and_Readout6_verification"]),
        ("S3_L4_SPLICE_230C_NOSPA_3457", "Co-directional L4 internal-intron-ablated challenger: Window A (5 nt) + EEF1A1[230C] (3 nt), NO SPA (retains 122-bp SV40pA 2736..2857 and iCasp9 CDS[11..12] AG on PPP1R12C strand)", l4_splice_230c, l4_can, "ISLET1_A4_ARM1A / ISLET1_A4_ARM1B (L4_WINA_CODIR_3457)",
         [{"name": "iCasp9_stop", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "parent_cds": icasp9_wt, "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": False}],
         l4_juncs, 58, 20, 58, 20, ["1BL4", "1JXQ", "1NW9"], ["FULL_FUSION_UNRESOLVED_IIP_0011", "Co_directional_SV40pA_and_iCasp9_CDS13_acceptor_exposed_to_PPP1R12C_Ex1_requires_RACE_and_Tier6A_6B"]),
        ("S3_L4_CONVERGENT_2STRAND_230C_3457", "Convergent two-strand-hardened L4 challenger on GRCh38 chr19:+ (revcomp of 977495f1... on chr19:-): Window A (7 nt) + EEF1A1[230C] (3 nt), NO SPA", l4_conv_2strand_230c, l4_conv_wt_plus, "L4_WINA_CONVERGENT_3457",
         [{"name": "iCasp9_stop", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "parent_cds": icasp9_wt, "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": False}],
         l4_juncs, 58, 20, 58, 20, ["1BL4", "1JXQ", "1NW9"], ["FULL_FUSION_UNRESOLVED_IIP_0011", "Convergent_PPP1R12C_transcriptional_interference_and_dsRNA_collision_gate_required"]),
        ("S3_L4_DXS_SPLICE_230C_NOSPA_4048", "DX-S Locus 4 splice-only comparator (Window A 5 nt + EEF1A1_5TOP G223C/A229C/G230C, NO SPA, 4,048 bp)", dxs_l4_splice_230c_nospa, dxs_l4_wt, "ISLET1_A4_DXS_ARM1C_L4CD47",
         [{"name": "iCasp9_nostop", "start_0based": 1544, "end_0based": 2732, "strand": "+", "has_stop": False, "parent_cds": dxs_l4_wt[1544:2732], "topology_kind": "CYTOSOLIC_ICASP9", "has_downstream_2a": True},
          {"name": "CD47_IgV_GPI_stop", "start_0based": 2798, "end_0based": 3326, "strand": "+", "has_stop": True, "parent_cds": dxs_l4_wt[2798:3326], "topology_kind": "GPI_ANCHORED_CD47_IGV", "has_downstream_2a": False}],
         l4_juncs + [{"junction_id": "iCasp9__GSG_P2A_21aa_stub", "left_aa": icasp9_aa, "linker_aa": "", "right_aa": gsg_p2a_stub_aa},
                     {"junction_id": "CD47_IgV_19_138__CD55_stalk_139_147", "left_aa": cd47_aa[18:138], "linker_aa": "", "right_aa": cd47_aa[138:147]}],
         58 + 34 + 33, 20 + 14 + 9, 58 + 34 + 33, 20 + 14 + 9, ["1BL4", "1JXQ", "1NW9", "2JJS", "4CMM", "4KJY"], ["FULL_FUSION_UNRESOLVED_IIP_0011", "DXS_co_located_CD47_iCasp9_joint_retention_required"]),
        ("S3_L1_ASTAR_STOP_ONLY_4143", "Primary L1 Embodiment A* coding-only challenger (505-aa SCT): HLA-E SCT G1515C/G1517A (CTC-TAA) ONLY (already S3 PAM+seed shielded)", astar_stop_only, astar_wt, "ISLET1_A4_ARM1B (ISLET1_A_STAR_4LOCUS)",
         [{"name": "CD47_IgV_GPI_antisense", "start_0based": 876, "end_0based": 1404, "strand": "-", "has_stop": True, "parent_cds": cd47_astar_wt, "topology_kind": "GPI_ANCHORED_CD47_IGV", "has_downstream_2a": False},
          {"name": "HLAE_SCT_20aaL1_sense", "start_0based": 1800, "end_0based": 3318, "strand": "+", "has_stop": True, "parent_cds": hlae_astar_wt, "topology_kind": "TYPE1_TM_HLAE_SCT", "has_downstream_2a": False}],
         l1_astar_juncs, 168, 60, 168, 60, ["3CDG", "1MHE", "3BZE", "2JJS", "4CMM", "4KJY"], ["GY-009_Hour0_HLAE_CD47_QuantiBRITE_surface_stoichiometry_pending", "NKG2A_vs_NKG2C_SCT_SPR_pending"]),
        ("S3_L1_ASTAR_FULL_230C_4143", "Combined L1 Embodiment A* comparator (505-aa SCT): SCT CTC-TAA + bGH G140T/G143T/G144T + antisense EEF1A1 G223C/A229C/G230C", astar_full_230c, astar_wt, "ISLET1_A4_ARM1B (ISLET1_A_STAR_4LOCUS)",
         [{"name": "CD47_IgV_GPI_antisense", "start_0based": 876, "end_0based": 1404, "strand": "-", "has_stop": True, "parent_cds": cd47_astar_wt, "topology_kind": "GPI_ANCHORED_CD47_IGV", "has_downstream_2a": False},
          {"name": "HLAE_SCT_20aaL1_sense", "start_0based": 1800, "end_0based": 3318, "strand": "+", "has_stop": True, "parent_cds": hlae_astar_wt, "topology_kind": "TYPE1_TM_HLAE_SCT", "has_downstream_2a": False}],
         l1_astar_juncs, 168, 60, 168, 60, ["3CDG", "1MHE", "3BZE", "2JJS", "4CMM", "4KJY"], ["GY-009_Hour0_HLAE_CD47_QuantiBRITE_surface_stoichiometry_pending", "bGH_and_antisense_EEF1A1_processing_pending"]),
    ]

    qualified_constructs = []
    for cid, desc, dseq, pseq_for_diff, parent_id, orfs, jspecs, p8, p15, r8, r15, pdbs, flags in construct_specs:
        gate_res = validate_p1_to_p4_fail_closed(cid, dseq, orfs, jspecs, p8, p15, r8, r15, pdbs, flags)
        gram_scan = scan_donors_and_acceptors_both_strands(dseq)
        rep_scan = longest_repeats(dseq)
        neos = diff_edit_created_neosites(pseq_for_diff, dseq) if len(pseq_for_diff) == len(dseq) else {"note": "length_changed_insulator_insertion"}
        qualified_constructs.append(
            {
                "construct_id": cid,
                "parent_product_and_donor_id": parent_id,
                "description": desc,
                "donor_length_bp": len(dseq),
                "packaged_aav6_bp": len(dseq) + 290,
                "donor_sha256": sha256_str(dseq),
                "donor_sequence": dseq,
                "repeat_scan": rep_scan,
                "open_grammar_motif_counts": {
                    "strong_donors_both_strands": gram_scan["total_donors"],
                    "strong_donors_cv_ge_74": gram_scan["donors_cv_ge_74"],
                    "cargo_donors": gram_scan["cargo_donors"],
                    "strong_acceptors_both_strands": gram_scan["total_acceptors"],
                    "cargo_acceptors": gram_scan["cargo_acceptors"],
                    "top_5_donors": gram_scan["donors"][:5],
                    "top_5_acceptors": gram_scan["acceptors"][:5],
                },
                "edit_created_neosite_check": neos,
                "p1_to_p4_fail_closed_gate": gate_res,
            }
        )

    parental_open_scans = {}
    for pid, pseq in [
        ("L1_ARM1A_CANONICAL_4880", arm1a_can),
        ("L1_ARM1B_CANONICAL_3974", arm1b_can),
        ("L1_EMBODIMENT_A_STAR_4143", astar_wt),
        ("L3_CANONICAL_4090", l3_can),
        ("L3_SCARFREE_3799", l3_sf_wt),
        ("L3_BFB_BASALFLOOR_4078", l3_bfb_wt),
        ("L4_WINA_CODIR_3457", l4_can),
        ("L4_DXS_CD47_ICASP9_4048", dxs_l4_wt),
        ("L1_DXS_ARM1C_CONSTITUTIVE_3300", dxs_arm1c_3300),
        ("L1_DXS_ARM1C_TRAPPED_3459", dxs_arm1c_3459),
    ]:
        g = scan_donors_and_acceptors_both_strands(pseq)
        parental_open_scans[pid] = {
            "donor_length_bp": len(pseq),
            "donor_sha256": sha256_str(pseq),
            "donor_cpg_count": pseq.count("CG"),
            "repeat_scan": longest_repeats(pseq),
            "census_summary": {
                "total_donors_cv74_or_u1_7": g["total_donors"],
                "donors_cv_ge_74": g["donors_cv_ge_74"],
                "cargo_donors_total": g["cargo_donors"],
                "cargo_donors_plus_strand": g["cargo_donors_plus_strand"],
                "cargo_donors_minus_strand": g["cargo_donors_minus_strand"],
                "total_acceptors_idx_ge_68": g["total_acceptors"],
                "cargo_acceptors_total": g["cargo_acceptors"],
            },
            "top_10_donors_both_strands": g["donors"][:10],
            "top_10_acceptors_both_strands": g["acceptors"][:10],
        }

    fwd_span = (850 + 380, 850 + 405)            # WindowA[380..405] -> donor 1230..1255 (26 nt)
    rev_matched_span = (1544 + 105, 1544 + 125)  # iCasp9[105..125]  -> donor 1649..1669 (21 nt, dTm = 0.01 C)
    rev_legacy_span = (1544 + 40, 1544 + 65)     # iCasp9[40..65]    -> donor 1584..1609 (26 nt, antisense)
    fwd_seq = l4_can[fwd_span[0] - 1 : fwd_span[1]]
    rev_matched_seq = revcomp(l4_can[rev_matched_span[0] - 1 : rev_matched_span[1]])
    rev_legacy_seq = revcomp(l4_can[rev_legacy_span[0] - 1 : rev_legacy_span[1]])
    unspl_matched = rev_matched_span[1] - fwd_span[0] + 1
    unspl_legacy = rev_legacy_span[1] - fwd_span[0] + 1
    if unspl_matched != 440 or unspl_legacy != 380:
        raise ValueError("Locus 4 targeted splice RT-PCR amplicon arithmetic mismatch")

    return {
        "proposal_id": "IIP-0015",
        "decision_id": "DEC-092",
        "mode_b_invariance_contract": {
            "reference_fasta_unchanged": True,
            "layer1_stack_ranking_unchanged": True,
            "existing_release_gates_unchanged": True,
            "family_b_materialization_scope": (
                "All 9 Family-B product entries in data/protocols/islet1_product_definitions_v0.8.0.json remain "
                "REQUIRES_DONOR_SEQUENCE_MATERIALIZATION (execution_supported=false) and are ineligible for synthesis "
                "until materialized donors pass this identical open two-strand splice/repeat census and fail-closed P1-P4 validator."
            ),
        },
        "scanner_methodology_and_scope_limits": {
            "donor_9mer_models": "Shapiro & Senapathy 1987 (PMID:3658675) CV, Yeo & Burge 2004 (PMID:15285897) log-odds bits, and Roca et al. 2013 (PMID:23348838) 9-nt U1 Watson-Crick + G:U/G:psi wobble base-pairing.",
            "acceptor_23mer_model": "Explicitly labelled heuristic 23-mer polypyrimidine/-3/+1 index (not a trained neural splice predictor).",
            "known_heuristic_limits": (
                "Because mammalian splicing also uses non-GT canonical GC-AG / AT-AC introns, bulged/shifted U1 registers "
                "(Roca et al. 2013 PMID:23348838), branchpoints, and exonic/intronic splicing enhancers/silencers, sequence "
                "scores prioritize Stage-0 edits while wet-lab 5'/3'-RACE and UMI-tagged long-read cDNA sequencing are decisive."
            ),
        },
        "genomic_boundary_provenance": {
            "locus3_art3_isoform_reconciliation": art3_model,
            "locus4_window_a_cbx3_isoform_parentage": cbx3_win_a_model,
            "locus4_spa_and_sv40pa_scope_rule": (
                "Levitt et al. 1989 (PMID:2570734) showed an intronic SPA placed inside rabbit beta-globin intron 2 caused "
                "no detectable premature cleavage while its intact upstream 5' splice donor outcompeted polyadenylation, and "
                "restored SPA cleavage only when the upstream donor was deleted; intronic SPA is therefore a context-dependent "
                "premature-cleavage hazard under weakened/distant splice competition rather than unconditional host-gene failure. "
                "Critically, co-directional SPA-free Locus 4 constructs still retain the 122-bp SV40 late poly(A) (donor 2736..2857) "
                "and iCasp9 CDS[11..12] AG acceptor on the PPP1R12C transcription strand, so Readout 6 explicitly profiles PPP1R12C "
                "Exon-1->Exon-2 splicing, Exon-1->cassette capture, and premature 3' cleavage at SV40pA across all arms."
            ),
            "locus4_cpg_accounting": {
                "window_a_455bp_internal_cpgs": {"wt": wina_wt.count("CG"), "codir_5nt": wina_codir_hard.count("CG"), "twostrand_7nt": wina_2strand_hard.count("CG")},
                "eef1a1_230bp_internal_cpgs": {"wt": eef_wt.count("CG"), "s3_230c": eef_230c.count("CG"), "historical_230a": eef_230a_historical.count("CG")},
                "eef1a1_230c_kozak_seam_delta_cpg": 1,
                "whole_3457bp_donor_cpgs": {"parental_l4_can": l4_can.count("CG"), "s3_l4_splice_230c": l4_splice_230c.count("CG")},
            },
            "locus4_downstream_icasp9_cds13_acceptor": icasp9_cds13_acceptor,
        },
        "aberrant_locus1_sct_to_b2m_exon2_cryptic_splice_audit": {
            "embodiment_a_star_505aa_sct1514_audit": astar_tail_audit,
            "arm1b_and_arm1c_500aa_sct1499_audit": arm1b_tail_audit,
            "candidate_window_interpretation": "Deterministic positional 8..11-mer and 15-mer candidate peptide windows; empirical MHC presentation requires wet-lab immunopeptidomics or T-cell assays.",
        },
        "portfolio_chimeric_boundary_reconciliation": {
            "nine_boundaries_8_11mer": portfolio_sum_8_11,
            "nine_boundaries_15mer_full_polypeptide": portfolio_sum_15,
            "ten_boundaries_with_hlac_l2_alpha1_15mer_full_polypeptide": portfolio_sum_15 + 14,
            "legacy_snippet_scoped_15mer_constant_retained": 136,
        },
        "validator_fail_closed_adversarial_selftests": selftests,
        "parental_open_grammar_scans": parental_open_scans,
        "qualified_mode_b_reference_derivations": qualified_constructs,
        "pam_seed_shielded_synthesis_ready_manifest": pam_shielded_manifest,
        "rtpcr_amplicon_and_ivt_umi_assay_contract": {
            "endoc_bh1_ppp1r12c_minigene_first_screen": (
                "Blinded host-context human beta-cell minigene screen in EndoC-betaH1 spanning PPP1R12C Exon 1 - Intron 1 "
                "(chr19:55115767|55115768) - Exon 2 comparing parental co-directional Window A, co-directional 5-nt + 230C, "
                "co-directional 7-nt + 230C, convergent WT-cargo, convergent 5-nt + 230C, convergent 7-nt + 230C, Window B, "
                "and No-UCOE prior to clonal hPSC scaling."
            ),
            "locus4_internal_splice_rtpcr_tm_matched_primary": {
                "forward_primer_WindowA_380_405_sense": fwd_seq,
                "forward_primer_scope": "Interrogates transcripts initiating upstream of EEF1A1 TSS (inside Window A); never used as the denominator for canonical EEF1A1-initiated iCasp9 mRNA.",
                "forward_tm_sl98_c": nearest_neighbor_tm_sl98(fwd_seq),
                "reverse_primer_iCasp9_105_125_antisense": rev_matched_seq,
                "reverse_tm_sl98_c": nearest_neighbor_tm_sl98(rev_matched_seq),
                "delta_tm_c": round(abs(nearest_neighbor_tm_sl98(fwd_seq) - nearest_neighbor_tm_sl98(rev_matched_seq)), 2),
                "unspliced_amplicon_bp": unspl_matched,
                "spliced_233nt_intron_WinA445_to_EEF222_223AG_bp": unspl_matched - 233,
                "spliced_240nt_intron_WinA445_to_EEF229_230AG_bp": unspl_matched - 240,
                "spliced_241nt_intron_historical_230A_seam_AG_bp": unspl_matched - 241,
            },
            "locus4_internal_splice_rtpcr_iCasp9_40_65_antisense_reference": {
                "forward_primer_WindowA_380_405_sense": fwd_seq,
                "reverse_primer_iCasp9_40_65_antisense": rev_legacy_seq,
                "unspliced_amplicon_bp": unspl_legacy,
                "spliced_233nt_intron_bp": unspl_legacy - 233,
                "spliced_240nt_intron_bp": unspl_legacy - 240,
                "spliced_241nt_intron_historical_230A_bp": unspl_legacy - 241,
            },
            "ivt_rna_recovery_adjusted_umi_and_tost_rules": {
                "recovery_standard_requirement": (
                    "Synthetic chimeric in vitro transcribed (IVT) RNA recovery standards spiked into total cellular RNA "
                    "prior to extraction and reverse transcription (a post-RT cDNA spike-in alone cannot qualify extraction/RT/length recovery)."
                ),
                "effective_umi_denominator_formula": "N_UMI_eff = N_UMI * min(1.0, eta_rel), where eta_rel is pre-extraction chimeric IVT RNA recovery relative to canonical reference RNA.",
                "zero_event_min_effective_umi_two_sided_95_lt_0p10pct": math.ceil(math.log(0.025) / math.log(1.0 - 0.001)),
                "nominal_3700_two_sided_95_upper_bound_pct": round(100.0 * (1.0 - 0.025 ** (1.0 / 3700.0)), 8),
                "nominal_3700_one_sided_95_upper_bound_pct": round(100.0 * (1.0 - 0.05 ** (1.0 / 3700.0)), 8),
                "host_exon_retention_equivalence_test": "Two one-sided 95% tests (90% CI TOST) strictly within [0.80, 1.25] relative to matched parental control across >= 3 independent clones per arm; any host isoform below LOQ routes to HOLD rather than passing by division noise.",
                "convergent_dsrna_and_isg_hold_ceiling": "Upper 95% confidence bound on anti-dsRNA J2 / strand-specific antisense readthrough / IFIT1-OAS1-ISG15 panel <= 1.5x unedited parental control.",
                "non_pooling_rule": "Clone-, arm-, locus-, strand-, and orientation-level measurements are evaluated without pooling across clones or conditions.",
                "tier_6b_safety_precedence": "RNA splice bounds never substitute for Tier 6A 10 nM AP1903 killing or Tier 6B N_eff >= 10^7 clonogenic escape testing.",
            },
        },
        "primary_literature_pmids": [
            "PMID:10458613", "PMID:9012826", "PMID:25580597", "PMID:25497547", "PMID:19262615",
            "PMID:10074136", "PMID:2570734", "PMID:26455413", "PMID:25605798", "PMID:28860464",
            "PMID:19904234", "PMID:28723575", "PMID:36055241", "PMID:37156915", "PMID:35795779",
            "PMID:38508139", "PMID:28504668", "PMID:1644817", "PMID:9573279", "PMID:28801671",
            "PMID:22696657", "PMID:21964334", "PMID:28462820", "PMID:32053646", "PMID:3658675",
            "PMID:15285897", "PMID:23348838", "PMID:26602187", "PMID:39382088",
        ],
    }


def _is_finite_real(value: Any) -> bool:
    if isinstance(value, bool) or not isinstance(value, (int, float)):
        return False
    try:
        return math.isfinite(float(value))
    except OverflowError:
        return False


def scan_jaspar_pwm(
    seq: str,
    pwm_entry: Dict[str, Any],
    top_k: int = 3,
    n_matrices_in_scan: int = 6,
    pseudocount: float = 0.8,
    actual_family_total_tests: Optional[int] = None,
) -> Dict[str, Any]:
    """
    Scan DNA sequence on both strands with a JASPAR log2-odds PWM and calibrate
    scores against BOTH an analytical uniform background and a 2,000-window empirical
    Markov-0 mononucleotide-composition background null distribution (closes AUDIT-REF,
    AUDIT-REF, AUDIT-REF, and AUDIT-REF).
    Supports both production pseudocount alpha = 0.8 and sensitivity comparator alpha = 0.5.
    """
    if not isinstance(seq, str):
        raise TypeError("PWM scan sequence must be a string")
    if type(top_k) is not int or top_k < 0 or type(n_matrices_in_scan) is not int or n_matrices_in_scan <= 0:
        raise ValueError("PWM result limit and matrix-family size must be nonnegative/positive integers")
    if actual_family_total_tests is not None and (type(actual_family_total_tests) is not int or actual_family_total_tests < 0):
        raise ValueError("actual_family_total_tests must be a nonnegative integer when provided")
    if not _is_finite_real(pseudocount) or float(pseudocount) <= 0.0:
        raise ValueError("PWM pseudocount must be finite and positive")
    pseudocount_f = float(pseudocount)
    raw_seq = str(seq)
    lowercase_normalized_cnt = sum(1 for ch in raw_seq if ch in "acgt")
    seq = raw_seq.upper()
    non_acgt_ambiguous_cnt = sum(1 for ch in seq if ch not in "ACGT")

    if not isinstance(pwm_entry, dict):
        raise ValueError("PWM entry must be a dictionary")
    w = pwm_entry.get("length")
    if type(w) is not int or w <= 0:
        raise ValueError("PWM width must be a positive integer")
    pfm_counts = pwm_entry.get("pfm_counts")
    for label, matrix in (("log2_odds_pwm", pwm_entry.get("log2_odds_pwm")), ("pfm_counts", pfm_counts)):
        if label == "pfm_counts" and matrix is None:
            continue
        if not isinstance(matrix, dict) or set(matrix) != set("ACGT") or any(not isinstance(matrix[b], list) or len(matrix[b]) != w for b in "ACGT"):
            raise ValueError(f"{label} must have four complete A/C/G/T rows")
        if any(not _is_finite_real(v) or (label == "pfm_counts" and float(v) < 0.0) for b in "ACGT" for v in matrix[b]):
            raise ValueError(f"Invalid finite numeric values in {label}")
    if pwm_entry.get("pfm_counts_sha256") is not None:
        if not isinstance(pfm_counts, dict) or sha256_str(json.dumps(pfm_counts, sort_keys=True)) != pwm_entry["pfm_counts_sha256"]:
            raise ValueError(f"JASPAR pfm_counts_sha256 mismatch in {pwm_entry.get('matrix_id')}")
    if pwm_entry.get("pwm_matrix_sha256") is not None:
        if sha256_str(json.dumps(pwm_entry["log2_odds_pwm"], sort_keys=True, separators=(",", ":"))) != pwm_entry["pwm_matrix_sha256"]:
            raise ValueError(f"JASPAR pwm_matrix_sha256 mismatch in {pwm_entry.get('matrix_id')}")
    pfm_verified = False
    if abs(pseudocount_f - 0.8) <= 1e-9:
        pwm = pwm_entry["log2_odds_pwm"]
        if isinstance(pfm_counts, dict):
            for j in range(w):
                col_sum = sum(float(pfm_counts[b][j]) for b in "ACGT")
                for b in "ACGT":
                    expected_w = round(math.log2(((float(pfm_counts[b][j]) + 0.8) / (col_sum + 3.2)) / 0.25), 4)
                    if abs(expected_w - float(pwm[b][j])) > 5e-5:
                        raise ValueError(f"JASPAR PFM-to-PWM mismatch in {pwm_entry['matrix_id']} col {j} base {b}")
            pfm_verified = True
    else:
        if not isinstance(pfm_counts, dict):
            raise ValueError(f"Cannot recompute PWM at pseudocount={pseudocount_f} without pfm_counts in {pwm_entry.get('matrix_id')}")
        pwm = {b: [] for b in "ACGT"}
        for j in range(w):
            col_sum = sum(float(pfm_counts[b][j]) for b in "ACGT")
            for b in "ACGT":
                w_val = round(
                    math.log2(((float(pfm_counts[b][j]) + pseudocount_f) / (col_sum + 4.0 * pseudocount_f)) / 0.25),
                    4,
                )
                pwm[b].append(w_val)
        pfm_verified = True

    # Every score and null calculation must consume the same declared lattice.
    # Otherwise a rounded observed score can exceed its unrounded maximum and
    # can lie above every unrounded Monte Carlo draw of the very same word.
    if any(abs(float(value) - round(float(value), 4)) > 1e-10 for b in "ACGT" for value in pwm[b]):
        raise ValueError("PWM weights must lie on the declared 0.0001-bit lattice")
    pwm = {b: [round(float(value), 4) for value in pwm[b]] for b in "ACGT"}
    scale_int = 10000
    try:
        col_int = [{b: int(round(pwm[b][j] * scale_int)) for b in "ACGT"} for j in range(w)]
    except (ValueError, OverflowError) as exc:
        raise ValueError("PWM integer lattice exceeds the finite numeric domain") from exc
    # The six retained reference matrices use fewer than 1.4 million states.
    # Reject a wider dense lattice before allocating an input-controlled array.
    lattice_states = 1 + sum(max(column.values()) - min(column.values()) for column in col_int)
    if lattice_states > 2_000_000:
        raise ValueError("PWM exact null exceeds the supported 2,000,000-state lattice")

    max_possible_int = sum(max(column.values()) for column in col_int)
    min_possible_int = sum(min(column.values()) for column in col_int)
    support_width_int = max_possible_int - min_possible_int

    # 1. Analytical mean and SD under uniform 0.25 background
    null_mean = sum(0.25 * (pwm["A"][i] + pwm["C"][i] + pwm["G"][i] + pwm["T"][i]) for i in range(w))
    null_var = sum(
        0.25 * sum((pwm[b][i] - 0.25 * (pwm["A"][i] + pwm["C"][i] + pwm["G"][i] + pwm["T"][i])) ** 2 for b in "ACGT")
        for i in range(w)
    )
    null_sd = math.sqrt(max(null_var, 1e-9))

    # 2. Exact discrete Markov-0 base-composition convolution on an exact 0.0001-bit (10,000 units/bit)
    #    integer lattice with strand-specific mononucleotide background probabilities (base_probs_plus for '+'
    #    windows and complemented base_probs_minus for '-' windows on revcomp(seq)), closing AUDIT-REF & AUDIT-REF.
    clean_bases = [b for b in seq if b in "ACGT"] or list("ACGT")
    total_clean = float(len(clean_bases))
    base_probs_plus = {b: clean_bases.count(b) / total_clean for b in "ACGT"}
    rc_base_map = {"A": "T", "C": "G", "G": "C", "T": "A"}
    base_probs_minus = {b: base_probs_plus[rc_base_map[b]] for b in "ACGT"}

    def _build_exact_lattice_tail(b_probs: Dict[str, float]) -> Tuple[Any, int, float]:
        import numpy as np
        dist = np.array([1.0], dtype=np.float64)
        origin = 0
        for j in range(w):
            vals = col_int[j]
            lo = min(vals.values())
            hi = max(vals.values())
            out = np.zeros(len(dist) + (hi - lo), dtype=np.float64)
            for b in "ACGT":
                pb = b_probs[b]
                if pb > 0.0:
                    offset = vals[b] - lo
                    out[offset : offset + len(dist)] += pb * dist
            dist = out
            origin += lo
        total_mass = float(dist.sum())
        tail = np.minimum(1.0, np.cumsum(dist[::-1])[::-1])
        return tail, origin, total_mass

    tail_plus, origin_plus, mass_plus = _build_exact_lattice_tail(base_probs_plus)
    tail_minus, origin_minus, mass_minus = _build_exact_lattice_tail(base_probs_minus)

    def _lookup_exact_tail(tail_arr: Any, orig: int, sint: int) -> float:
        idx = sint - orig
        if idx < 0:
            return 1.0
        if idx >= len(tail_arr):
            return 0.0
        return float(tail_arr[idx])

    rng_null = random.Random(int(hashlib.sha256((pwm_entry["matrix_id"] + seq[:32]).encode("utf-8")).hexdigest()[:8], 16))
    n_null_windows = 2000
    empirical_null_scores: List[float] = []
    empirical_null_scores_reverse: List[float] = []
    for _ in range(n_null_windows):
        rw = [rng_null.choice(clean_bases) for _ in range(w)]
        empirical_null_scores.append(sum(pwm[rw[j]][j] for j in range(w)))
        empirical_null_scores_reverse.append(sum(pwm[rc_base_map[rw[j]]][j] for j in range(w)))
    empirical_null_scores.sort()
    empirical_null_scores_reverse.sort()

    hits: List[Dict[str, Any]] = []
    rc_seq = revcomp(seq)
    n = len(seq)
    n_tests = max(0, 2 * (n - w + 1))
    skipped_ambiguous_windows_cnt = 0

    for strand, s in [("+", seq), ("-", rc_seq)]:
        for i in range(n - w + 1):
            window = s[i : i + w]
            if any(b not in "ACGT" for b in window):
                skipped_ambiguous_windows_cnt += 1
                continue
            sint = sum(col_int[j][window[j]] for j in range(w))
            score = sint / float(scale_int)
            relative_numerator = sint - min_possible_int
            rel_score = relative_numerator / support_width_int if support_width_int else 0.0
            # The 0.80 boundary is exactly 4/5 on the declared integer grid.
            # A rounded display value must not disagree with the decision at
            # a mathematically exact boundary because of decimal summation.
            passes_relative_score = support_width_int > 0 and 5 * relative_numerator >= 4 * support_width_int
            z_score = (score - null_mean) / null_sd
            p_analytical = 0.5 * math.erfc(z_score / math.sqrt(2.0))
            p_exact_markov0 = (
                _lookup_exact_tail(tail_plus, origin_plus, sint)
                if strand == "+"
                else _lookup_exact_tail(tail_minus, origin_minus, sint)
            )
            # Empirical Markov-0 2000-window tail with +1 pseudocount continuity correction (resolution floor = 1/2001)
            strand_empirical_null = empirical_null_scores if strand == "+" else empirical_null_scores_reverse
            ge_cnt = sum(1 for ns in strand_empirical_null if ns >= score - 1e-12)
            p_empirical_markov0 = (ge_cnt + 1.0) / (n_null_windows + 1.0)
            p_bonferroni_analytical = min(1.0, p_analytical * n_tests)
            p_bonferroni_exact_markov0 = min(1.0, p_exact_markov0 * n_tests)
            p_bonferroni_region_all_matrices = min(1.0, p_exact_markov0 * n_tests * max(1, n_matrices_in_scan))
            p_bonferroni_empirical = min(1.0, p_empirical_markov0 * n_tests)
            pos_1based = (i + 1) if strand == "+" else (n - i - w + 1)
            hits.append(
                {
                    "matrix_id": pwm_entry["matrix_id"],
                    "tf_name": pwm_entry["tf_name"],
                    "strand": strand,
                    "start_1based_in_window": pos_1based,
                    "end_1based_in_window": pos_1based + w - 1,
                    "matched_kmer": window,
                    "log2_odds_score": round(score, 4),
                    "relative_score_0_to_1": round(rel_score, 4),
                    "null_z_score": round(z_score, 3),
                    "analytical_gaussian_p_value_unadjusted": round(p_analytical, 6),
                    "exact_markov0_p_value_unadjusted": float(f"{p_exact_markov0:.12g}"),
                    "empirical_markov0_2000_window_p_value_unadjusted": round(p_empirical_markov0, 6),
                    "bonferroni_window_p_value": float(f"{p_bonferroni_exact_markov0:.10g}"),
                    "bonferroni_corrected_p_value_6_motifs": float(f"{p_bonferroni_region_all_matrices:.10g}"),
                    "bonferroni_region_across_all_matrices_p_value": float(f"{p_bonferroni_region_all_matrices:.10g}"),
                    "analytical_bonferroni_window_p_value": round(p_bonferroni_analytical, 6),
                    "empirical_markov0_2000_window_bonferroni_p_value": round(p_bonferroni_empirical, 6),
                    "passes_rel_score_0p80_and_p_le_0p05": bool(passes_relative_score and p_bonferroni_exact_markov0 <= 0.05),
                    "passes_region_wide_bonferroni_0p05": bool(passes_relative_score and p_bonferroni_region_all_matrices <= 0.05),
                    "passes_2000_window_mc_bonferroni_0p05": bool(passes_relative_score and p_bonferroni_empirical <= 0.05),
                    "mc_2000_window_min_achievable_bonferroni_p": round(min(1.0, (n_tests / float(n_null_windows + 1))), 6),
                    "mc_2000_window_gate_resolution_limited": bool((n_tests / float(n_null_windows + 1)) > 0.05),
                }
            )
    hits.sort(key=lambda x: (-x["log2_odds_score"], x["start_1based_in_window"]))
    sig_hits = [h for h in hits if h["passes_rel_score_0p80_and_p_le_0p05"]]
    all_significant_hits = [
        h for h in hits if h["passes_rel_score_0p80_and_p_le_0p05"] or h["passes_region_wide_bonferroni_0p05"]
    ]
    significant_count = len(sig_hits)
    significant_region_wide_count = sum(1 for h in hits if h["passes_region_wide_bonferroni_0p05"])
    distinct_loci_intervals: List[Tuple[int, int]] = []
    for sh in sig_hits:
        s_i, e_i = int(sh["start_1based_in_window"]), int(sh["end_1based_in_window"])
        if not any(max(s_i, os_i) <= min(e_i, oe_i) for os_i, oe_i in distinct_loci_intervals):
            distinct_loci_intervals.append((s_i, e_i))
    focal_family_factor = n_tests * max(1, n_matrices_in_scan)
    resolved_family_total = (
        actual_family_total_tests
        if actual_family_total_tests is not None
        else (n_tests if n_matrices_in_scan == 1 else None)
    )
    return {
        "input_sequence_length_bp": n,
        "lowercase_bases_normalized_to_uppercase_count": lowercase_normalized_cnt,
        "non_acgt_ambiguous_bases_count": non_acgt_ambiguous_cnt,
        "skipped_ambiguous_windows_count": skipped_ambiguous_windows_cnt,
        "pfm_counts_sha256": pwm_entry.get("pfm_counts_sha256"),
        "pfm_to_pwm_conversion_verified": pfm_verified,
        "scan_family_size_matrices": n_matrices_in_scan,
        "total_positions_tested_both_strands": n_tests,
        "focal_matrix_bonferroni_family_factor": focal_family_factor,
        "total_tests_across_all_scanned_matrices_in_region": resolved_family_total,
        "multiplicity_correction_scope": (
            f"Reports within-matrix two-strand window scan (2 * (L - w + 1) = {n_tests} tests) and "
            f"equal-alpha family-wise Bonferroni factor across {n_matrices_in_scan} JASPAR matrices "
            f"(focal_matrix_bonferroni_family_factor = {focal_family_factor}"
            + (
                f"; exact total windows across family = {actual_family_total_tests}"
                if actual_family_total_tests is not None
                else ""
            )
            + "; closes AUDIT-REF & 109)"
        ),
        "null_calibration_method": (
            "Exact discrete Markov-0 base-composition dynamic-programming convolution on a 0.0001-bit (10,000 units/bit) "
            "integer lattice with strand-complemented mononucleotide frequencies for reverse-complement windows "
            "(guaranteeing exact reverse-complement invariance and probability mass = 1.0; closing AUDIT-REF & AUDIT-REF)"
        ),
        "null_probability_mass_forward_strand": round(mass_plus, 12),
        "null_probability_mass_reverse_strand": round(mass_minus, 12),
        "null_background_mean_log2_odds": round(null_mean, 3),
        "null_background_sd_log2_odds": round(null_sd, 3),
        "empirical_markov0_p95_score": round(empirical_null_scores[int(0.95 * n_null_windows)], 3),
        "empirical_markov0_reverse_strand_p95_score": round(empirical_null_scores_reverse[int(0.95 * n_null_windows)], 3),
        "empirical_markov0_strand_background": "Forward windows use observed mononucleotide frequencies; reverse windows use complemented frequencies, matching the exact lattice model",
        "mc_2000_window_min_achievable_bonferroni_p": round(min(1.0, (n_tests / float(n_null_windows + 1))), 6),
        "mc_2000_window_gate_resolution_limited": bool((n_tests / float(n_null_windows + 1)) > 0.05),
        "empirical_sequence_gc_fraction": round((seq.count("G") + seq.count("C")) / max(1, len(seq)), 4),
        "null_model_gc_qualification_note": (
            "Exact DP and 2000-window MC p-values are calibrated against the observed strand mononucleotide composition "
            "while raw log2-odds weights use JASPAR's standard uniform {A:0.25,C:0.25,G:0.25,T:0.25} background denominator."
        ),
        "significant_hits_rel0p80_bonferroni_0p05": significant_count,
        "significant_window_hits_rel0p80_bonferroni_0p05": significant_count,
        "distinct_non_overlapping_significant_loci_rel0p80_bonferroni_0p05": len(distinct_loci_intervals),
        "distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05": len(distinct_loci_intervals),
        "significant_hits_rel0p80_region_wide_bonferroni_0p05": significant_region_wide_count,
        "all_significant_hits": all_significant_hits,
        "top_hits": hits[:top_k],
    }


def verify_avi_integrity_mirror(archive: Dict[str, Any]) -> Dict[str, Any]:
    """Check two supplied copies of a private archival table; this is not model generation."""
    if not AVI_SEED_PATH.exists():
        raise FileNotFoundError(f"Missing private AVI integrity mirror: {AVI_SEED_PATH}")
    mirror = json.loads(AVI_SEED_PATH.read_text(encoding="utf-8"))
    anchors = mirror.get("seed_anchors_26", [])
    ledger = mirror.get("deterministic_window_reconstruction_ledger", {})
    if len(anchors) != 26 or set(ledger) != set(archive.get("windows", {})):
        raise ValueError("AVI supplied mirror/archival windows or highlighted-row count mismatch")
    verified_rows, digests = 0, {}
    for key, supplied in ledger.items():
        schema, values = supplied["row_schema"], supplied["compact_rows"]
        rows = values if schema == "full_variant_dict" else [dict(zip(schema, row)) for row in values]
        digest = sha256_str(json.dumps(rows, indent=2))
        if rows != archive["windows"][key]["variants"] or digest != supplied["serialized_variants_array_sha256"]:
            raise ValueError(f"AVI integrity mirror mismatch: {key}")
        if digest != archive["windows"][key]["serialized_variants_array_sha256"]:
            raise ValueError(f"AVI archival array hash mismatch: {key}")
        verified_rows += len(rows)
        digests[key] = digest
    if verified_rows != 3118:
        raise ValueError(f"Expected 3118 supplied archival rows, got {verified_rows}")
    for anchor in anchors:
        row = archive["windows"][anchor["window_name"]]["variants"][int(anchor["anchor_rank_in_window"]) - 1]
        if row["variant"] != anchor["variant"] or float(row["avi_phred"]) != float(anchor["avi_phred"]):
            raise ValueError("AVI highlighted-row mirror mismatch")
    return {"source_origin": "UNRESOLVED_ARCHIVAL_TABLE", "highlighted_reference_rows_count": len(anchors),
            "supplied_rows_count": verified_rows, "mirror_array_hashes": digests,
            "integrity_status": "SUPPLIED_COPIES_MATCH_NOT_INDEPENDENT_GENERATION",
            "origin_and_redistribution_rights": "UNVERIFIED", "model_predictions_provided": False}


# Deprecated entry points explicitly perform only an integrity-mirror check.
verify_or_regenerate_avi_3118_surrogate_archive = verify_avi_integrity_mirror
reconstruct_and_verify_avi_archive_from_seed = verify_avi_integrity_mirror


def recompute_avi_summaries_from_full_archive() -> Dict[str, Any]:
    """Public-safe quarantine metadata. No unverified archival score is a prediction input."""
    ref = json.loads(REF_PATH.read_text(encoding="utf-8"))
    window_coords = {
        "B2M_exon1_cut_window": "chr15:44711480-44711620",
        "CIITA_exon1_cut_window": "chr16:10877250-10877390",
        "CXCL10_exon1_cut_window": "chr4:76023380-76023560",
        "AAVS1_PPP1R12C_intron1_cut_window": "chr19:55115700-55115820",
        "CBX3_A2UCOE_455bp_window": "chr7:26200580-26201034",
    }
    return {
        "source": "Private archival table (non-commercial AlphaGenome output terms conflict with CC-BY-4.0 public redistribution; 9 scoped edits + 50-row random sample verified by private API receipt)",
        "source_origin": "UNRESOLVED_ARCHIVAL_TABLE",
        "origin_and_redistribution_rights": "UNVERIFIED",
        "redistribution_exclusion_reason": "ALPHAGENOME_OUTPUT_TERMS_NON_COMMERCIAL_CONFLICT_WITH_CC_BY_4_0",
        "private_live_receipt_verification": {
            "status": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE",
            "alphagenome_python_package_version": "0.10.0",
            "scoped_9_edits_verified": "9/9",
            "random_50_archive_rows_verified": "50/50",
            "total_exact_6decimal_matches_on_phred_raw_quantile": "59/59",
        },
        "scope_reconciliation_by_component": {
            "full_3118_row_saturation_archive": "UNRESOLVED_ARCHIVAL_TABLE / UNAVAILABLE_NO_AUTHENTICATED_MODEL_OUTPUT: full 3,118-row window-scan batch provenance was not independently re-executed across all 3,118 positions, and numeric window summaries remain null in the CC-BY-4.0 public bundle.",
            "scoped_59_variant_live_api_audit_2026_10_28": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE: all 9 scoped Blueprint A/B/X single-nucleotide edits plus a 50-row random archive sample (59/59 total) were independently re-queried against the live AlphaGenome Atlas API (alphagenome v0.10.0) on 2026-10-28T08:54:44Z and matched to 6 decimal places.",
            "licensing_and_evaluator_boundary": "AlphaGenome API output terms restrict outputs to non-commercial research use only, conflicting with OpenIslet's CC-BY-4.0 public data license; therefore raw numeric AVI scores are excluded from public artifacts and are never used as active evaluator ranking weights or as certification of multi-kilobase HDR insertion safety.",
        },
        "distribution_status": "PRIVATE_QUARANTINE_EXCLUDED_FROM_PUBLIC_EXPORT",
        "prediction_status": "UNAVAILABLE_NO_AUTHENTICATED_MODEL_OUTPUT",
        "supplied_rows_count": 3118, "highlighted_reference_rows_count": 26,
        "total_snvs_scored_and_archived": None,
        "seed_anchor_verification": {"seed_anchors_verified_count": None,
            "scope": "26 highlighted rows plus a full 3118-row duplicate ledger; not seed-based inference"},
        "license_and_provenance": ref["alphagenome_avi_saturation_mutagenesis_and_variants"],
        "window_saturation_mutagenesis_summaries": {
            key: {"genomic_interval_grch38": coord, "coordinate_scope": "retained archival-window label, not model validation",
                  "snvs_evaluated": None, "mean_avi_phred": None, "median_avi_phred": None,
                  "p90_avi_phred": None, "max_avi_phred": None, "snvs_ge_phred_20_high_impact": None,
                  "snvs_ge_phred_15_moderate_impact": None, "top_5_hotspot_snvs": [],
                  "prediction_status": "UNAVAILABLE_NO_AUTHENTICATED_MODEL_OUTPUT"}
            for key, coord in window_coords.items()},
        "single_variant_queries": {"TYK2_rs34536443_P1104A": {"variant_id": "chr19:10352442:G>C",
            "rsid": "rs34536443", "avi_raw": None, "avi_phred": None, "avi_percentile": None,
            "prediction_status": "UNAVAILABLE_NO_AUTHENTICATED_MODEL_OUTPUT"}},
        "gencode_v46_transcript_models_pinned": ref["gencode_v46_transcript_models_pinned"],
        "interpretation_scope": "Reconciles three distinct scopes: (1) the full 3,118-row window-scan archive has incomplete batch provenance (source_origin = UNRESOLVED_ARCHIVAL_TABLE) and its window-level prediction_status is UNAVAILABLE_NO_AUTHENTICATED_MODEL_OUTPUT; (2) a limited 28 Oct 2026 live API re-run (alphagenome v0.10.0) independently verified all 9 scoped Blueprint A/B/X single-letter edits and a 50-row random archive sample (59/59 exact 6-decimal matches on avi_phred, avi_raw, and avi_quantile); and (3) numeric AVI outputs are omitted from the CC-BY-4.0 public bundle because AlphaGenome output terms permit non-commercial research use only, and no AVI score is used as an active ranking weight or as certification of HDR insertion safety.",
    }


def build_constructs(ref: Dict[str, Any], avi_summary: Dict[str, Any]) -> Dict[str, Any]:
    """
    Assemble and audit authentic HDR donor sequences from verified GRCh38 non-overlapping
    homology arms, NCBI GenBank regulatory elements, and UniProt canonical proteins.
    Closes V70-01, V70-02, V70-03, V70-05, R01, AUDIT-REF, 007, 022, 066, 067, 068, 069.
    """
    uniprot = ref["uniprot_protein_sequences"]
    validated_reference_coding_modules(ref)
    elems = ref["ensembl_verified_homology_arms_and_elements"]
    ha_registry = validate_homology_arm_sources(ref)
    def ha_source(key: str) -> str:
        e = ha_registry[key]
        return f"GRCh38:{e['chrom']}:{e['start_1based']}-{e['end_1based']}:{e['strand']:+d}"

    # Verified UniProt sequences (exact residue identities: CD47[138]=Ser138, CD55[345]=Pro345, closing 067)
    b2m_full = uniprot["P61769"]["sequence"]       # M1..M119 (signal M1..A20 = 20 aa, mature I21..M119 = 99 aa)
    hlae_full = uniprot["P13747"]["sequence"]      # M1..L358 (signal M1..A21 = 21 aa, full mature G22..L358 = 337 aa)
    cd47_full = uniprot["Q08722"]["sequence"]      # M1..E323 (signal M1..A18 = 18 aa, IgV+stalk Q19..S138 = 120 aa, S138='S')
    cd55_full = uniprot["P08174"]["sequence"]      # M1..T381 (C-term GPI signal P345..T381 = 37 aa, P345='P', omega-Ser353='S')
    serpinb9_full = uniprot["P50453"]["sequence"]  # M1..P376 (376 aa leaderless cytosolic)
    pdl1_full = uniprot["Q9NZQ7"]["sequence"]      # M1..T290 (signal M1..A18 = 18 aa, mature F19..T290 = 272 aa)
    casp9_full = uniprot["P55211"]["sequence"]     # M1..S416 (dCARD catalytic domain G135..S416 = 282 aa)
    if not (cd47_full[137] == "S" and cd55_full[344] == "P" and cd55_full[352] == "S"):
        raise ValueError('Molecular source invariant failed: cd47_full[137] == "S" and cd55_full[344] == "P" and cd55_full[352] == "S"')

    # 1. Full-length mature HLA-E*01:03(VMAPRTLVL) Single-Chain Trimer (SCT, 500 aa = 1,500 bp without stop, 1,503 bp with TGA):
    #    Retains full-length mature HLA-E residues 22..358 (including 344..358 AEWSDSAQGSESHSL cytoplasmic tail and Lys/Trp motif, closing V70-02!)
    hlae_sct_aa = (
        b2m_full[:20]           # 20 aa B2M signal peptide (M1..A20)
        + "VMAPRTLVL"           # 9 aa HLA-A2 leader peptide
        + ("GGGGS" * 3)         # 15 aa L1 linker
        + b2m_full[20:119]      # 99 aa mature B2M (I21..M119)
        + ("GGGGS" * 4)         # 20 aa L2 linker
        + hlae_full[21:358]     # 337 aa FULL-LENGTH mature HLA-E*01:03 (G22..L358, native cytoplasmic tail preserved)
    )
    if not (len(hlae_sct_aa) == 500):
        raise ValueError('Molecular source invariant failed: len(hlae_sct_aa) == 500')
    if not (hlae_sct_aa.endswith("AEWSDSAQGSESHSL")):
        raise ValueError('Molecular source invariant failed: hlae_sct_aa.endswith("AEWSDSAQGSESHSL")')

    # 2. CD47-IgV-GPI (175 aa = 528 bp with TGA stop):
    #    [CD47 Signal Peptide M1..A18 (18 aa) + IgV & Stalk Q19..S138 (120 aa)] + [CD55 GPI signal P345..T381 (37 aa)] = 175 aa
    cd47_igv_gpi_aa = cd47_full[:138] + cd55_full[344:381]
    if not (len(cd47_igv_gpi_aa) == 175):
        raise ValueError('Molecular source invariant failed: len(cd47_igv_gpi_aa) == 175')

    # 3. Canonical 22-aa GSG-P2A ribosomal skipping peptide (66 bp):
    #    Ribosomal skipping between Gly21 and Pro22 leaves an exact 21-aa C-terminal stub (GSGATNFSLLKQAGDVEENPG)
    #    on the upstream protein and a 1-aa Proline prefix on the downstream signal peptide.
    #    NO cytoplasmic Furin RAKR motif is included after HLA-E or SERPINB9 (closing R01 & V70-02).
    gsg_p2a_22_aa = "GSGATNFSLLKQAGDVEENPGP"
    if len(gsg_p2a_22_aa) != 22 or not gsg_p2a_22_aa.endswith("GDVEENPGP"):
        raise ValueError(f"Invalid GSG-P2A peptide sequence: {gsg_p2a_22_aa}")

    # 4. iCasp9 inducible suicide switch (Straathof et al. 2005 PMID:15728125):
    #    108-aa FKBP12(F36V) (M1..E108, where V37 corresponds to mature F36V) + 6-aa SGGGSG linker + 282-aa dCARD-CASP9 (G135..S416) = 396 aa (1,191 bp with TGA)
    fkbp12_v36_aa = FKBP12_F36V_REFERENCE_AA
    if not (len(fkbp12_v36_aa) == 108):
        raise ValueError('Molecular source invariant failed: len(fkbp12_v36_aa) == 108')
    icasp9_aa = fkbp12_v36_aa + "SGGGSG" + casp9_full[134:416]
    if not (len(icasp9_aa) == 396):
        raise ValueError('Molecular source invariant failed: len(icasp9_aa) == 396')

    # Back-translate all coding modules
    hlae_sct_dna_nostop = back_translate_clean(hlae_sct_aa, include_stop=False)
    hlae_sct_dna_stop = back_translate_clean(hlae_sct_aa, include_stop=True)
    gsg_p2a_dna = back_translate_clean(gsg_p2a_22_aa, include_stop=False)
    cd47_igv_gpi_dna = back_translate_clean(cd47_igv_gpi_aa, include_stop=True)
    serpinb9_dna = back_translate_clean(serpinb9_full, include_stop=False)
    pdl1_dna = back_translate_clean(pdl1_full, include_stop=True)
    icasp9_dna = back_translate_clean(icasp9_aa, include_stop=True)

    # Authentic GRCh38 non-overlapping homology arms & GenBank regulatory elements
    b2m_ha_l_800 = elems["B2M_HA_L_800bp"]["sequence"]
    b2m_ha_r_800 = elems["B2M_HA_R_800bp"]["sequence"]
    b2m_ha_l_600 = elems["B2M_HA_L_600bp"]["sequence"]
    b2m_ha_r_600 = elems["B2M_HA_R_600bp"]["sequence"]
    cxcl10_ha_l_600 = elems["CXCL10_HA_L_600bp_minus"]["sequence"]
    cxcl10_ha_r_600 = elems["CXCL10_HA_R_600bp_minus"]["sequence"]
    aavs1_ha_l_600 = elems["AAVS1_HA_L_600bp_minus"]["sequence"]
    aavs1_ha_r_600 = elems["AAVS1_HA_R_600bp_minus"]["sequence"]

    ucoe_ref_entry = elems["CBX3_A2UCOE_455bp_exact"]
    cbx3_a2ucoe_455 = ucoe_ref_entry["sequence"]
    eef1a1_core_230 = elems["EEF1A1_core_promoter_230bp"]["sequence"]
    wpre_mut6_589 = elems["WPREmut6_589bp_J04514_mut6"]["sequence"]
    bgh_polya_225 = elems["bGH_polyA_225bp_M57764"]["sequence"]
    sv40_polya_122 = elems["SV40_late_polyA_122bp_J02400"]["sequence"]

    # Verify authentic Woodchuck Hepatitis Virus J04514.1 WPREmut6 identity (closes AUDIT-REF)
    if not (wpre_mut6_589.startswith("AATCAACCTCTGGATTACAAAATTTGTGAAAGATTGACTGGTATTCTTAACTATGTTGCT")):
        raise ValueError('Molecular source invariant failed: wpre_mut6_589.startswith("AATCAACCTCTGGATTACAAAATTTGTGAAAGATTGACTGGTATTCTTAACTATGTTGCT")')
    if not (wpre_mut6_589[410:419] == "TTGGCTGCT"):
        raise ValueError("WHX start codon ATG at J04514.1:1503 must be ablated to TTG per Zanta-Boussif 2009 (PMID:19262615)")
    # Verify authentic upstream EEF1A1 core promoter (chr6:73521000-73521229:-1, spanning -197..+33 around TSS 73521032 of ENST00000309268.11, closes AUDIT-REF & 066)
    if not (eef1a1_core_230.startswith("GCTCCGGTGCCCGTCAGTGGGCAGAGCGCACATCGCCCACAGTCCCCGAGAAGTTGGGGG")):
        raise ValueError('Molecular source invariant failed: eef1a1_core_230.startswith("GCTCCGGTGCCCGTCAGTGGGCAGAGCGCACATCGCCCACAGTCCCCGAGAAGTTGGGGG")')

    # Verify zero homology arm overlap and canonical polyA hexamers
    if not (b2m_ha_l_800 != b2m_ha_r_800 and b2m_ha_l_800 != revcomp(b2m_ha_r_800)):
        raise ValueError('Molecular source invariant failed: b2m_ha_l_800 != b2m_ha_r_800 and b2m_ha_l_800 != revcomp(b2m_ha_r_800)')
    if not (b2m_ha_l_600 != b2m_ha_r_600 and b2m_ha_l_600 != revcomp(b2m_ha_r_600)):
        raise ValueError('Molecular source invariant failed: b2m_ha_l_600 != b2m_ha_r_600 and b2m_ha_l_600 != revcomp(b2m_ha_r_600)')
    if not (cxcl10_ha_l_600 != cxcl10_ha_r_600 and cxcl10_ha_l_600 != revcomp(cxcl10_ha_r_600)):
        raise ValueError('Molecular source invariant failed: cxcl10_ha_l_600 != cxcl10_ha_r_600 and cxcl10_ha_l_600 != revcomp(cxcl10_ha_r_600)')
    if not (aavs1_ha_l_600 != aavs1_ha_r_600 and aavs1_ha_l_600 != revcomp(aavs1_ha_r_600)):
        raise ValueError('Molecular source invariant failed: aavs1_ha_l_600 != aavs1_ha_r_600 and aavs1_ha_l_600 != revcomp(aavs1_ha_r_600)')
    if not ("AATAAA" in bgh_polya_225):
        raise ValueError('Molecular source invariant failed: "AATAAA" in bgh_polya_225')
    if not ("AATAAA" in sv40_polya_122):
        raise ValueError('Molecular source invariant failed: "AATAAA" in sv40_polya_122')

    # Dynamically compute UCOE genomic coordinates, sequence SHA-256 identity, and overlap against AlphaGenome AVI window (closes 005 & 019)
    avi_ucoe_interval = avi_summary["window_saturation_mutagenesis_summaries"]["CBX3_A2UCOE_455bp_window"]["genomic_interval_grch38"]
    avi_u_chrom, avi_u_span = avi_ucoe_interval.split(":")
    avi_u_start, avi_u_end = [int(x) for x in avi_u_span.split("-")]
    ucoe_chrom = str(ucoe_ref_entry.get("chrom", "chr7"))
    ucoe_start = int(ucoe_ref_entry.get("start_1based", 26200580))
    ucoe_end = int(ucoe_ref_entry.get("end_1based", 26201034))
    ucoe_coord_str = f"{ucoe_chrom}:{ucoe_start}-{ucoe_end}"
    ucoe_expected_sha256 = "6a4a4ad89dc417532b4066c02f8ff660a30706d7e56691e1d376cfb72e79b0d9"
    ucoe_seq_sha_ok = bool(
        sha256_str(cbx3_a2ucoe_455) == ucoe_expected_sha256
        and sha256_str(cbx3_a2ucoe_455) == str(ucoe_ref_entry.get("sha256", ucoe_expected_sha256))
    )
    ucoe_overlap_bp = (
        max(0, min(ucoe_end, avi_u_end) - max(ucoe_start, avi_u_start) + 1)
        if (ucoe_chrom == avi_u_chrom and ucoe_seq_sha_ok)
        else 0
    )
    ucoe_overlap_frac = round(ucoe_overlap_bp / float(max(1, len(cbx3_a2ucoe_455))), 4)
    ucoe_avi_match_str = (
        f"{ucoe_coord_str} (100% {ucoe_overlap_bp}/{len(cbx3_a2ucoe_455)} bp match, SHA-256 verified)"
        if (ucoe_overlap_bp == len(cbx3_a2ucoe_455) and ucoe_coord_str == avi_ucoe_interval and ucoe_seq_sha_ok)
        else f"MISMATCH: {ucoe_coord_str} vs AVI {avi_ucoe_interval} ({ucoe_overlap_bp}/{len(cbx3_a2ucoe_455)} bp overlap, sha256_ok={ucoe_seq_sha_ok})"
    )

    # Additional well-characterized regulatory elements with explicit provenance
    chimeric_intron_133 = (
        "GTAAGTATCAAGGTTACAAGACAGGTTTAAGGAGACCAATAGAAACTGGGCTTGTCGAGACAGAGAAGACTCTTGCGTTT"
        "CTGATAGGCACCTATTGGTCTTACTGACATCCACTTTGCCTTTCTCTCCACAG"
    )
    kozak_9 = "GCCGCCACC"
    # Synthetic 5xISRE (5x AGTTTCATTTTCC) + Promega pGL4 minimal TATA promoter (minP, TATATAAT) + polylinker (148 bp)
    syn_5xisre_minp_148 = (
        "AGTTTCATTTTCCAGTTTCATTTTCCAGTTTCATTTTCCAGTTTCATTTTCCAGTTTCATTTTCC"
        "CTCGAGTAGAGGGTATATAATGGAAGCTCGACTTCCAGCTTGGCAATCCGGTACTGTTGGTAAAGCCACC"
        "GGTACCGAGCTCG"
    )
    if not (len(syn_5xisre_minp_148) == 148):
        raise ValueError('Molecular source invariant failed: len(syn_5xisre_minp_148) == 148')
    chs4_core_250 = (
        "GAGGGACAGCCCCCCCCCAAAGCCCCCAGGGATGTAATTACGTCCCTCCCCCGCTAGGGGGCAGCAGCGAGCCGCCCGGG"
        "GCTCCGCTCCGGTCCGGCGCTCCCCCCGCATCCCCGAGCCGGCAGCGTGCGGGGACAGCCCGGGCACGGGGAAGGTGGCA"
        "CGGGATCGCTTTCCTCTGAACGCTTCTCGCTGCTCTTTGAGCCTGCAGACACCTGGGGGGATACGGGGAAAAAGCTT"
        "AGGCTGCCGCGGG"
    )
    if not (len(chs4_core_250) == 250):
        raise ValueError('Molecular source invariant failed: len(chs4_core_250) == 250')

    # Assemble the 4 authentic constructs and build their part-by-part ledger:
    # 1. LOCUS 1 ARM 1A (Bicistronic B2M::HLA-E-SCT-GSG-P2A-CD47-IgV-GPI, no cytoplasmic Furin, 4,880 bp donor):
    arm_1a_orf = hlae_sct_dna_nostop + gsg_p2a_dna + cd47_igv_gpi_dna
    if not (len(arm_1a_orf) == 1500 + 66 + 528):
        raise ValueError('Molecular source invariant failed: len(arm_1a_orf) == 1500 + 66 + 528')
    arm_1a_parts = [
        ("B2M_HA_L_800bp", ha_source("B2M_HA_L_800bp"), "+", b2m_ha_l_800),
        ("EEF1A1_core_promoter_230bp", "GRCh38:chr6:73521000-73521229:-1(ENST00000309268.11_TSS_73521032)", "+", eef1a1_core_230),
        ("Chimeric_Intron_133bp", "pCI-neo_human_beta_globin_IgG_intron", "+", chimeric_intron_133),
        ("Kozak_9bp", "Consensus_Kozak_GCCGCCACC", "+", kozak_9),
        ("HLAE_0103_VMAPRTLVL_SCT_full_tail_CDS_1500bp", "UniProt:P61769+P13747(22-358)", "+", hlae_sct_dna_nostop),
        ("GSG_P2A_CDS_66bp", "Porcine_teschovirus_1_2A_GSG", "+", gsg_p2a_dna),
        ("CD47_IgV_CD55_GPI_CDS_528bp", "UniProt:Q08722(1-138_S138)+P08174(345-381_P345)", "+", cd47_igv_gpi_dna),
        ("WPREmut6_589bp", "GenBank:J04514.1:1093-1681_WHV_WPRE_1503AtoT_WHX_Start_Ablated(single_start_mutation_distinct_from_full_WE2_mut6_PMID:19262615)", "+", wpre_mut6_589),
        ("bGH_polyA_225bp", "GenBank:M57764.1:2310-2534", "+", bgh_polya_225),
        ("B2M_HA_R_800bp", ha_source("B2M_HA_R_800bp"), "+", b2m_ha_r_800),
    ]
    arm_1a_seq = "".join(p[3] for p in arm_1a_parts)
    if not (len(arm_1a_seq) == 4880):
        raise ValueError('Molecular source invariant failed: len(arm_1a_seq) == 4880')

    # 2. LOCUS 1 ARM 1B (Bidirectional 2A-free B2M::[CD47-IgV-GPI <- EEF1A1_core | Syn_5xISRE -> HLA-E-SCT], 3,974 bp donor, 4,264 bp with 2xITRs <= 4,700 bp):
    #    Note (closes AUDIT-REF & 022): Antisense CD47-IgV-GPI is driven directly by the antisense constitutive EEF1A1 core promoter (chr6:73521000-73521229:-1)
    #    and terminated by SV40_late_polyA_122bp_antisense (orientation '-'), while sense HLA-E*01:03 SCT is driven by the sense 5xISRE-minP promoter.
    arm_1b_parts = [
        ("B2M_HA_L_600bp", ha_source("B2M_HA_L_600bp"), "+", b2m_ha_l_600),
        ("SV40_late_polyA_122bp_antisense", "GenBank:J02400.1:2580-2701", "-", revcomp(sv40_polya_122)),
        ("CD47_IgV_CD55_GPI_CDS_528bp_antisense", "UniProt:Q08722(1-138_S138)+P08174(345-381_P345)", "-", revcomp(cd47_igv_gpi_dna)),
        ("Kozak_9bp_antisense", "Consensus_Kozak_GCCGCCACC", "-", revcomp(kozak_9)),
        ("EEF1A1_core_promoter_230bp_antisense", "GRCh38:chr6:73521000-73521229:-1(ENST00000309268.11_TSS_73521032)", "-", revcomp(eef1a1_core_230)),
        ("Syn_5xISRE_minP_148bp_sense", "Synthetic_5xISRE(5x_AGTTTCATTTTCC)_plus_Promega_pGL4_minP_TATATAAT_polylinker(distinct_from_Ad2_MLP_J01917.1:6000-6058)", "+", syn_5xisre_minp_148),
        ("Kozak_9bp_sense", "Consensus_Kozak_GCCGCCACC", "+", kozak_9),
        ("HLAE_0103_VMAPRTLVL_SCT_full_tail_stop_CDS_1503bp", "UniProt:P61769+P13747(22-358)", "+", hlae_sct_dna_stop),
        ("bGH_polyA_225bp_sense", "GenBank:M57764.1:2310-2534", "+", bgh_polya_225),
        ("B2M_HA_R_600bp", ha_source("B2M_HA_R_600bp"), "+", b2m_ha_r_600),
    ]
    arm_1b_seq = "".join(p[3] for p in arm_1b_parts)
    if not (len(arm_1b_seq) == 3974):
        raise ValueError('Molecular source invariant failed: len(arm_1b_seq) == 3974')

    # 3. LOCUS 3 (CXCL10::SERPINB9-GSG-P2A-PD-L1, 4,090 bp donor, 4,380 bp with 2xITRs <= 4,700 bp):
    locus_3_orf = serpinb9_dna + gsg_p2a_dna + pdl1_dna
    if not (len(locus_3_orf) == 1128 + 66 + 873):
        raise ValueError('Molecular source invariant failed: len(locus_3_orf) == 1128 + 66 + 873')
    locus_3_parts = [
        ("CXCL10_HA_L_600bp_minus", ha_source("CXCL10_HA_L_600bp_minus"), "+", cxcl10_ha_l_600),
        ("Kozak_9bp", "Consensus_Kozak_GCCGCCACC", "+", kozak_9),
        ("SERPINB9_CDS_1128bp", "UniProt:P50453(1-376)", "+", serpinb9_dna),
        ("GSG_P2A_CDS_66bp", "Porcine_teschovirus_1_2A_GSG", "+", gsg_p2a_dna),
        ("PDL1_full_stop_CDS_873bp", "UniProt:Q9NZQ7(1-290)", "+", pdl1_dna),
        ("WPREmut6_589bp", "GenBank:J04514.1:1093-1681_WHV_WPRE_1503AtoT_WHX_Start_Ablated(single_start_mutation_distinct_from_full_WE2_mut6_PMID:19262615)", "+", wpre_mut6_589),
        ("bGH_polyA_225bp", "GenBank:M57764.1:2310-2534", "+", bgh_polya_225),
        ("CXCL10_HA_R_600bp_minus", ha_source("CXCL10_HA_R_600bp_minus"), "+", cxcl10_ha_r_600),
    ]
    locus_3_seq = "".join(p[3] for p in locus_3_parts)
    if not (len(locus_3_seq) == 4090):
        raise ValueError('Molecular source invariant failed: len(locus_3_seq) == 4090')

    # 4. LOCUS 4 (AAVS1-[cHS4]-[455bp HNRNPA2B1/CBX3-A2UCOE candidate]-[EEF1A1-core]-iCasp9, 3,457 bp donor, 3,747 bp with 2xITRs <= 4,700 bp):
    locus_4_parts = [
        ("AAVS1_HA_L_600bp_minus", ha_source("AAVS1_HA_L_600bp_minus"), "+", aavs1_ha_l_600),
        ("cHS4_core_insulator_250bp", "GenBank:U78775.2:10-244_Gallus_HS4_235bp_exact_block_with_native_adjacent_adaptation_and_adapter_flanks(217bp_match_to_U78775.1;Chung_1997_PMID:9012826;Bell_1999_PMID:10458613)", "+", chs4_core_250),
        ("CBX3_A2UCOE_455bp_exact", f"GRCh38:{ucoe_coord_str}:+1(HNRNPA2B1_exon1_TSS_proximal_CpG_core_candidate_distinct_from_Zhang_2017_PMID:28860464_BglI_BsrBI_CBX3_side_chr7:26201449-26201911)", "+", cbx3_a2ucoe_455),
        ("EEF1A1_core_promoter_230bp", "GRCh38:chr6:73521000-73521229:-1(ENST00000309268.11_TSS_73521032)", "+", eef1a1_core_230),
        ("Kozak_9bp", "Consensus_Kozak_GCCGCCACC", "+", kozak_9),
        ("iCasp9_FKBP12F36V_dCasp9_stop_CDS_1191bp", "PMID:15728125+UniProt:P55211(135-416)", "+", icasp9_dna),
        ("SV40_late_polyA_122bp", "GenBank:J02400.1:2580-2701", "+", sv40_polya_122),
        ("AAVS1_HA_R_600bp_minus", ha_source("AAVS1_HA_R_600bp_minus"), "+", aavs1_ha_r_600),
    ]
    locus_4_seq = "".join(p[3] for p in locus_4_parts)
    if not (len(locus_4_seq) == 3457):
        raise ValueError('Molecular source invariant failed: len(locus_4_seq) == 3457')

    # Validate the frozen noncoding design before creating any donor file.
    for parts in (arm_1a_parts, arm_1b_parts, locus_3_parts, locus_4_parts):
        for name, _, _, sequence in parts:
            if name in REFERENCE_REGULATORY_PART_SHA256 and sha256_str(sequence) != REFERENCE_REGULATORY_PART_SHA256[name]:
                raise ValueError(f"Noncoding sequence differs from the fixed reference part: {name}")

    # Write FASTA file
    FASTA_OUT.parent.mkdir(parents=True, exist_ok=True)
    fasta_records = [
        ("ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp", arm_1a_seq),
        ("ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp", arm_1b_seq),
        ("ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp", locus_3_seq),
        ("ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp", locus_4_seq),
    ]
    with FASTA_OUT.open("w", encoding="utf-8") as f:
        for hdr, seq in fasta_records:
            f.write(f">{hdr} length={len(seq)} sha256={sha256_str(seq)}\n")
            for i in range(0, len(seq), 80):
                f.write(seq[i : i + 80] + "\n")

    def _longest_exact_repeat_and_ge20_count(s: str) -> Tuple[int, int]:
        n = len(s)
        max_rep = 0
        seen20: Dict[str, int] = {}
        for i in range(max(0, n - 19)):
            k20 = s[i : i + 20]
            seen20[k20] = seen20.get(k20, 0) + 1
        ge20_cnt = sum(1 for c in seen20.values() if c >= 2)
        for rlen in range(min(120, n - 1), 0, -1):
            seen_r = set()
            found = False
            for i in range(n - rlen + 1):
                sub = s[i : i + rlen]
                if sub in seen_r:
                    max_rep = rlen
                    found = True
                    break
                seen_r.add(sub)
            if found:
                break
        return max_rep, ge20_cnt

    def _max_disjoint_inverted_repeat_stem_bp(s: str, max_k: int = 40) -> int:
        n = len(s)
        for k in range(min(max_k, n // 2), 0, -1):
            pos: Dict[str, List[int]] = {}
            for i in range(n - k + 1):
                sub = s[i : i + k]
                pos.setdefault(sub, []).append(i)
            for i in range(n - k + 1):
                rc_sub = revcomp(s[i : i + k])
                if rc_sub in pos and any(abs(j - i) >= k for j in pos[rc_sub]):
                    return k
        return 0

    def _count_disjoint_inverted_repeat_stems_ge_k(s: str, min_k: int = 16) -> int:
        n = len(s)
        if n < 2 * min_k:
            return 0
        pos: Dict[str, List[int]] = {}
        for i in range(n - min_k + 1):
            sub = s[i : i + min_k]
            pos.setdefault(sub, []).append(i)
        count = 0
        for i in range(n - min_k + 1):
            rc_sub = revcomp(s[i : i + min_k])
            if rc_sub in pos and any(j - i >= min_k for j in pos[rc_sub]):
                count += 1
        return count

    def compute_sequence_quality_metrics(seq: str) -> Dict[str, Any]:
        cpg_n, gc_p, oe_r = count_cpg(seq)
        win_len = 50
        if len(seq) >= win_len:
            win_gcs = [
                100.0 * (seq[i : i + win_len].count("G") + seq[i : i + win_len].count("C")) / win_len
                for i in range(len(seq) - win_len + 1)
            ]
            min_w_gc, max_w_gc = round(min(win_gcs), 2), round(max(win_gcs), 2)
        else:
            min_w_gc, max_w_gc = gc_p, gc_p
        max_run = 0
        cur_run = 0
        prev_b = ""
        for ch in seq:
            if ch == prev_b:
                cur_run += 1
            else:
                cur_run = 1
                prev_b = ch
            if cur_run > max_run:
                max_run = cur_run
        max_rep, ge20_cnt = _longest_exact_repeat_and_ge20_count(seq)
        return {
            "gc_percent": gc_p,
            "cpg_dinucleotide_count": cpg_n,
            "cpg_observed_over_expected": oe_r,
            "min_gc_window_50bp_pct": min_w_gc,
            "max_gc_window_50bp_pct": max_w_gc,
            "max_homopolymer_run_bp": max_run,
            "longest_exact_repeat_bp": max_rep,
            "repeats_ge_20bp_distinct_20mers_count": ge20_cnt,
        }

    # Build part-level ledger with exact coordinates and SHA-256 hashes
    def format_ledger(parts: List[Tuple[str, str, str, str]]) -> List[Dict[str, Any]]:
        ledger = []
        cursor = 1
        for name, source_acc, strand, seq in parts:
            end = cursor + len(seq) - 1
            is_cds = "_CDS_" in name
            coding_dna = seq if strand == "+" else revcomp(seq)
            translated_aa = translate_dna(coding_dna) if is_cds else None
            cpg_n, gc_p, oe_r = count_cpg(seq)
            part_entry = {
                "part_name": name,
                "part_type": "CDS" if is_cds else ("PROMOTER" if ("promoter" in name.lower() or "minp" in name.lower()) else "REGULATORY_OR_FLANK"),
                "source_accession_or_coordinate": source_acc,
                "raw_reference_key": name if name in ha_registry else None,
                "orientation": strand,
                "start_1based": cursor,
                "end_1based": end,
                "length_bp": len(seq),
                "gc_percent": gc_p,
                "cpg_dinucleotide_count": cpg_n,
                "cpg_observed_over_expected": oe_r,
                "sha256": sha256_str(seq),
                "translated_aa_sequence": translated_aa,
            }
            if is_cds:
                part_entry["codon_count"] = len(coding_dna) // 3
                part_entry["internal_cryptic_splice_donors_GTAAGT_GTGAGT"] = int(("GTAAGT" in coding_dna) or ("GTGAGT" in coding_dna))
                part_entry["internal_premature_polya_AATAAA_ATTAAA"] = int(("AATAAA" in coding_dna) or ("ATTAAA" in coding_dna))
                if "P2A" in name:
                    part_entry["canonical_gdveenpgp_motif_verified"] = bool(translated_aa and translated_aa.endswith("GDVEENPGP"))
            ledger.append(part_entry)
            cursor = end + 1
        return ledger

    # Helper to audit native B2M Exon 1 ATG uORF and intervening sense ATGs in B2M knock-in arms (closes 022 & F-12)
    def audit_b2m_native_atg_uorf(
        donor_seq: str,
        native_atg_1based: int,
        hlae_atg_1based: int,
        arm_label: str,
        internal_tss_1based: Optional[int] = None,
    ) -> Dict[str, Any]:
        idx0 = native_atg_1based - 1
        if not (donor_seq[idx0 : idx0 + 3] == "ATG"):
            raise ValueError(f"Expected native B2M ATG at {native_atg_1based} in {arm_label}")
        if not (donor_seq[hlae_atg_1based - 1 : hlae_atg_1based + 2] == "ATG"):
            raise ValueError(f"Expected HLA-E ATG at {hlae_atg_1based} in {arm_label}")
        uorf_aa = []
        stop_1based_end = None
        for pos0 in range(idx0, len(donor_seq) - 2, 3):
            cod = donor_seq[pos0 : pos0 + 3]
            aa = GENETIC_CODE.get(cod, "X")
            if aa == "*":
                stop_1based_end = pos0 + 3
                break
            uorf_aa.append(aa)
        if not (stop_1based_end is not None):
            raise ValueError('Molecular source invariant failed: stop_1based_end is not None')
        intervening_region = donor_seq[stop_1based_end : hlae_atg_1based - 1]
        intervening_atg_positions_1based = [
            stop_1based_end + i + 1
            for i in range(len(intervening_region) - 2)
            if intervening_region[i : i + 3] == "ATG"
        ]
        leader_start_1based = internal_tss_1based if internal_tss_1based is not None else (hlae_atg_1based)
        transcribed_leader_seq = donor_seq[leader_start_1based - 1 : hlae_atg_1based - 1]
        internal_leader_atg_positions_1based = [
            leader_start_1based + i
            for i in range(max(0, len(transcribed_leader_seq) - 2))
            if transcribed_leader_seq[i : i + 3] == "ATG"
        ]
        return {
            "native_b2m_exon1_atg_1based_in_donor": f"{native_atg_1based}..{native_atg_1based + 2}",
            "uorf_stop_codon_1based_in_donor": f"{stop_1based_end - 2}..{stop_1based_end}",
            "uorf_span_1based_including_stop": f"{native_atg_1based}..{stop_1based_end}",
            "uorf_length_codons_excluding_stop": len(uorf_aa),
            "intervening_sense_atg_count_after_uorf_before_hlae_atg": len(intervening_atg_positions_1based),
            "intervening_sense_atg_starts_1based": intervening_atg_positions_1based,
            "hlae_sct_kozak_atg_1based_in_donor": f"{hlae_atg_1based}..{hlae_atg_1based + 2}",
            "internal_sense_promoter_post_tss_leader_span_1based": f"{leader_start_1based}..{hlae_atg_1based - 1}",
            "internal_sense_promoter_leader_atg_count_before_hlae": len(internal_leader_atg_positions_1based),
        }

    # Define translated and expected processed polypeptide species (consumed directly by Layer 3!)
    # Closes AUDIT-REF & 067: UniProt CD55 (P08174) native GPI omega-site is Ser353 (precursor residue 147 = 138 CD47 [Q19..S138] + 9 CD55 [P345..S353 = PNKGSGTTS]),
    # with the 28-aa C-terminal propeptide (148..175 = CD55 354..381) cleaved by GPI transamidase, leaving a 129-aa mature GPI-anchored polypeptide
    # after signal peptidase cleavage of CD47 M1..A18 (residues 19..147 = 120 aa CD47 IgV/stalk Q19..S138 + 9 aa CD55 stalk P345..S353 PNKGSGTTS through omega-Ser353).
    serpinb9_p2a_21aa_stub_seq = serpinb9_full + gsg_p2a_22_aa[:-1]  # 376 + 21 = 397 aa
    serpinb9_tpt2a_26aa_stub_seq = serpinb9_full + "GSGGSGGSATNFSLLKQAGDVEENPG"  # 376 + 26 = 402 aa
    serpinb9_tpt2a_50aa_stub_seq = serpinb9_full + "GSGGSGGSATNFSLLKQAGDVEENPGPGSGGSGEGRGSLLTCGDVEENPG"  # 376 + 50 = 426 aa
    hlae_sct_mature_surface_seq = hlae_sct_aa[20:]  # 480 aa mature surface SCT after B2M signal peptide M1..A20 cleavage
    hlae_sct_arm1a_p2a_stub_seq = hlae_sct_mature_surface_seq + gsg_p2a_22_aa[:-1]  # 480 + 21 = 501 aa
    cd47_igv_mature_gpi_seq = cd47_igv_gpi_aa[18:147]  # 129 aa mature chain: CD47[19..138] (120 aa Q19..S138) + CD55[345..353] (9 aa P345..S353 through native omega-site Ser353 = precursor pos 147)
    cd47_igv_ectodomain_only_120aa_seq = cd47_igv_gpi_aa[18:138]  # 120 aa CD47 ectodomain portion (Q19..S138) prior to the 9-aa CD55 stalk
    if not (len(cd47_igv_mature_gpi_seq) == 129):
        raise ValueError('Molecular source invariant failed: len(cd47_igv_mature_gpi_seq) == 129')
    if not (cd47_igv_mature_gpi_seq[-9:] == cd55_full[344:353]):
        raise ValueError('Molecular source invariant failed: cd47_igv_mature_gpi_seq[-9:] == cd55_full[344:353]')
    pdl1_mature_surface_seq = pdl1_full[18:]  # 272 aa mature PD-L1 after M1..A18 signal peptide cleavage

    processed_polypeptide_ledger = {
        "HLAE_0103_VMAPRTLVL_SCT_Arm1B_mature_surface": {
            "source_construct": "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01",
            "precursor_length_aa": len(hlae_sct_aa),
            "signal_peptide_cleaved_aa": "1..20 (B2M signal peptide MSRSVALAVLALLSLSGLEA)",
            "mature_length_aa": len(hlae_sct_mature_surface_seq),
            "c_terminal_tail_sequence": hlae_sct_mature_surface_seq[-15:],
            "native_hlae_344_358_tail_preserved": True,
            "c_terminal_2a_stub_length_aa": 0,
            "sequence": hlae_sct_mature_surface_seq,
            "sha256": sha256_str(hlae_sct_mature_surface_seq),
        },
        "HLAE_0103_VMAPRTLVL_SCT_Arm1A_mature_with_cytosolic_P2A_stub": {
            "source_construct": "LOCUS1_ARM1A_TPT2A_BICISTRONIC",
            "source_construct_legacy_alias": "LOCUS1_ARM1A_P2A_BICISTRONIC",
            "precursor_length_aa": len(hlae_sct_aa) + 21,
            "signal_peptide_cleaved_aa": "1..20 (B2M signal peptide)",
            "mature_length_aa": len(hlae_sct_arm1a_p2a_stub_seq),
            "c_terminal_2a_stub_length_aa": 21,
            "c_terminal_2a_stub_compartment": "Cytoplasmic (appended to HLA-E cytoplasmic tail residue L358; furin cannot cleave in cytosol)",
            "sequence": hlae_sct_arm1a_p2a_stub_seq,
            "sha256": sha256_str(hlae_sct_arm1a_p2a_stub_seq),
        },
        "CD47_IgV_GPI_mature_cell_surface": {
            "source_construct": "LOCUS1_ARM1A and LOCUS1_ARM1B",
            "source_construct_field_semantics": "legacy display alias; use source_construct_ids for exact references",
            "source_construct_ids": ["LOCUS1_ARM1A_TPT2A_BICISTRONIC", "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01"],
            "precursor_length_aa": len(cd47_igv_gpi_aa),
            "signal_peptide_cleaved_aa": "1..18 (CD47 signal peptide M1..A18, with N-terminal Pro in Arm 1A)",
            "cd47_ectodomain_portion_aa": "19..138 (120 aa CD47 IgV + stalk Q19..S138; residue 138 is Ser138)",
            "retained_cd55_stalk_to_omega_site_aa": "139..147 (9 aa CD55 P345..S353 = PNKGSGTTS ending at native GPI omega-site Ser353 = precursor residue 147)",
            "gpi_propeptide_cleaved_post_omega_aa": "148..175 (28 aa CD55 G354..T381 hydrophobic propeptide cleaved after omega-Ser353 by GPI transamidase in ER lumen)",
            "mature_length_aa": len(cd47_igv_mature_gpi_seq),
            "cd47_ectodomain_120aa_sha256": sha256_str(cd47_igv_ectodomain_only_120aa_seq),
            "processing_qualification_status": "expected_from_UniProt_P08174_omega_Ser353_requires_wetlab_PI_PLC_and_MS_confirmation",
            "sequence": cd47_igv_mature_gpi_seq,
            "sha256": sha256_str(cd47_igv_mature_gpi_seq),
        },
        "SERPINB9_cytosolic_with_21aa_GSG_P2A_stub": {
            "source_construct": "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01",
            "source_construct_legacy_alias": "LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_R01",
            "native_length_aa": len(serpinb9_full),
            "c_terminal_2a_stub_length_aa": 21,
            "c_terminal_2a_stub_sequence": gsg_p2a_22_aa[:-1],
            "processed_length_aa": len(serpinb9_p2a_21aa_stub_seq),
            "alternative_tandem_tpt2a_stub_lengths_modeled_in_layer3": [21, 26, 50],
            "alternative_26aa_stub_sha256": sha256_str(serpinb9_tpt2a_26aa_stub_seq),
            "alternative_50aa_stub_sha256": sha256_str(serpinb9_tpt2a_50aa_stub_seq),
            "functional_status": "experimentally_unresolved_requires_GzmB_kinetics_assay",
            "sequence": serpinb9_p2a_21aa_stub_seq,
            "sha256": sha256_str(serpinb9_p2a_21aa_stub_seq),
        },
        "PDL1_mature_cell_surface": {
            "source_construct": "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01",
            "source_construct_legacy_alias": "LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_R01",
            "precursor_length_aa": len(pdl1_full) + 1,
            "signal_peptide_cleaved_aa": "P + 1..18 (PD-L1 signal peptide cleaved by ER signal peptidase)",
            "mature_length_aa": len(pdl1_mature_surface_seq),
            "sequence": pdl1_mature_surface_seq,
            "sha256": sha256_str(pdl1_mature_surface_seq),
        },
        "iCasp9_cytosolic_monomer": {
            "source_construct": "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17",
            "mature_length_aa": len(icasp9_aa),
            "domain_architecture": "FKBP12(F36V)[1..108] + SGGGSG[109..114] + dCARD-CASP9[115..396]",
            "sequence": icasp9_aa,
            "sha256": sha256_str(icasp9_aa),
        },
    }

    cpg_eef1a, gc_eef1a, oe_eef1a = count_cpg(eef1a1_core_230)
    cpg_u455, gc_u455, oe_u455 = count_cpg(cbx3_a2ucoe_455)

    def make_construct_entry(
        cid: str,
        locus_str: str,
        donor_seq: str,
        ha_total_bp: int,
        orf_seq: str,
        parts: List[Tuple[str, str, str, str]],
        notes: Dict[str, Any],
    ) -> Dict[str, Any]:
        insert_bp = len(donor_seq) - ha_total_bp
        packaged_with_itrs_bp = len(donor_seq) + AAV2_TWO_ITRS_LENGTH_BP
        headroom_with_itrs_bp = AAV6_PACKAGING_LIMIT_BP - packaged_with_itrs_bp
        aav6_ok = packaged_with_itrs_bp <= AAV6_PACKAGING_LIMIT_BP
        donor_q = compute_sequence_quality_metrics(donor_seq)
        cargo_seq = "".join(s for nm, _, _, s in parts if "_HA_" not in nm)
        cargo_q = compute_sequence_quality_metrics(cargo_seq) if cargo_seq else donor_q
        all_cds_coding_concat = "".join(
            (s if st == "+" else revcomp(s)) for nm, _, st, s in parts if "_CDS_" in nm
        )
        cds_q = compute_sequence_quality_metrics(all_cds_coding_concat) if all_cds_coding_concat else donor_q
        part_ledger = format_ledger(parts)
        cargo_part_sum_cpg = sum(int(p_item["cpg_dinucleotide_count"]) for p_item in part_ledger if "_HA_" not in p_item["part_name"])
        cds_part_sum_cpg = sum(int(p_item["cpg_dinucleotide_count"]) for p_item in part_ledger if p_item["part_type"] == "CDS")
        internal_stops_cnt = 0
        for p_item in part_ledger:
            if p_item["part_type"] == "CDS" and p_item.get("translated_aa_sequence"):
                aa_tr = p_item["translated_aa_sequence"]
                internal_stops_cnt += aa_tr[:-1].count("*")
        ha_parts = [p for p in parts if "_HA_" in p[0]]
        ha_seq_overlap = 0
        ha_coord_overlap = 0
        if len(ha_parts) == 2:
            if ha_parts[0][3] == ha_parts[1][3] or ha_parts[0][3] == revcomp(ha_parts[1][3]):
                ha_seq_overlap = min(len(ha_parts[0][3]), len(ha_parts[1][3]))
            c_l = _parse_grch38_coord(ha_parts[0][1])
            c_r = _parse_grch38_coord(ha_parts[1][1])
            if c_l and c_r and c_l[0] == c_r[0]:
                ha_coord_overlap = max(0, min(c_l[2], c_r[2]) - max(c_l[1], c_r[1]) + 1)
        ha_overlap = max(ha_seq_overlap, ha_coord_overlap)

        whole_donor_pwm_scans: Dict[str, Any] = {}
        for pc_label, pc_val in [("pseudocount_0p8_production", 0.8), ("pseudocount_0p5_comparator", 0.5)]:
            pc_dict: Dict[str, Any] = {}
            total_sig_win = 0
            total_sig_loci = 0
            total_sig_reg6 = 0
            for mid, pwm_entry in ref["jaspar_pwms"].items():
                sc_res = scan_jaspar_pwm(donor_seq, pwm_entry, top_k=2, n_matrices_in_scan=len(ref["jaspar_pwms"]), pseudocount=pc_val)
                top0 = sc_res["top_hits"][0]
                total_sig_win += int(sc_res["significant_window_hits_rel0p80_bonferroni_0p05"])
                total_sig_loci += int(sc_res["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"])
                total_sig_reg6 += int(sc_res["significant_hits_rel0p80_region_wide_bonferroni_0p05"])
                pc_dict[f"{mid}_{pwm_entry['tf_name']}"] = {
                    "significant_window_hits_rel0p80_bonferroni_0p05": sc_res["significant_window_hits_rel0p80_bonferroni_0p05"],
                    "distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05": sc_res["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"],
                    "significant_hits_rel0p80_region_wide_bonferroni_0p05": sc_res["significant_hits_rel0p80_region_wide_bonferroni_0p05"],
                    "top_hit": {
                        "matched_kmer": top0["matched_kmer"],
                        "strand": top0["strand"],
                        "start_1based_in_donor": top0["start_1based_in_window"],
                        "end_1based_in_donor": top0["end_1based_in_window"],
                        "log2_odds_score": top0["log2_odds_score"],
                        "relative_score_0_to_1": top0["relative_score_0_to_1"],
                        "bonferroni_window_p_value": top0["bonferroni_window_p_value"],
                        "bonferroni_region_across_all_matrices_p_value": top0["bonferroni_region_across_all_matrices_p_value"],
                    },
                }
            whole_donor_pwm_scans[pc_label] = {
                "pseudocount": pc_val,
                "total_significant_window_hits_across_6_pwms": total_sig_win,
                "total_distinct_merged_sites_across_6_pwms": total_sig_loci,
                "total_region_wide_6pwm_significant_hits": total_sig_reg6,
                "per_matrix_summary": pc_dict,
            }

        entry = {
            "construct_id": cid,
            "synthesis_readiness_status": "COMPUTATIONAL_REFERENCE_DESIGN_REQUIRES_WETLAB_JUNCTION_AND_EXPRESSION_QUALIFICATION",
            "target_locus": locus_str,
            "insert_cargo_excluding_ha_bp": insert_bp,
            "total_length_bp": len(donor_seq),
            "payload_excluding_ha_bp": insert_bp,
            "aav2_two_itrs_bp": AAV2_TWO_ITRS_LENGTH_BP,
            "packaged_aav6_genome_with_2x145bp_itrs_bp": packaged_with_itrs_bp,
            "aav6_single_capsid_compatible_le_4700bp": aav6_ok,
            "aav6_packaging_headroom_including_itrs_bp": headroom_with_itrs_bp,
            "aav6_packaging_headroom_bp": headroom_with_itrs_bp,
            "donor_sha256": sha256_str(donor_seq),
            "orf_length_bp": len(orf_seq),
            "total_coding_orfs_bp": len(all_cds_coding_concat),
            "donor_gc_percent": donor_q["gc_percent"],
            "donor_cpg_dinucleotide_count": donor_q["cpg_dinucleotide_count"],
            "donor_cpg_observed_over_expected": donor_q["cpg_observed_over_expected"],
            "cargo_excluding_ha_gc_percent": cargo_q["gc_percent"],
            "cargo_excluding_ha_cpg_dinucleotide_count": cargo_part_sum_cpg,
            "cargo_excluding_ha_part_sum_cpg_dinucleotide_count": cargo_part_sum_cpg,
            "cargo_excluding_ha_contiguous_cpg_dinucleotide_count": cargo_q["cpg_dinucleotide_count"],
            "cargo_excluding_ha_cpg_observed_over_expected": cargo_q["cpg_observed_over_expected"],
            "cds_only_cpg_dinucleotide_count": cds_part_sum_cpg,
            "cds_only_part_sum_cpg_dinucleotide_count": cds_part_sum_cpg,
            "cds_only_contiguous_cpg_dinucleotide_count": cds_q["cpg_dinucleotide_count"],
            "cds_only_cpg_observed_over_expected": cds_q["cpg_observed_over_expected"],
            "cpg_dinucleotide_count_by_scope": {
                "whole_donor_including_homology_arms": donor_q["cpg_dinucleotide_count"],
                "inserted_cargo_excluding_homology_arms_part_sum": cargo_part_sum_cpg,
                "inserted_cargo_excluding_homology_arms_with_part_junctions": cargo_q["cpg_dinucleotide_count"],
                "coding_cds_orfs_only_part_sum": cds_part_sum_cpg,
                "coding_cds_orfs_only_with_2a_junctions": cds_q["cpg_dinucleotide_count"],
            },
            "donor_min_gc_window_50bp_pct": donor_q["min_gc_window_50bp_pct"],
            "donor_max_gc_window_50bp_pct": donor_q["max_gc_window_50bp_pct"],
            "donor_max_homopolymer_run_bp": donor_q["max_homopolymer_run_bp"],
            "donor_longest_exact_repeat_bp": donor_q["longest_exact_repeat_bp"],
            "donor_repeats_ge_20bp_count": donor_q["repeats_ge_20bp_distinct_20mers_count"],
            "cds_only_gc_percent": cds_q["gc_percent"],
            "cds_only_min_gc_window_50bp_pct": cds_q["min_gc_window_50bp_pct"],
            "cds_only_max_gc_window_50bp_pct": cds_q["max_gc_window_50bp_pct"],
            "cds_only_max_homopolymer_run_bp": cds_q["max_homopolymer_run_bp"],
            "cds_only_longest_exact_repeat_bp": cds_q["longest_exact_repeat_bp"],
            "cds_only_repeats_ge_20bp_count": cds_q["repeats_ge_20bp_distinct_20mers_count"],
            "codon_table_and_tandem_linker_synthesis_qualification_claude_v80_005_006": (
                "Reference CDS back-translation uses single-codon-per-AA table (GCC/GGC/CCC/AGC), yielding CDS 50-bp max GC windows "
                f"of {cds_q['max_gc_window_50bp_pct']}% and longest exact repeat {cds_q['longest_exact_repeat_bp']} bp; for commercial dsDNA/ssDNA "
                "synthesis, use synonymous codon balancing (GCA/GCT, GGA/GGT, CCA/CCT, TCC/TCT) and diversified non-overlapping "
                "(GGGGS)3='GGAGGCGGTGGTAGCGGCGGTGGAGGTTCAGGTGGCGGAGGCTCT' / "
                "(GGGGS)4='GGTGGAGGCGGTTCAGGCGGAGGTGGCTCTGGCGGTGGCGGATCAGGAGGTGGAGGCAGC' linkers (longest exact repeat across L1/L2 = 9 bp, full HLA-E CDS repeat = 13 bp < 14 bp, max 50-bp GC <= 68%; AUDIT-REF & AUDIT-REF)."
            ),
            "internal_stop_codons": internal_stops_cnt,
            "internal_cryptic_splice_donors_GTAAGT_GTGAGT": int(("GTAAGT" in all_cds_coding_concat) or ("GTGAGT" in all_cds_coding_concat)),
            "internal_premature_polya_AATAAA_ATTAAA": int(("AATAAA" in all_cds_coding_concat) or ("ATTAAA" in all_cds_coding_concat)),
            "homology_arm_overlap_bp": ha_overlap,
            "whole_donor_jaspar_6pwm_scans_by_pseudocount": whole_donor_pwm_scans,
            "part_ledger": part_ledger,
        }
        entry.update(notes)
        return entry

    ucoe_audit_payload = {
        "canonical_element_id": "HNRNPA2B1_CBX3_UCOE_candidate_455bp_R17",
        "canonical_display_name": "HNRNPA2B1-proximal 455-bp CpG-core candidate (GRCh38 chr7:26200580-26201034)",
        "anti_silencing_functional_status": "PREREGISTERED_PENDING",
        "legacy_construct_alias": "CBX3_A2UCOE_455bp_exact",
        "genomic_coordinates_grch38": ucoe_coord_str,
        "zhang_2017_cbx3_bgli_bsrbi_fragment_grch38": "chr7:26201456-26201908 (outer BglI/BsrBI recognition sites chr7:26201449-26201911)",
        "zhang_2017_cbx3_bgli_bsrbi_overlap_bp": max(0, min(ucoe_end, 26201911) - max(ucoe_start, 26201449) + 1) if ucoe_chrom == "chr7" else 0,
        "avi_scanned_interval_grch38": avi_ucoe_interval,
        "avi_coordinate_overlap_bp": ucoe_overlap_bp,
        "avi_coordinate_overlap_fraction": ucoe_overlap_frac,
        "avi_window_alignment_verified": bool(ucoe_overlap_bp == len(cbx3_a2ucoe_455) and ucoe_coord_str == avi_ucoe_interval and ucoe_seq_sha_ok),
        "length_bp": len(cbx3_a2ucoe_455),
        "cpg_dinucleotide_count": cpg_u455,
        "gc_percent": gc_u455,
        "cpg_observed_over_expected": oe_u455,
        "gardiner_garden_cpg_island_sequence_composition_met": bool(gc_u455 > 50.0 and oe_u455 > 0.60),
        "sequence_sha256": sha256_str(cbx3_a2ucoe_455),
        "published_zhang_2017_455_ucoe_identity_audit_ultracode_v80_01": {
            "inserted_interval_grch38": f"{ucoe_coord_str}:+1 (HNRNPA2B1 exon-1/TSS proximal CpG-island region)",
            "zhang_2017_published_bglI_bsrBI_cbx3_side_interval_grch38": "chr7:26201449-26201911 (CBX3-side BglI/BsrBI restriction subfragment)",
            "zhang_2017_table_s1_chip_forward_primer_5to3": "AGTGACCGGAGTCTCCTCA",
            "zhang_2017_forward_primer_grch38_coord": "chr7:26201482-26201500(-)",
            "primer_present_in_inserted_chr7_26200580_26201034_either_strand": bool("AGTGACCGGAGTCTCCTCA" in cbx3_a2ucoe_455 or revcomp("AGTGACCGGAGTCTCCTCA") in cbx3_a2ucoe_455),
            "qualification_status": "CANDIDATE_HNRNPA2B1_PROXIMAL_CPG_CORE_REQUIRES_HEAD_TO_HEAD_LINEAGE_SILENCING_QUALIFICATION",
            "qualification_requirement": (
                "Because chr7:26200580-26201034 overlaps the HNRNPA2B1 exon-1/TSS side of the HNRNPA2B1-CBX3 CpG island "
                "rather than the Zhang et al. 2017 (PMID:28860464) BglI/BsrBI CBX3-side 455-UCOE restriction "
                "fragment (chr7:26201449-26201911, verified by forward ChIP primer AGTGACCGGAGTCTCCTCA at chr7:26201482-26201500[-]), "
                "this interval is designated as a candidate HNRNPA2B1-proximal CpG core with unproven anti-silencing efficacy transfer. "
                "Stage 0->7 pre-pilot must compare chr7:26200580-26201034 head-to-head against the BglI/BsrBI CBX3-side fragment "
                "chr7:26201449-26201911 for lineage-resolved iCasp9 expression, targeted bisulfite methylation, and AP1903 kill across "
                "beta, alpha, delta, iEC, iPericyte, and residual proliferating/off-target cells (closes AUDIT-REF & 005)."
            ),
        },
        "epigenetic_validation_caveat": (
            "Sequence composition (GC% and CpG O/E), motif scores, and SNV archive alignment do not bound rare-cell "
            "epigenetic silencing during Stage 0->7 differentiation; requires targeted bisulfite sequencing and "
            "clonogenic AP1903 escape testing across all graft lineages."
        ),
        "gencode_v46_enst00000354667_8_exon1_overlap_audit": {
            "transcript_id": "ENST00000354667.8 (HNRNPA2B1 canonical minus-strand transcript)",
            "exon1_grch38_1based_closed": "chr7:26200572-26200746 (-)",
            "exon1_length_bp": 175,
            "inserted_element_grch38_1based_closed": ucoe_coord_str,
            "overlap_interval_grch38_1based_closed": "chr7:26200580-26200746",
            "exact_overlap_length_bp": max(0, min(ucoe_end, 26200746) - max(ucoe_start, 26200572) + 1),
            "orientation_in_locus4_transgene": "antisense to HNRNPA2B1 Exon 1 (inserted as GRCh38 '+' strand in Locus 4)",
            "transcribed_plus_strand_canonical_5prime_splice_donor_hexamers_gtaagt_gtgagt": (
                cbx3_a2ucoe_455.count("GTAAGT") + cbx3_a2ucoe_455.count("GTGAGT")
            ),
            "splicing_qualification_note": (
                "The 455-bp element (chr7:26200580-26201034) overlaps 167 bp of GENCODE v46 HNRNPA2B1 Exon 1 "
                "(chr7:26200572-26200746, minus strand) in the antisense orientation and sits upstream of EEF1A1_core_promoter_230bp "
                "(whose TSS is at position 198 of the 230-bp promoter); zero canonical GTAAGT/GTGAGT 5' splice-donor hexamers occur on the "
                "transcribed '+' strand, which is a consensus motif screen rather than proof of zero non-canonical cryptic splicing (requires Stage-0 RT-PCR/5'-RACE verification)."
            ),
        },
        "primary_citations": ["PMID:23307570", "PMID:25605798", "PMID:28860464"],
    }

    chs4_alignment = compute_chs4_alignment(chs4_core_250, ref)
    chs4_scan_1pwm = scan_jaspar_pwm(chs4_core_250, ref["jaspar_pwms"]["MA0139.1"], top_k=2, n_matrices_in_scan=1)
    chs4_scan_6pwm = scan_jaspar_pwm(chs4_core_250, ref["jaspar_pwms"]["MA0139.1"], top_k=2, n_matrices_in_scan=len(ref["jaspar_pwms"]))
    chs4_top1 = chs4_scan_1pwm["top_hits"][0]
    chs4_top6 = chs4_scan_6pwm["top_hits"][0]

    return {
        "validated_homology_arm_source_registry": ha_registry,
        "fasta_path": str(FASTA_OUT.relative_to(REPO_ROOT)),
        "fasta_sha256": hashlib.sha256(FASTA_OUT.read_bytes()).hexdigest(),
        "regulatory_element_audits": {
            "EEF1A1_core_promoter_230bp": {
                "genomic_coordinates_grch38": "chr6:73521000-73521229:-1",
                "canonical_transcript_tss": "ENST00000309268.11 TSS at chr6:73521032:-1 (window spans -197 bp upstream TATA/Sp1 core promoter through +33 bp Exon 1; 5'-UTR Exon 1 splice donor and intron 1 coordinates invariant across .10 and .11)",
                "length_bp": len(eef1a1_core_230),
                "cpg_dinucleotide_count": cpg_eef1a,
                "gc_percent": gc_eef1a,
                "cpg_observed_over_expected": oe_eef1a,
                "sequence_sha256": sha256_str(eef1a1_core_230),
                "evidence_class": "authentic_grch38_upstream_core_promoter_sequence_functional_strength_requires_stage7_wetlab_qualification",
            },
            "WPREmut6_589bp_J04514_mut6": {
                "genomic_coordinates_or_accession": "GenBank:J04514.1:1093-1681_WHV_WPRE_1503AtoT_WHX_Start_Ablated(PMID:19262615)",
                "organism": "Woodchuck hepatitis virus (WHV, GenBank:J04514.1)",
                "length_bp": len(wpre_mut6_589),
                "mutations_vs_J04514_1093_1681": [
                    "J04514.1:g.1503A>T (WHX c.1A>T, legacy alias c.1503A>T; local_1based_411:A>T, WHX_start_codon_ATG->TTG_ablation_per_PMID_19262615)"
                ],
                "nomenclature_qualification_note": (
                    "Canonical part_name WPREmut6_589bp is retained for SHA-256 registry compatibility; sequence carries the "
                    "single-nucleotide WHX start-codon ablation J04514.1:g.1503A>T (ATG->TTG at local 411..413) rather than a 6-point-mutation WE2/mut6 cluster."
                ),
                "sequence_sha256": sha256_str(wpre_mut6_589),
                "primary_citations": ["PMID:19262615"],
            },
            "cHS4_core_insulator_250bp_ULTRACODE_V80_13": {
                "genomic_coordinates_or_accession": "GenBank:U78775.2:10-244 (current, 235-bp exact match) / GenBank:U78775.1:10-226 (superseded, 217-bp exact match) — Gallus gallus beta-globin 5' HS4 insulator (Chung et al. 1997 PMID:9012826; Bell et al. 1999 PMID:10458613)",
                "length_bp": len(chs4_core_250),
                "exact_u78775_2_contiguous_core_match_bp": chs4_alignment["longest_exact_contiguous_match_bp"],
                "computed_native_accession_alignment": chs4_alignment,
                "u78775_2_bases_outside_longest_exact_block_bp": chs4_alignment["left_flank_outside_match_bp"] + chs4_alignment["right_flank_outside_match_bp"],
                "exact_u78775_1_contiguous_core_match_bp": 217,
                "historical_superseded_u78775_1_bases_outside_match_bp": 33,
                "ctcf_ma0139_1_footprint_fii_scan_claude_v80_007": chs4_scan_1pwm,
                "ctcf_ma0139_1_footprint_fii_scan_6_matrix_family": chs4_scan_6pwm,
                "sequence_adaptation_disclosure": (
                    "Engineered 250-bp core insulator variant containing the 235-bp exact contiguous Gallus U78775.2:10..244 "
                    "CTCF/USF1 FII-footprint core (insert coordinates 3..237, flanked by 2-bp 5' GA and 13-bp 3' AGGCTGCCGCGGG containing a 1-nt T deletion "
                    "immediately 3' of native HindIII plus SacII adapter CCGCGG; 217-bp exact contiguous match to superseded U78775.1:10..226). "
                    f"Direct JASPAR MA0139.1 CTCF scan locates the canonical FII enhancer-blocking footprint at local positions {chs4_top1['start_1based_in_window']}..{chs4_top1['end_1based_in_window']} "
                    f"({chs4_top1['strand']} strand, kmer={chs4_top1['matched_kmer']}, score={chs4_top1['log2_odds_score']} bits, "
                    f"rel_score={chs4_top1['relative_score_0_to_1']}; single-PWM window Bonferroni p={chs4_top1['bonferroni_window_p_value']}, "
                    f"6-PWM family Bonferroni p={chs4_top6['bonferroni_region_across_all_matrices_p_value']}, "
                    f"passes_rel_score_0p80_and_p_le_0p05={chs4_top1['passes_rel_score_0p80_and_p_le_0p05']}; FII identity is verified by exact sequence match to Gallus U78775.2:55..73 per "
                    "Chung et al. 1997 PMID:9012826 & Bell et al. 1999 PMID:10458613; closes AUDIT-REF & 068)."
                ),
                "sequence_sha256": sha256_str(chs4_core_250),
                "primary_citations": ["PMID:9012826", "PMID:10458613"],
            },
            "HNRNPA2B1_CBX3_UCOE_candidate_455bp_R17": dict(ucoe_audit_payload),
            "CBX3_A2UCOE_core_455bp_R17": dict(ucoe_audit_payload),
            "SV40_late_polyA_122bp_J02400": {
                "genomic_coordinates_or_accession": "GenBank:J02400.1:2580-2701 (Simian virus 40 complete genome, late polyadenylation signal)",
                "length_bp": len(sv40_polya_122),
                "sequence_sha256": sha256_str(sv40_polya_122),
                "j02400_alignment_verification": {
                    "accession": "J02400.1",
                    "range_1based_closed": "2580..2701",
                    "donor_extracted_1based_span_in_arm1b": "601..722 (-)",
                    "exact_identity_bp": sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122)),
                    "query_length_bp": len(sv40_polya_122),
                    "identity_fraction": round(
                        sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122)) / len(sv40_polya_122), 6
                    ),
                    "terminal_3prime_base": revcomp(arm_1b_seq[600:722])[-1],
                    "non_native_adapter_bases_bp": len(sv40_polya_122) - sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122)),
                    "donor_plus_strand_canonical_AATAAA_1based_spans": [
                        f"{i + 1}..{i + 6}" for i in range(len(arm_1b_seq[600:722]) - 5) if arm_1b_seq[600:722][i : i + 6] == "AATAAA"
                    ],
                    "donor_plus_strand_variant_ATTAAA_1based_spans": [
                        f"{i + 1}..{i + 6}" for i in range(len(arm_1b_seq[600:722]) - 5) if arm_1b_seq[600:722][i : i + 6] == "ATTAAA"
                    ],
                    "transcribed_antisense_cd47_minus_strand_canonical_AATAAA_1based_spans": [
                        f"{i + 1}..{i + 6}"
                        for i in range(len(revcomp(arm_1b_seq[600:722])) - 5)
                        if revcomp(arm_1b_seq[600:722])[i : i + 6] == "AATAAA"
                    ],
                    "transcribed_antisense_cd47_minus_strand_variant_ATTAAA_1based_spans": [
                        f"{i + 1}..{i + 6}"
                        for i in range(len(revcomp(arm_1b_seq[600:722])) - 5)
                        if revcomp(arm_1b_seq[600:722])[i : i + 6] == "ATTAAA"
                    ],
                    "verification_note": (
                        f"{sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122))}/{len(sv40_polya_122)} bp "
                        f"({100.0 * sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122)) / len(sv40_polya_122):.0f}% native identity) "
                        f"sequence-derived exact contiguous match of revcomp(arm_1b_seq[600:722]) to GenBank J02400.1:2580..2701 ending in native 3' {revcomp(arm_1b_seq[600:722])[-1]} "
                        f"({len(sv40_polya_122) - sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122))} non-native adapter bases; AUDIT-REF & AUDIT-REF)."
                    ),
                    "bidirectional_sv40_polya_orientation_note_sonnet55_r1": (
                        "GenBank J02400.1:2580..2701 is the 122-bp bidirectional SV40 early/late polyadenylation region. "
                        f"Direct sequence recount verifies that the transcribed antisense CD47 '-' strand revcomp(arm_1b_seq[600:722]) "
                        f"({sum(a == b for a, b in zip(revcomp(arm_1b_seq[600:722]), sv40_polya_122))}/{len(sv40_polya_122)} identical to J02400.1:2580..2701) carries "
                        f"{len([i for i in range(len(revcomp(arm_1b_seq[600:722])) - 5) if revcomp(arm_1b_seq[600:722])[i : i + 6] == 'AATAAA'])} canonical AATAAA hexamer at local 1-based positions 78..83 "
                        "(0 ATTAAA hexamers), while the opposite donor '+' strand arm_1b_seq[600:722] carries "
                        f"{len([i for i in range(len(arm_1b_seq[600:722]) - 5) if arm_1b_seq[600:722][i : i + 6] == 'AATAAA'])} canonical AATAAA hexamers "
                        "at local 1-based positions 65..70 and 94..99 (0 ATTAAA hexamers); thus antisense CD47 termination uses a canonical "
                        "AATAAA polyadenylation signal at 78..83, with Stage-0 3'-RACE and strand-specific RT-ddPCR verifying cleavage efficiency "
                        "(reconciling AUDIT-REF via AUDIT-REF)."
                    ),
                },
            },
            "bGH_polyA_225bp_M57764": {
                "genomic_coordinates_or_accession": "GenBank:M57764.1:2310-2534 (Bos taurus growth hormone 3' polyadenylation signal)",
                "length_bp": len(bgh_polya_225),
                "sequence_sha256": sha256_str(bgh_polya_225),
                "m57764_alignment_verification": {
                    "accession": "M57764.1",
                    "range_1based_closed": "2310..2534",
                    "donor_extracted_1based_span_in_locus3": "3266..3490 (+)",
                    "exact_identity_bp": sum(a == b for a, b in zip(locus_3_seq[3265:3490], bgh_polya_225)),
                    "query_length_bp": len(bgh_polya_225),
                    "identity_fraction": round(
                        sum(a == b for a, b in zip(locus_3_seq[3265:3490], bgh_polya_225)) / len(bgh_polya_225), 6
                    ),
                    "non_native_adapter_bases_bp": len(bgh_polya_225) - sum(a == b for a, b in zip(locus_3_seq[3265:3490], bgh_polya_225)),
                    "verification_note": (
                        f"{sum(a == b for a, b in zip(locus_3_seq[3265:3490], bgh_polya_225))}/{len(bgh_polya_225)} bp "
                        f"({100.0 * sum(a == b for a, b in zip(locus_3_seq[3265:3490], bgh_polya_225)) / len(bgh_polya_225):.0f}% native identity) "
                        "sequence-derived exact contiguous match of locus_3_seq[3265:3490] to GenBank M57764.1:2310..2534 (AUDIT-REF)."
                    ),
                },
            },
        },
        "processed_polypeptide_ledger": processed_polypeptide_ledger,
        "constructs": [
            make_construct_entry(
                "LOCUS1_ARM1A_TPT2A_BICISTRONIC",
                "B2M Exon 1 (GRCh38 chr15:44711608|44711609, + strand)",
                arm_1a_seq,
                1600,
                arm_1a_orf,
                arm_1a_parts,
                {
                    "canonical_gsgp2a_construct_alias": "LOCUS1_ARM1A_GSGP2A_BICISTRONIC",
                    "delivery_modality": "Non-viral linear/closed-ended dsDNA or ssDNA HDR comparator (exceeds 4.7 kb AAV6 budget when 290 bp ITRs are included)",
                    "furin_motif_present": False,
                    "furin_topology_note": "Zero Furin motif included because HLA-E C-terminus (L358) is cytoplasmic; Furin is strictly trans-Golgi luminal (closes R01 & V70-02).",
                    "expected_2a_readthrough_fusion_pct": 5.0,
                    "native_b2m_atg_uorf_and_5prime_leader_audit": audit_b2m_native_atg_uorf(arm_1a_seq, 739, 1173, "LOCUS1_ARM1A", internal_tss_1based=998),
                },
            ),
            make_construct_entry(
                "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01",
                "B2M Exon 1 (GRCh38 chr15:44711608|44711609, + strand)",
                arm_1b_seq,
                1200,
                hlae_sct_dna_stop,
                arm_1b_parts,
                {
                    "delivery_modality": "Single AAV6 capsid (4,264 bp including 2x145 bp ITRs; +436 bp headroom) or non-viral ssDNA HDR",
                    "sense_orf_hlae_sct_bp": len(hlae_sct_dna_stop),
                    "sense_promoter_driving_hlae_sct": (
                        "Syn_5xISRE_minP_148bp_sense (inducible sense promoter; endogenous B2M promoter upstream of B2M_HA_L_600bp "
                        "is separated by a 21-aa sense uORF at 539..604 and 11 intervening sense ATGs [10 across the antisense CD47-EEF1A1 "
                        "module at 613..1457 plus 1 at 1574..1576 in Syn_5xISRE_minP_148bp_sense] before the HLA-E Kozak ATG at 1647; SV40_late_polyA_122bp_antisense is on the '-' strand and terminates "
                        "antisense CD47, NOT sense B2M read-through, closing AUDIT-REF)"
                    ),
                    "antisense_orf_cd47_igv_gpi_bp": len(cd47_igv_gpi_dna),
                    "antisense_promoter_driving_cd47_igv_gpi": "EEF1A1_core_promoter_230bp_antisense (constitutive Hour-0 drive, closes AUDIT-REF)",
                    "expected_2a_readthrough_fusion_pct": 0.0,
                    "native_b2m_atg_uorf_and_5prime_leader_audit": audit_b2m_native_atg_uorf(arm_1b_seq, 539, 1647, "LOCUS1_ARM1B", internal_tss_1based=1596),
                    "arm1b_vs_arm1x_codon_coordinate_table": {
                        "arm1b_donor_length_bp": len(arm_1b_seq),
                        "cd47_antisense_cds_1based_span": "723..1250 (-)",
                        "cd47_antisense_cds_length_bp": len(cd47_igv_gpi_dna),
                        "cd47_cys15_mature_cys33_precursor_1based_span_in_arm1b_and_arm1x": {
                            "donor_1based_coordinates": "1152..1154",
                            "donor_plus_strand_triplet": arm_1b_seq[1151:1154],
                            "coding_minus_strand_codon_wt": revcomp(arm_1b_seq[1151:1154]),
                            "arm1x_proposed_c15g_coding_codon": "GGC (donor '+' strand GCC; coordinates 1152..1154 are upstream of the sense promoter and invariant between Arm 1B and Arm 1X)",
                        },
                        "hlae_sense_cds_1based_span_in_arm1b": "1647..3149 (+)",
                        "hlae_sense_cds_length_bp": len(hlae_sct_dna_stop),
                        "hlae_d227_t228_mature_aa390_391_precursor_in_arm1b": {
                            "sct_precursor_1based_codons": "390..391 (163-aa SCT N-terminal prefix [20-aa B2M signal + 9-aa VMAPRTLVL + 15-aa (G4S)3 + 99-aa mature B2M + 20-aa (G4S)4] + mature HLA-E D227/T228 = precursor codons D390/T391, flanked by Q389; AUDIT-REF)",
                            "donor_1based_coordinates_in_3974bp_arm1b": "2814..2819",
                            "donor_plus_strand_hexamer_wt": arm_1b_seq[2813:2819],
                            "donor_1based_coordinates_in_4056bp_arm1x_with_230bp_sense_promoter": "2896..2901 (+82 bp shift from replacing 148-bp Syn_5xISRE_minP with 230-bp sense promoter)",
                            "arm1x_proposed_d227k_t228a_hexamer": "AAGGCC",
                        },
                        "hlae_d227_t228_mature_aa389_390_precursor_in_arm1b": {
                            "sct_precursor_1based_codons": "390..391 (legacy key retained for schema compatibility; exact precursor codons are D390/T391 = 163-aa SCT prefix + mature HLA-E D227/T228; AUDIT-REF)",
                            "donor_1based_coordinates_in_3974bp_arm1b": "2814..2819",
                            "donor_plus_strand_hexamer_wt": arm_1b_seq[2813:2819],
                            "donor_1based_coordinates_in_4056bp_arm1x_with_230bp_sense_promoter": "2896..2901 (+82 bp shift from replacing 148-bp Syn_5xISRE_minP with 230-bp sense promoter)",
                            "arm1x_proposed_d227k_t228a_hexamer": "AAGGCC",
                        },
                        "single_variable_challenger_arms_kimi31_q1": (lambda: (
                            (lambda
                                arm1b_c15g_seq,
                                div_l1_45,
                                div_l2_60,
                                arm1b_l1l2_div_seq,
                                spa49_spacer40_maz4_65_154bp,
                                arm1b_sense_term_4128_seq,
                                b2m_ha_l_s3_only_600,
                                b2m_ha_l_s3_uorf_600,
                                eef1a1_5top_cagaga_230,
                                div_l1_20aa_60bp,
                                arm1a_lite_canonical_3891,
                                arm1a_lite_edited_3891,
                                arm1a_lite_edited_20aa_l1_3906,
                                wpre3_compact_389bp,
                                arm1c_constitutive_3300,
                                arm1c_trapped_3459,
                                dxs_locus4_4048,
                                arm1b_s3_3974,
                                dxl3_unspaced_3717,
                                dxl3_pause_spacer_82bp,
                                dxl3_spaced_3799: {
                                "Arm_1B_CD47_C15G_single_nucleotide_challenger": {
                                    "donor_length_bp": len(arm1b_c15g_seq),
                                    "packaged_aav6_length_with_2x145bp_itrs_bp": len(arm1b_c15g_seq) + 290,
                                    "assembled_donor_sha256": sha256_str(arm1b_c15g_seq),
                                    "assembled_donor_sequence": arm1b_c15g_seq,
                                    "max_disjoint_inverted_repeat_stem_bp": _max_disjoint_inverted_repeat_stem_bp(arm1b_c15g_seq),
                                    "edit_coordinate_1based": 1154,
                                    "edit_coordinate_0based": 1153,
                                    "plus_strand_mutation": (
                                        "1152..1154 GCA -> GCC (single A->C transversion at 1-based donor nucleotide 1154 "
                                        "[0-based index 1153]; closing AUDIT-REF)"
                                    ),
                                    "coding_minus_strand_codon_change": "TGC (Cys15 mature / Cys33 precursor) -> GGC (Gly15 mature / Gly33 precursor)",
                                    "scientific_rationale": "Single-variable orthogonal challenger isolating the free sulfhydryl C15G substitution in CD47-IgV-GPI without confounding sense-promoter or HLA-E alpha3 mutations (AUDIT-REF & AUDIT-REF).",
                                },
                                "Arm_1B_L1L2_Synonymous_Linker_Diversified_challenger": {
                                    "donor_length_bp": len(arm1b_l1l2_div_seq),
                                    "assembled_donor_sha256": sha256_str(arm1b_l1l2_div_seq),
                                    "assembled_donor_sequence": arm1b_l1l2_div_seq,
                                    "max_disjoint_inverted_repeat_stem_bp": _max_disjoint_inverted_repeat_stem_bp(arm1b_l1l2_div_seq),
                                    "l1_1based_span_in_arm1b": "1734..1778 (45 bp)",
                                    "l2_1based_span_in_arm1b": "2076..2135 (60 bp)",
                                    "canonical_l1_in_l2_exact_identity_bp": len(arm_1b_seq[1733:1778]),
                                    "diversified_l1_45bp": div_l1_45,
                                    "diversified_l2_60bp": div_l2_60,
                                    "diversified_l1_l2_longest_exact_repeat_bp": _longest_exact_repeat_and_ge20_count(div_l1_45 + div_l2_60)[0],
                                    "longest_exact_repeat_bp_within_l1_l2": _longest_exact_repeat_and_ge20_count(div_l1_45 + div_l2_60)[0],
                                    "scientific_rationale": "Replaces canonical L1 (45 bp, which is an exact 45-bp prefix/substring of canonical 60-bp L2; AUDIT-REF) with non-repeating synonymous Gly/Ser codons, reducing maximum exact repeat length across L1/L2 from 45 bp cross-linker (52 bp under n//2-capped concatenation, 90 bp overlapping repeat in 105-bp L1+L2; legacy note 59 bp) to 9 bp (<=11 bp legacy bound) while preserving exact amino-acid sequence and 3,974-bp donor length (AUDIT-REF, AUDIT-REF & AUDIT-REF).",
                                },
                                "Arm_1B_Sense_Readthrough_Terminator_Shield_challenger_astra_r1": {
                                    "donor_length_bp": len(arm1b_sense_term_4128_seq),
                                    "legacy_unspaced_122bp_sv40_donor_length_bp": len(arm_1b_seq) + 122,
                                    "packaged_aav6_length_with_2x145bp_itrs_bp": len(arm1b_sense_term_4128_seq) + 290,
                                    "aav6_4700bp_headroom_bp": 4700 - (len(arm1b_sense_term_4128_seq) + 290),
                                    "inserted_part_1based_boundary": "600|601 (between B2M_HA_L_600bp and Antisense_SV40_polyA_122bp)",
                                    "inserted_154bp_spa_spacer_maz4_sequence": spa49_spacer40_maz4_65_154bp,
                                    "inserted_154bp_element_sha256": sha256_str(spa49_spacer40_maz4_65_154bp),
                                    "assembled_4128bp_donor_sha256": sha256_str(arm1b_sense_term_4128_seq),
                                    "assembled_donor_sequence": arm1b_sense_term_4128_seq,
                                    "post_insertion_b2m_sense_uorf_audit_kimi31_r2": {
                                        "native_b2m_start_codon_1based": "539..541 (ATG)",
                                        "out_of_frame_spa_taa_1based": "603..605 (TAA inside 5'-AATAAA-3' at 601..606 is in frame +1 relative to ATG at 539; 602..604 is in-frame ATA [Ile])",
                                        "post_insertion_in_frame_stop_codon_1based": "623..625 (TAG inside 5'-TTAGATCT-3' of the 49-bp Levitt SPA element)",
                                        "post_insertion_uorf_length_bp": 87,
                                        "post_insertion_uorf_peptide_aa": 28,
                                        "post_insertion_uorf_peptide_sequence": translate_dna(arm1b_sense_term_4128_seq[538:625])[:-1],
                                        "note": (
                                            "In the 4,128-bp sense-terminator donor, the native B2M ATG at 1-based 539..541 (539 = 2 mod 3) reads across the 600|601 "
                                            "boundary (codon 21 at 599..601 = ATA [Ile], codon 22 at 602..604 = ATA [Ile]; the TAA inside 5'-AATAAA-3' at 601..606 sits at "
                                            "603..605 in the +1 frame) and terminates at the first in-frame stop codon TAG at 1-based 623..625 (codon 29, 87 bp / 28 aa "
                                            "peptide MSRSVALAVLALLSLSGLEAIIKDLYFH) inside the 49-bp SPA element prior to the 65-bp MAZ4 pause site and antisense CD47 unit "
                                            "(AUDIT-REF & AUDIT-REF)."
                                        ),
                                    },
                                    "inserted_element": (
                                        "154-bp non-palindromic sense-strand SPA (49-bp synthetic polyA sequence model motivated by Levitt et al. 1989 PMID:2570734) + 40-bp neutral spacer "
                                        "+ 65-bp MAZ4-inspired G-rich Pol II pause element (engineering sequence model motivated by Ashfield et al. 1994 PMID:7988563; lacks exact G5AG5 consensus copies, so functional Pol II pause/termination and dsRNA suppression require Stage-0 Readout 4 strand-specific RT-ddPCR and J2 anti-dsRNA dot-blot verification; AUDIT-REF), replacing the unspaced 122-bp sense SV40_late_polyA "
                                        "which would form a 244-bp zero-spacer perfect inverted repeat x + rc(x) [122-bp stem] against Arm 1B's antisense "
                                        "SV40_late_polyA at nt 601..722 (AUDIT-REF, Q1-P8, & AUDIT-REF)"
                                    ),
                                    "max_disjoint_inverted_repeat_stem_across_full_4128bp_donor_bp": _max_disjoint_inverted_repeat_stem_bp(arm1b_sense_term_4128_seq),
                                    "max_disjoint_inverted_repeat_stem_in_276bp_terminator_sv40_boundary_bp": _max_disjoint_inverted_repeat_stem_bp(spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:722]),
                                    "inverted_repeat_stems_ge_16bp_count": _count_disjoint_inverted_repeat_stems_ge_k(arm1b_sense_term_4128_seq, 16),
                                    "max_inverted_repeat_stem_bp": _max_disjoint_inverted_repeat_stem_bp(arm1b_sense_term_4128_seq),
                                    "passes_zero_inverted_repeat_ge16bp_ssdna_packaging_lint": bool(_max_disjoint_inverted_repeat_stem_bp(arm1b_sense_term_4128_seq) < 16),
                                    "matched_4128bp_spa_s3_15aa_l1_satellite_control_donor_length_bp": 4128,
                                    "matched_4128bp_spa_s3_15aa_l1_satellite_control_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "matched_4128bp_spa_s3_15aa_l1_satellite_control_donor_sequence": (
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "arm1b_spa_s3_15aal1_matched_linker_control_4128bp_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "arm1b_spa_s3_15aal1_matched_linker_control_4128bp_donor_sequence": (
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "matched_4128bp_spa_s3_uorf_agg_15aa_l1_satellite_control_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_uorf_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "matched_4128bp_spa_s3_uorf_agg_15aa_l1_satellite_control_donor_sequence": (
                                        b2m_ha_l_s3_uorf_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:]
                                    ),
                                    "sense_hla_e_sct_coordinate_table_in_4143bp_and_4128bp_donors_astra_r3": {
                                        "Syn_5xISRE_minP_148bp_sense_1based": "1644..1791",
                                        "Kozak_9bp_sense_1based": "1792..1800",
                                        "HLAE_SCT_start_codon_ATG_1based": "1801..1803",
                                        "HLAE_SCT_B2M_signal_peptide_20aa_1based": "1801..1860",
                                        "HLAE_SCT_VMAPRTLVL_9aa_peptide_1based": "1861..1887",
                                        "L1_linker_15aa_45bp_in_4128bp_donor_1based": "1888..1932",
                                        "L1_linker_20aa_60bp_in_4143bp_donor_1based": "1888..1947",
                                        "mature_B2M_first_20aa_in_4143bp_donor_1based": "1948..2007",
                                        "HLAE_SCT_ORF_4128bp_15aa_L1_1based": "1801..3303",
                                        "HLAE_SCT_ORF_4128bp_15aa_L1_length_bp": 1503,
                                        "HLAE_SCT_ORF_4143bp_20aa_L1_1based": "1801..3318",
                                        "HLAE_SCT_ORF_4143bp_20aa_L1_length_bp": 1518,
                                        "bGH_polyA_225bp_sense_in_4128bp_donor_1based": "3304..3528",
                                        "bGH_polyA_225bp_sense_in_4143bp_donor_1based": "3319..3543",
                                        "B2M_HA_R_600bp_in_4128bp_donor_1based": "3529..4128",
                                        "B2M_HA_R_600bp_in_4143bp_donor_1based": "3544..4143",
                                        "l1_codon_diversification_note": (
                                            "Note: the 60-bp 20-aa L1=(GGGGS)4 block at 1888..1947 in 4,143-bp Embodiment A* is a codon-diversified "
                                            "(GGGGS)4 nucleotide sequence that differs at 14 synonymous nucleotide positions across 10 shared codons in the first 45 bp relative to the "
                                            "45-bp 15-aa L1=(GGGGS)3 block at 1888..1932 in the 4,128-bp satellite control while preserving 100% (GGGGS)n amino-acid identity "
                                            "(making the 4,143-bp vs 4,128-bp comparison a joint linker-length + synonymous-codon-schedule intervention bundle unless paired with an identical-45bp-prefix codon control; AUDIT-REF & AUDIT-REF)."
                                        ),
                                    },
                                    "embodiment_a_star_combined_4143bp_donor_length_bp": 4143,
                                    "embodiment_a_star_combined_4143bp_packaged_aav6_length_bp": 4433,
                                    "embodiment_a_star_combined_4143bp_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_combined_4143bp_donor_sequence": (
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_combined_4143bp_with_uorf_agg_ablation_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_uorf_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_combined_4143bp_with_uorf_agg_ablation_donor_sequence": (
                                        b2m_ha_l_s3_uorf_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_combined_4143bp_with_5top_cagaga_donor_sha256": sha256_str(
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1259] + revcomp(eef1a1_5top_cagaga_230) + arm_1b_seq[1489:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_combined_4143bp_with_5top_cagaga_donor_sequence": (
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1259] + revcomp(eef1a1_5top_cagaga_230) + arm_1b_seq[1489:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "embodiment_a_star_native_b2m_atg_uorf_and_ablation_note_kimi31_r3": (
                                        "In the primary 4,143-bp Embodiment A* donor (b2m_ha_l_s3_only_600, SHA-256 prefix 0995f8e35791d219), the endogenous B2M Exon-1 ATG at 539..541 is preserved "
                                        "and terminates at the in-frame stop TAG at 623..625 (87-bp / 28-aa uORF) inside the 154-bp SPA+spacer+MAZ4 terminator prior to the "
                                        "antisense CD47 unit, while sense HLA-E SCT is driven independently by internal Syn_5xISRE_minP_148bp_sense at 1644..1791 (1490..1637 + 154-bp upstream terminator) -> Kozak_9bp at 1792..1800 -> HLA-E start codon ATG at 1801..1803 (complete 1,518-bp / 505-aa + stop HLA-E SCT ORF at 1801..3318 in 4,143-bp A* vs 1,503-bp / 500-aa + stop at 1801..3303 in the 4,128-bp 15-aa L1 control, with the 60-bp 20-aa L1 linker internal to the ORF at 1888..1947 [and mature B2M residues 1..20 at 1948..2007]; note 1907..1909 is GTG); "
                                        "the companion 4,143-bp donor with 540 T->G (b2m_ha_l_s3_uorf_600, chr15:44711548T>G, SHA-256 prefix e1dbe2bbe797058c) additionally ablates the 539..541 ATG to AGG, and matched_4128bp_spa_s3_15aa_l1_satellite_control_donor_sequence provides the exact S3-matched 4,128-bp 15-aa L1 satellite control (AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                                    ),
                                    "max_disjoint_inverted_repeat_stem_across_4143bp_embodiment_a_star_bp": _max_disjoint_inverted_repeat_stem_bp(
                                        b2m_ha_l_s3_only_600 + spa49_spacer40_maz4_65_154bp + arm_1b_seq[600:1733] + div_l1_20aa_60bp + arm_1b_seq[1778:]
                                    ),
                                    "scientific_rationale": (
                                        "Terminates sense-strand Pol II readthrough from the endogenous B2M Exon 1 promoter (chr15:44711477..44711547) "
                                        "before it traverses the antisense CD47-IgV-GPI transcription unit, preventing convergent sense/antisense dsRNA "
                                        "formation and MDA5/IFIH1 innate immune sensing in T1D beta-cells (Liddicoat et al. 2015 PMID:26275108; AUDIT-REF) "
                                        "while using an orthogonal sequence-divergent SPA+spacer+MAZ4 sense terminator so zero hairpins >=16 bp form in the "
                                        "single-stranded AAV6 genome (max disjoint inverted-repeat stem = 8 bp across the 276-bp terminator-SV40pA boundary and "
                                        "15 bp across the full 4,128-bp donor; AUDIT-REF, Q1-P8, & AUDIT-REF)."
                                    ),
                                },
                                "Arm_1A_lite_AAV6_compatible_challenger_sonnet55_r1": {
                                    "donor_length_bp": len(arm1a_lite_canonical_3891),
                                    "packaged_aav6_length_with_2x145bp_itrs_bp": len(arm1a_lite_canonical_3891) + 290,
                                    "aav6_4700bp_headroom_bp": 4700 - (len(arm1a_lite_canonical_3891) + 290),
                                    "canonical_parts_assembled_donor_sha256": sha256_str(arm1a_lite_canonical_3891),
                                    "canonical_parts_assembled_donor_sequence": arm1a_lite_canonical_3891,
                                    "max_disjoint_inverted_repeat_stem_canonical_3891bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1a_lite_canonical_3891),
                                    "edited_3891bp_with_uorf_agg_s3_and_5top_cagaga_donor_sha256": sha256_str(arm1a_lite_edited_3891),
                                    "edited_3891bp_with_uorf_agg_s3_and_5top_cagaga_donor_sequence": arm1a_lite_edited_3891,
                                    "max_disjoint_inverted_repeat_stem_edited_3891bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1a_lite_edited_3891),
                                    "edited_3906bp_with_20aa_l1_g4s4_donor_length_bp": len(arm1a_lite_edited_20aa_l1_3906),
                                    "edited_3906bp_with_20aa_l1_g4s4_packaged_length_bp": len(arm1a_lite_edited_20aa_l1_3906) + 290,
                                    "edited_3906bp_with_20aa_l1_g4s4_donor_sha256": sha256_str(arm1a_lite_edited_20aa_l1_3906),
                                    "edited_3906bp_with_20aa_l1_g4s4_donor_sequence": arm1a_lite_edited_20aa_l1_3906,
                                    "max_disjoint_inverted_repeat_stem_edited_3906bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1a_lite_edited_20aa_l1_3906),
                                    "diversified_20aa_l1_g4s4_60bp_sequence": div_l1_20aa_60bp,
                                    "architecture": (
                                        "600-bp B2M_HA_L (canonical 3,891-bp SHA-256 above, plus sequence-materialized 3,891-bp edited variant carrying "
                                        "0-bp native B2M ATG->AGG uORF ablation at nt 539..541 and 4-nt synonymous S3 AsCas12a PAM+seed shield at nt 583, 589, 592, 595, "
                                        "and 3,906-bp +15-bp 20-aa L1=(G4S)4 variant; AUDIT-REF) + 230-bp EEF1A1_core_promoter (5'TOP CTTTTT->CAGAGA at nt 798..803) "
                                        "+ 133-bp Chimeric_Intron + 9-bp Kozak + 1,500-bp (or 1,515-bp) HLA-E*01:03(VMAPRTLVL) SCT + 66-bp GSG-P2A + 528-bp CD47-IgV-GPI "
                                        "+ 225-bp bGH_polyA + 600-bp B2M_HA_R (omitting 589-bp WPREmut6 and trimming 2x800-bp HAs to 2x600-bp)"
                                    ),
                                    "cross_donor_locus3_longest_shared_block_bp": 225,
                                    "cross_donor_locus3_longest_shared_block_canonical_parts_bp": 225,
                                    "cross_donor_locus3_longest_shared_block_with_orthogonal_polya_and_diversified_2a_bp": 11,
                                    "scientific_rationale": (
                                        "Compresses canonical 4,880-bp Arm 1A by 989 bp into a 3,891-bp donor (4,181 bp packaged with 2x145 bp ITRs; "
                                        "+519 bp AAV6 headroom, or 3,906 bp / 4,196 bp packaged with the 20-aa L1=(G4S)4 linker), enabling an unconfounded "
                                        "single-AAV6 head-to-head comparison against 3,974-bp Arm 1B while eliminating the 589-bp WPREmut6 portion of the "
                                        "821-bp WPREmut6+bGHpA cross-donor homology block with Locus 3 (reducing canonical shared homology to 225 bp at bGH_polyA "
                                        "and 69 bp at GSG-P2A+ATG, and to 11 bp when paired with orthogonal polyA + diversified 2A or 2A-free DX-L3) and ablating "
                                        "the upstream native B2M ATG uORF (AUDIT-REF, Q1-P2, AUDIT-REF, & AUDIT-REF)."
                                    ),
                                },
                                "DX_S_Split_Cassette_Arm1C_HLAE_plus_Locus4_CD47_challenger_sonnet55_r1": {
                                    "locus1_arm1c_donor_length_bp": len(arm1c_trapped_3459),
                                    "locus1_arm1c_packaged_aav6_length_bp": len(arm1c_trapped_3459) + 290,
                                    "locus1_arm1c_aav6_headroom_bp": 4700 - (len(arm1c_trapped_3459) + 290),
                                    "locus1_arm1c_promoter_trapped_wpre3_3459bp_donor_sha256": sha256_str(arm1c_trapped_3459),
                                    "locus1_arm1c_promoter_trapped_wpre3_3459bp_donor_sequence": arm1c_trapped_3459,
                                    "max_disjoint_inverted_repeat_stem_arm1c_3459bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1c_trapped_3459),
                                    "wpre3_compact_389bp_sequence": wpre3_compact_389bp,
                                    "wpre3_compact_389bp_sha256": sha256_str(wpre3_compact_389bp),
                                    "wpre3_compact_389bp_provenance_note_astra_r2": (
                                        "389-bp 5' gamma+alpha prefix of WPREmut6_589bp (WHV J04514.1:1093..1481; distinct from the 247-bp Choi et al. 2014 [PMID:24618276, PMC3975461] "
                                        "gamma+alpha WPRE3 bridge J04514.1:1093..1339 and from the full 589-bp tripartite gamma-alpha-beta WPREmut6; AUDIT-REF)."
                                    ),
                                    "promoter_trapped_post_splice_uorf_audit_and_rescue_astra_r2": {
                                        "unmodified_3459bp_post_splice_uorf_hazard": (
                                            "In unmodified promoter-trapped Arm 1C (3,459 bp), excising the 133-nt chimeric intron (601..733) joins B2M_HA_L nt 600 (5'-...CTCGCGCTACTCTCTCTTTCTGGCCTGGAGGCTAT-3') "
                                            "to Kozak_9bp nt 734 (5'-GCCGCCACCATG...-3'), placing the HLA-E start codon at spliced 610..612 while both the native B2M ATG at 539..541 "
                                            "(24-aa uORF MSRSVALAVLALLSLSGLEAMPPP*) and a de novo splice-junction ATG at 599..600+734 (4-aa uORF MPPP*) read through GCCGCCACC in frame "
                                            "and terminate at TGA (spliced 611..613, overlapping HLA-E ATG 610..612 across 2 shared nucleotides [611..612 TG] in a 4-nt ATGA start/stop overlap [-1 frame shift]; AUDIT-REF)."
                                        ),
                                        "double_uaug_ablated_rescue_mutations": "B2M_HA_L nt 540 T->G (native ATG->AGG), nt 599..600 AT->CC (eliminating splice-junction ATG), plus 4-nt S3 PAM+seed shield at nt 583, 589, 592, 595",
                                        "double_uaug_ablated_3459bp_donor_sha256": sha256_str(
                                            (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")
                                            + arm1c_trapped_3459[600:]
                                        ),
                                        "double_uaug_ablated_3459bp_donor_sequence": (
                                            (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")
                                            + arm1c_trapped_3459[600:]
                                        ),
                                        "post_splice_upstream_atg_count_between_tss509_and_hlae_atg610": 0,
                                        "u1_snrna_consensus_600t_to_g_splice_donor_rescue_sonnet55_r2": {
                                            "u1_snrna_base_pairing_warning_for_599_600_at_to_cc": (
                                                "Mutating B2M_HA_L nt 599..600 AT->CC sits at the -2 and -1 exonic positions immediately upstream of the 133-nt chimeric intron "
                                                "5' splice donor |GTAAGT (nt 601..606), converting the exonic-intronic junction from TAT|GTAAGT (7/9 match to the mammalian U1 snRNA "
                                                "5' splice-site consensus MAG|GTRAGT) to TCC|GTAAGT (6/9 match, disrupting both -2 A and -1 G exonic U1 snRNA base-pairing; S55R2-D2-01)."
                                            ),
                                            "preferred_single_nt_600t_to_g_rescue_mutations": (
                                                "B2M_HA_L nt 540 T->G (native ATG->AGG, chr15:44711548T>G) + single-base nt 600 T->G (599..600 AT->AG, chr15:44711608T>G) "
                                                "+ 4-nt S3 PAM+seed shield at nt 583, 589, 592, 595: eliminates the de novo 599..600+734 splice-junction ATG while upgrading "
                                                "the 5' splice donor junction to canonical TAG|GTAAGT (8/9 match to MAG|GTRAGT, restoring the optimal -1 G consensus base) "
                                                "with 0 post-splice upstream ATGs between TSS 509 and HLA-E ATG 610."
                                            ),
                                            "u1_consensus_600t_to_g_3459bp_donor_sha256": sha256_str(
                                                (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")
                                                + arm1c_trapped_3459[600:]
                                            ),
                                            "u1_consensus_600t_to_g_3459bp_donor_sequence": (
                                                (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")
                                                + arm1c_trapped_3459[600:]
                                            ),
                                            "u1_consensus_600t_to_g_post_splice_upstream_atg_count_between_tss509_and_hlae_atg610": 0,
                                            "materialized_post_splice_transcripts_and_retired_642nt_note_kimi31_r3": {
                                                "arm1c_599_600_cc_spliced_5utr_101nt_sequence": (
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")[508:600]
                                                    + arm1c_trapped_3459[733:742]
                                                ),
                                                "arm1c_599_600_cc_spliced_5utr_101nt_sha256": sha256_str(
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")[508:600]
                                                    + arm1c_trapped_3459[733:742]
                                                ),
                                                "arm1c_599_600_cc_spliced_mrna_2218nt_sequence": (
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")[508:600]
                                                    + arm1c_trapped_3459[733:2859]
                                                ),
                                                "arm1c_599_600_cc_spliced_mrna_2218nt_sha256": sha256_str(
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:598] + "CC")[508:600]
                                                    + arm1c_trapped_3459[733:2859]
                                                ),
                                                "arm1c_u1_600g_spliced_5utr_101nt_sequence": (
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")[508:600]
                                                    + arm1c_trapped_3459[733:742]
                                                ),
                                                "arm1c_u1_600g_spliced_5utr_101nt_sha256": sha256_str(
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")[508:600]
                                                    + arm1c_trapped_3459[733:742]
                                                ),
                                                "arm1c_u1_600g_spliced_mrna_2218nt_sequence": (
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")[508:600]
                                                    + arm1c_trapped_3459[733:2859]
                                                ),
                                                "arm1c_u1_600g_spliced_mrna_2218nt_sha256": sha256_str(
                                                    (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:599] + "G")[508:600]
                                                    + arm1c_trapped_3459[733:2859]
                                                ),
                                                "retired_historical_642nt_digest_note": (
                                                    "Materializes the exact post-splice 5'-UTR leader (101 nt: B2M exon-1 509..600 [92 nt] + Kozak 734..742 [9 nt]) "
                                                    "and full spliced transcript body (2,218 nt from TSS 509 through bGH_polyA 2859, excising the 133-nt chimeric intron 601..733) "
                                                    "for both Arm 1C-599_600_CC and Arm 1C-U1-600G, and retires the unmaterialized historical 642-nt narrative digest prefix "
                                                    "(efea4d2ddfaab3ca) in favor of the sequence-materialized 3,459-bp donor digests (ba78da72229ee116... and bb3e41591cf3e6b8...) "
                                                    "and post-splice transcript digests above (AUDIT-REF)."
                                                ),
                                            },
                                            "stage0_3arm_9clone_splicing_and_mfi_gate_sonnet55_r2": {
                                                "n_arms": 3,
                                                "n_arms_promoter_trapped_test_only_reference_exclusive": 3,
                                                "n_arms_including_constitutive_3300bp_reference_muse_r2": 4,
                                                "n_clones_per_arm": 3,
                                                "n_clones_total": 9,
                                                "n_clones_promoter_trapped_test_only_reference_exclusive": 9,
                                                "n_clones_total_including_constitutive_3300bp_reference_muse_r2": 12,
                                                "arm_count_scope_note": (
                                                    "n_arms=3 and n_clones_total=9 count the 3 promoter-trapped 3,459-bp test arms (reference-exclusive), "
                                                    "whereas arms (len=4) and n_arms_including_constitutive_3300bp_reference_muse_r2=4 / 12 include the 4th "
                                                    "constitutive 3,300-bp EEF1A1_core reference arm (AUDIT-REF)."
                                                ),
                                                "arms": [
                                                    "Arm 1C-unmodified (3,459-bp promoter-trapped TAT|GTAAGT, 2 post-splice uORFs, unmodified GRCh38 B2M_HA_L; ebbde623...)",
                                                    "Arm 1C-599_600_CC (3,459-bp promoter-trapped TCC|GTAAGT, 6/9 U1 match, 0 post-splice uORFs, S3+uORF B2M_HA_L; ba78da72...)",
                                                    "Arm 1C-600_G (3,459-bp promoter-trapped TAG|GTAAGT, 8/9 U1 match, 0 post-splice uORFs, S3+uORF B2M_HA_L; bb3e4159...)",
                                                    "Arm 1C-constitutive-3300bp (3,300-bp constitutive EEF1A1_core + 133-bp Chimeric_Intron reference arm: paired as S3+uORF+5'TOP b1e17584... against S3+uORF-shielded Arm 1C-599_600_CC / Arm 1C-600_G, and as unshielded native-parts 259d1654... against unmodified Arm 1C-unmodified to preserve single-variable attribution; AUDIT-REF & L2A-01 [DEC-077])",
                                                ],
                                                "splicing_efficiency_se_s_over_s_plus_u_minimum": 0.85,
                                                "splicing_efficiency_se_high_benchmark_for_lt_5pct_intron_retention": 0.95,
                                                "equivalent_spliced_to_unspliced_ratio_s_over_u_at_se_0p85": 5.67,
                                                "equivalent_spliced_to_unspliced_ratio_s_over_u_at_se_0p95": 19.0,
                                                "quantitative_promotion_gate": (
                                                    "Intron-spanning RT-PCR / ddPCR splicing efficiency SE = S/(S+U) >= 0.85 (<= 15% unspliced intron retention, equivalent to S/U >= 5.67; "
                                                    "with SE >= 0.95 [<= 5% intron retention, S/U >= 19.0] as the high-efficiency benchmark; AUDIT-REF), absolute spliced transcript copy number "
                                                    "(ddPCR copies/ng total RNA) non-inferior to the background-matched constitutive 3,300-bp Arm 1C reference (S3+uORF+5'TOP b1e17584... for Arm 1C-599_600_CC / Arm 1C-600_G; native-parts 259d1654... for Arm 1C-unmodified; L2A-01 [DEC-077]), AND surface HLA-E MFI (clone 3D12) >= 1.5x "
                                                    "Arm 1C-unmodified AND >= 0.90x constitutive 3,300-bp Arm 1C reference; if promoter-trapped 3,459-bp Arm 1C fails under basal low-IFN-gamma conditions, promote constitutive 3,300-bp Arm 1C (S55R2-D2-01, D2-03, AUDIT-REF, AUDIT-REF & L2A-01 [DEC-077])."
                                                ),
                                            },
                                        },
                                    },
                                    "locus1_arm1c_constitutive_eef1a1_intron_part_sum_donor_length_bp": len(arm1c_constitutive_3300),
                                    "locus1_arm1c_constitutive_eef1a1_intron_donor_sha256": sha256_str(arm1c_constitutive_3300),
                                    "locus1_arm1c_constitutive_eef1a1_intron_donor_sequence": arm1c_constitutive_3300,
                                    "locus1_arm1c_constitutive_native_parts_3300bp_donor_sha256": sha256_str(
                                        b2m_ha_l_600 + eef1a1_core_230 + chimeric_intron_133 + kozak_9 + hlae_sct_dna_stop + bgh_polya_225 + b2m_ha_r_600
                                    ),
                                    "locus1_arm1c_constitutive_native_parts_3300bp_donor_sequence": (
                                        b2m_ha_l_600 + eef1a1_core_230 + chimeric_intron_133 + kozak_9 + hlae_sct_dna_stop + bgh_polya_225 + b2m_ha_r_600
                                    ),
                                    "max_disjoint_inverted_repeat_stem_arm1c_3300bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1c_constitutive_3300),
                                    "locus1_arm1c_part_sum_reconciliation_note": (
                                        "Canonical constitutive Arm 1C part sum is 600 (B2M_HA_L) + 230 (EEF1A1_core) + 133 (Chimeric_Intron) "
                                        "+ 9 (Kozak) + 1503 (HLA-E SCT stop) + 225 (bGHpA) + 600 (B2M_HA_R) = 3,300 bp donor (3,590 bp packaged, +1,110 bp headroom): "
                                        "both the S3+uORF+5'TOP-edited 3,300-bp constitutive donor (locus1_arm1c_constitutive_eef1a1_intron_donor_sha256 = b1e17584e6217043e2e7cfc931d8f91db60934806b611efc5bd556ddb103da8e, carrying the 5-SNV S3+uORF B2M_HA_L edits [540 T>G, 583 T>C, 589 C>A, 592 G>C, 595 G>A] + 5-nt EEF1A1_core 5'TOP edit [199..203 CTTTT->CAGAGA]) "
                                        "and the unshielded native-parts 3,300-bp constitutive donor (locus1_arm1c_constitutive_native_parts_3300bp_donor_sha256 = 259d1654ea35220b2de8ae9dc68bcda8e61436877a2850e828575a9374e3efa2) are materialized above so S3+uORF-shielded trapped Arm 1C-599_600_CC (ba78da72...) / Arm 1C-600_G (bb3e4159...) are compared against b1e17584... while unmodified native-HA trapped Arm 1C (ebbde623...) is compared against 259d1654... without uORF/S3/5'TOP confounding; "
                                        "promoter-trapped Arm 1C with 133-bp Chimeric_Intron + 389-bp minimal WPRE3 (wpre_mut6_589[:389]) is 600 + 133 + 9 + 1503 + 389 + 225 + 600 = 3,459 bp donor "
                                        "(3,749 bp packaged; AUDIT-REF, AUDIT-REF & L2A-01 [DEC-077])."
                                    ),
                                    "locus4_cd47_icasp9_donor_length_bp": len(dxs_locus4_4048),
                                    "locus4_cd47_icasp9_packaged_aav6_length_bp": len(dxs_locus4_4048) + 290,
                                    "locus4_cd47_icasp9_aav6_headroom_bp": 4700 - (len(dxs_locus4_4048) + 290),
                                    "locus4_icasp9_p2a_cd47_donor_sha256": sha256_str(dxs_locus4_4048),
                                    "locus4_icasp9_p2a_cd47_donor_sequence": dxs_locus4_4048,
                                    "locus4_icasp9_p2a_cd47_pam_shielded_donor_sha256": sha256_str(dxs_locus4_4048[:3461] + "C" + dxs_locus4_4048[3462:]),
                                    "locus4_icasp9_p2a_cd47_native_parts_unshielded_donor_sha256": sha256_str(
                                        aavs1_ha_l_600 + chs4_core_250 + cbx3_a2ucoe_455 + eef1a1_core_230 + kozak_9 + icasp9_dna[:-3] + gsg_p2a_dna + cd47_igv_gpi_dna + sv40_polya_122 + aavs1_ha_r_600
                                    ),
                                    "locus4_icasp9_p2a_cd47_native_parts_unshielded_donor_sequence": (
                                        aavs1_ha_l_600 + chs4_core_250 + cbx3_a2ucoe_455 + eef1a1_core_230 + kozak_9 + icasp9_dna[:-3] + gsg_p2a_dna + cd47_igv_gpi_dna + sv40_polya_122 + aavs1_ha_r_600
                                    ),
                                    "max_disjoint_inverted_repeat_stem_locus4_4048bp_bp": _max_disjoint_inverted_repeat_stem_bp(dxs_locus4_4048),
                                    "cistron_topology_order_requirement_muse_r1": (
                                        "Mandatory cistron order on Locus 4 is EEF1A1 -> iCasp9(nostop, 1,188 bp) - GSG-P2A(66 bp) - CD47-IgV-GPI(stop, 528 bp) -> SV40pA(122 bp) "
                                        "(exact part sum: 600 [AAVS1_HA_L] + 250 [cHS4] + 455 [CBX3-A2UCOE] + 230 [EEF1A1_core with 5'TOP-CAGAGA edit at 198..203 in dxs_locus4_4048 vs native CTTTTT in locus4_icasp9_p2a_cd47_native_parts_unshielded_donor_sequence] + 9 [Kozak] + 1188 [iCasp9 nostop] + 66 [GSG-P2A] + 528 [CD47-IgV-GPI stop] + 122 [SV40pA] + 600 [AAVS1_HA_R unshielded in locus4_icasp9_p2a_cd47_donor_sequence vs nt 14 G>C (donor nt 3462 G>C) PAM-shielded in dxs_locus4_4048bp_pam_shielded_donor_sequence] = 4,048 bp donor / 4,338 bp packaged; DEC-078): "
                                        "cytosolic iCasp9 must be placed 5' so it retains the C-terminal 21-aa -GSG-P2A stub at Ser416 of the p10 catalytic subunit "
                                        "in the cytosol (gated on Stage-0 cycloheximide t1/2 >= 6 h and Readout 6 10 nM AP1903 dimerization potency / clonogenic erasure parity "
                                        "against scar-free LOCUS4; AUDIT-REF & D3-07), whereas CD47-IgV-GPI must be placed 3' so its N-terminal Proline + M1..A18 signal peptide "
                                        "is cleaved by ER signal peptidase (verified by LC-MS for Ala18|Gln19 cleavage and PCA1 pyroglutamate cyclization; AUDIT-REF) "
                                        "and its 37-aa CD55 GPI attachment signal (P345..T381, omega-site Ser353) resides at the true extreme C-terminus for ER GPI-transamidase cleavage "
                                        "(AUDIT-REF & Q2-X2)."
                                    ),
                                    "architecture": (
                                        "Locus 1 Arm 1C: unidirectional B2M::HLA-E*01:03(VMAPRTLVL) SCT-only (3,300 bp constitutive EEF1A1+intron donor / "
                                        "3,459 bp promoter-trapped+WPRE3 donor); Locus 4 AAVS1: cHS4-A2UCOE-EEF1A1-iCasp9(nostop)-GSG-P2A-CD47-IgV-GPI(stop)-SV40pA "
                                        "(4,048 bp donor / 4,338 bp packaged, preserving K=4, B=0 genomic budget; AUDIT-REF & Q2-X2)"
                                    ),
                                    "scientific_rationale": (
                                        "Physically separates HLA-E SCT (at B2M Locus 1) from CD47-IgV-GPI (relocated into insulated AAVS1 Locus 4 as the 3' cistron "
                                        "downstream of iCasp9-GSG-P2A), completely eliminating B2M convergent sense/antisense transcription and boosting constitutive "
                                        "CD47 surface density margin from 1.07x to ~1.50x post-2A-skip (~301,000 molecules/cell = 0.88 x ~1.71x pre-skip prior of ~342,000 "
                                        "molecules/cell relative to the 200,000 molecules/cell target; AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
                                    ),
                                },
                                "B2M_AsCas12a_S3_4nt_synonymous_PAM_seed_shield_sonnet55_r1": {
                                    "donor_length_change_bp": 0,
                                    "assembled_arm1b_s3_3974bp_donor_sha256": sha256_str(arm1b_s3_3974),
                                    "combined_b2m_s3_plus_eef1a1_5top_donor_sequence": arm1b_s3_3974,
                                    "max_disjoint_inverted_repeat_stem_combined_3974bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm1b_s3_3974),
                                    "pure_b2m_s3_4nt_only_donor_3974bp_sha256": sha256_str(b2m_ha_l_s3_only_600 + arm_1b_seq[600:]),
                                    "pure_b2m_s3_4nt_only_donor_3974bp_sequence": b2m_ha_l_s3_only_600 + arm_1b_seq[600:],
                                    "max_disjoint_inverted_repeat_stem_pure_s3_3974bp_bp": _max_disjoint_inverted_repeat_stem_bp(b2m_ha_l_s3_only_600 + arm_1b_seq[600:]),
                                    "pure_eef1a1_5top_cagaga_only_donor_3974bp_sha256": sha256_str(arm_1b_seq[:1259] + revcomp(eef1a1_5top_cagaga_230) + arm_1b_seq[1489:]),
                                    "pure_eef1a1_5top_cagaga_only_donor_3974bp_sequence": arm_1b_seq[:1259] + revcomp(eef1a1_5top_cagaga_230) + arm_1b_seq[1489:],
                                    "max_disjoint_inverted_repeat_stem_pure_eef1top_3974bp_bp": _max_disjoint_inverted_repeat_stem_bp(arm_1b_seq[:1259] + revcomp(eef1a1_5top_cagaga_230) + arm_1b_seq[1489:]),
                                    "s3_mutated_b2m_ha_l_600bp_sha256": sha256_str(b2m_ha_l_s3_only_600),
                                    "s3_plus_uorf_agg_b2m_ha_l_600bp_sha256": sha256_str(b2m_ha_l_s3_uorf_600),
                                    "mutated_codons_in_b2m_exon1_leader": [
                                        "Leu15 CTT -> CTC (chr15:44711591T>C, B2M_HA_L_600bp nt 583; converts AsCas12a PAM 5'-TTTC-3' at 44711590..44711593 to non-PAM 5'-TCTC-3')",
                                        "Gly17 GGC -> GGA (chr15:44711597C>A, B2M_HA_L_600bp nt 589; protospacer seed position +4 mismatch)",
                                        "Leu18 CTG -> CTC (chr15:44711600G>C, B2M_HA_L_600bp nt 592; protospacer seed position +7 mismatch)",
                                        "Glu19 GAG -> GAA (chr15:44711603G>A, B2M_HA_L_600bp nt 595; protospacer seed position +10 mismatch)",
                                    ],
                                    "eef1a1_5prime_top_tract_optimization": "5'-CTTTTT-3' -> 5'-CAGAGA-3' at +1..+6 post-TSS (local 1-based positions 198..203 of EEF1A1_core_promoter_230bp; relieving mTORC1-sensitive 5'TOP translational repression under hypoxia)",
                                    "unconditional_3locus_recut_immunity_pam_shield_bundle_sonnet55_r2": {
                                        "deployment_status": "UNCONDITIONAL_PREVENTIVE_DONOR_DEFAULT_ACROSS_ALL_3_HDR_LOCI",
                                        "loci_shielded": [
                                            "Locus 1 B2M (OI-GRNA-01 AsCas12a): 4-nt synonymous S3 PAM+seed shield (chr15:44711591T>C, 44711597C>A, 44711600G>C, 44711603G>A) at B2M_HA_L_600bp nt 583, 589, 592, 595",
                                            "Locus 3 CXCL10 (OI-GRNA-03 SpCas9): 5'-UTR PAM G->C shield (chr4:76023451C>G on GRCh38 + strand; minus-strand PAM AGG->AGC) at CXCL10_HA_R_600bp_minus nt 17",
                                            "Locus 4 AAVS1 (OI-GRNA-04 SpCas9): Intron-1 PAM G->C shield (chr19:55115754C>G on GRCh38 + strand; minus-strand PAM AGG->AGC) at AAVS1_HA_R_600bp_minus nt 14",
                                        ],
                                        "materialized_shielded_homology_arms_and_donors_kimi31_r3": {
                                            "canonical_fasta_vs_shielded_synthesis_reconciliation_note_muse_r9": (
                                                "data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta is locked to the frozen unmodified GRCh38 homology-arm reference parts "
                                                "(REFERENCE_REGULATORY_PART_SHA256) for baseline construct provenance, whereas the recut-immune PAM/seed-shielded HDR synthesis donors "
                                                "across all 3 HDR loci (Arm 1A-S3 4,880 bp, Arm 1B-S3 3,974 bp, Locus 3-PAM-shielded 4,090 bp [nt 3507 G->C], and Locus 4-PAM-shielded 3,457 bp [nt 2871 G->C]) "
                                                "are materialized below (L2A-02 [DEC-077])."
                                            ),
                                            "arm1a_4880bp_s3_4nt_pam_shielded_donor_length_bp": len(arm_1a_seq[:200] + b2m_ha_l_s3_only_600 + arm_1a_seq[800:]),
                                            "arm1a_4880bp_s3_4nt_pam_shielded_donor_edits_1based": [783, 789, 792, 795],
                                            "arm1a_4880bp_s3_4nt_pam_shielded_donor_sha256": sha256_str(arm_1a_seq[:200] + b2m_ha_l_s3_only_600 + arm_1a_seq[800:]),
                                            "arm1a_4880bp_s3_4nt_pam_shielded_donor_sequence": arm_1a_seq[:200] + b2m_ha_l_s3_only_600 + arm_1a_seq[800:],
                                            "cxcl10_ha_r_600bp_minus_nt17_g_to_c_sha256": sha256_str(cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:]),
                                            "cxcl10_ha_r_600bp_minus_nt17_g_to_c_sequence": cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:],
                                            "locus3_4090bp_pam_shielded_donor_length_bp": len(locus_3_seq[:3506] + "C" + locus_3_seq[3507:]),
                                            "locus3_4090bp_pam_shielded_donor_edit_1based": 3507,
                                            "locus3_4090bp_pam_shielded_donor_sha256": sha256_str(locus_3_seq[:3506] + "C" + locus_3_seq[3507:]),
                                            "locus3_4090bp_pam_shielded_donor_sequence": locus_3_seq[:3506] + "C" + locus_3_seq[3507:],
                                            "dxl3_3799bp_spaced_pam_shielded_donor_edit_1based": 3216,
                                            "dxl3_3799bp_spaced_pam_shielded_donor_sha256": sha256_str(dxl3_spaced_3799[:3215] + "C" + dxl3_spaced_3799[3216:]),
                                            "dxl3_3799bp_spaced_pam_shielded_donor_sequence": dxl3_spaced_3799[:3215] + "C" + dxl3_spaced_3799[3216:],
                                            "aavs1_ha_r_600bp_minus_nt14_g_to_c_sha256": sha256_str(aavs1_ha_r_600[:13] + "C" + aavs1_ha_r_600[14:]),
                                            "aavs1_ha_r_600bp_minus_nt14_g_to_c_sequence": aavs1_ha_r_600[:13] + "C" + aavs1_ha_r_600[14:],
                                            "locus4_3457bp_pam_shielded_donor_length_bp": len(locus_4_seq[:2870] + "C" + locus_4_seq[2871:]),
                                            "locus4_3457bp_pam_shielded_donor_edit_1based": 2871,
                                            "locus4_3457bp_pam_shielded_donor_sha256": sha256_str(locus_4_seq[:2870] + "C" + locus_4_seq[2871:]),
                                            "locus4_3457bp_pam_shielded_donor_sequence": locus_4_seq[:2870] + "C" + locus_4_seq[2871:],
                                            "dxs_locus4_4048bp_pam_shielded_donor_edit_1based": 3462,
                                            "dxs_locus4_4048bp_pam_shielded_donor_sha256": sha256_str(dxs_locus4_4048[:3461] + "C" + dxs_locus4_4048[3462:]),
                                            "dxs_locus4_4048bp_pam_shielded_donor_sequence": dxs_locus4_4048[:3461] + "C" + dxs_locus4_4048[3462:],
                                            "dxs_locus4_4048bp_unshielded_5top_cagaga_donor_sha256": sha256_str(dxs_locus4_4048),
                                            "arm1c_3300bp_s3_uorf_5top_shielded_donor_sha256": sha256_str(arm1c_constitutive_3300),
                                            "arm1c_3300bp_native_parts_unshielded_donor_sha256": sha256_str(
                                                b2m_ha_l_600 + eef1a1_core_230 + chimeric_intron_133 + kozak_9 + hlae_sct_dna_stop + bgh_polya_225 + b2m_ha_r_600
                                            ),
                                        },
                                        "qc_verification_gate": "Verified by per-clone targeted amplicon NGS co-conversion of the PAM/seed shield alongside junction-spanning ddPCR in every picked MCB clone (decoupled from EEF1A1 5'TOP MFI promotion; S55R2-D2-02, D5-01 & AUDIT-REF).",
                                        "alphagenome_avi_live_verification_2026_10_27": {
                                            "provenance_and_evidence_class_muse_r2": {
                                                "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE",
                                                "legacy_evidence_class_alias": "SUPERSEDED_BY_NINE_SCOPED_ABX_SNVS_CROSS_CHECKED_AGAINST_LOCAL_3118_ARCHIVE",
                                                "private_receipt_present_and_verified": bool(
                                                    (REPO_ROOT / "data" / "raw" / "alphagenome_avi_live_receipt_2026_10_28.json").is_file()
                                                    or (REPO_ROOT / ".openislet_public_bundle").is_file()
                                                ),
                                                "alphagenome_python_package_version": "0.10.0",
                                                "cli_command": (
                                                    "uv run scripts/alphagenome_atlas_avi.py query chr15:44711591:T>C chr15:44711597:C>A chr15:44711600:G>C "
                                                    "chr15:44711603:G>A chr15:44711548:T>G chr15:44711608:T>G chr4:76023451:C>G chr19:55115754:C>G chr19:10352442:G>C --include_track_info --format json"
                                                ),
                                                "query_date_utc": "2026-10-28T08:54:44Z",
                                                "verification_summary": "verified against the private receipt",
                                                "note": (
                                                    "Verified against the offline private API audit receipt (alphagenome v0.10.0, 2026-10-28T08:54:44Z): "
                                                    "all 9 scoped Blueprint A/B/X single-letter edits and a 50-row random sample (seed=20261028) of the 3,118-row archive match the live AlphaGenome Atlas API output "
                                                    "to 6 decimal places on avi_phred, avi_raw, and avi_quantile (59/59 match), whereas the full 3,118-row window-scan archive has incomplete batch provenance (UNRESOLVED_ARCHIVAL_TABLE). "
                                                    "Numeric AVI scores are omitted from CC-BY-4.0 public files because AlphaGenome's output terms permit non-commercial research use only, "
                                                    "and no AVI score is used as an active ranking weight or certifies HDR insertion or absence of splicing risk."
                                                ),
                                            },
                                            "chr15:44711591:T>C_B2M_S3_Leu15_PAM": {"variant_id": "chr15:44711591:T>C", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "B2M S3 synonymous Leu15 CTT->CTC PAM shield"},
                                            "chr15:44711597:C>A_B2M_S3_Gly17_seed4": {"variant_id": "chr15:44711597:C>A", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "B2M S3 synonymous Gly17 GGC->GGA seed+4 shield"},
                                            "chr15:44711600:G>C_B2M_S3_Leu18_seed7": {"variant_id": "chr15:44711600:G>C", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "B2M S3 synonymous Leu18 CTG->CTC seed+7 shield", "note": "Synonymous Leu18 CTG->CTC; score driven by splicing/conservation at exon-1 boundary, zero missense impact"},
                                            "chr15:44711603:G>A_B2M_S3_Glu19_seed10": {"variant_id": "chr15:44711603:G>A", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "B2M S3 synonymous Glu19 GAG->GAA seed+10 shield"},
                                            "chr15:44711548:T>G_B2M_native_ATG_to_AGG_ablation": {"variant_id": "chr15:44711548:T>G", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "top_modality": "Start Lost", "role": "B2M native Exon 1 ATG->AGG uORF ablation"},
                                            "chr15:44711608:T>G_Arm1C_600T_to_G_U1_splice_rescue": {"variant_id": "chr15:44711608:T>G", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "top_modality": "AlphaMissense", "role": "Arm 1C 600T->G U1 5' splice-donor rescue", "note": "Located at the 3' terminal nucleotide of B2M_HA_L_600bp (non-coding 5'-UTR Exon 1 junction upstream of the Arm 1C splice donor after native ATG->AGG ablation; 'AlphaMissense' is the automated top_modality label in the AlphaGenome AVI receipt on the native B2M signal-peptide reading frame rather than a coding substitution in the engineered Arm 1C transcript)"},
                                            "chr4:76023451:C>G_CXCL10_5UTR_PAM_shield": {"variant_id": "chr4:76023451:C>G", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "CXCL10 5'-UTR PAM shield"},
                                            "chr19:55115754:C>G_AAVS1_intron1_PAM_shield": {"variant_id": "chr19:55115754:C>G", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "role": "AAVS1 Intron 1 PAM shield"},
                                            "chr19:10352442:G>C_TYK2_rs34536443_P1104A_challenger": {"variant_id": "chr19:10352442:G>C", "verification_status": "verified against the private receipt", "evidence_class": "LIVE_VERIFIED_BY_PRIVATE_API_RECEIPT_9_EDITS_PLUS_50_ROW_SAMPLE", "top_modality": "AlphaMissense", "role": "TYK2 rs34536443 P1104A catalytic hypomorph challenger"},
                                        },
                                    },
                                    "scientific_rationale": (
                                        "Eliminates the intact AsCas12a 5'-TTTC-3' PAM + 15-nt seed retained at the 3' end of B2M_HA_L_600bp "
                                        "post-HDR using 4 synonymous human signal-peptide codon changes (0-bp length change, 100% amino-acid identity; "
                                        "pure S3-only donor SHA-256 separated from the pure EEF1A1 5'TOP donor and combined S3+5'TOP donor for unconfounded single-variable Stage-0 attribution, "
                                        "and bundled with the CXCL10_HA_R_600bp_minus nt 17 [donor nt 3507/3216] and AAVS1_HA_R_600bp_minus nt 14 [donor nt 2871/3462] PAM shields as an unconditional 3-locus recut-immunity default; "
                                        "AUDIT-REF, Q1-P7, AUDIT-REF, AUDIT-REF, S55R2-D2-02 & AUDIT-REF)."
                                    ),
                                },
                                "Locus3_ScarFree_Dual_Promoter_SERPINB9_PDL1_challenger_astra_r1": {
                                    "donor_length_bp": len(dxl3_spaced_3799),
                                    "packaged_aav6_length_with_2x145bp_itrs_bp": len(dxl3_spaced_3799) + 290,
                                    "aav6_4700bp_headroom_bp": 4700 - (len(dxl3_spaced_3799) + 290),
                                    "assembled_3799bp_spaced_donor_sha256": sha256_str(dxl3_spaced_3799),
                                    "assembled_3799bp_spaced_donor_sequence": dxl3_spaced_3799,
                                    "inter_unit_pause_spacer_82bp_sequence": dxl3_pause_spacer_82bp,
                                    "inter_unit_pause_spacer_82bp_sha256": sha256_str(dxl3_pause_spacer_82bp),
                                    "canonical_unspaced_part_sum_donor_length_bp": len(dxl3_unspaced_3717),
                                    "canonical_unspaced_packaged_aav6_length_bp": len(dxl3_unspaced_3717) + 290,
                                    "canonical_unspaced_donor_sha256": sha256_str(dxl3_unspaced_3717),
                                    "canonical_unspaced_donor_sequence": dxl3_unspaced_3717,
                                    "max_disjoint_inverted_repeat_stem_unspaced_3717bp_bp": _max_disjoint_inverted_repeat_stem_bp(dxl3_unspaced_3717),
                                    "inter_unit_pause_spacer_length_bp": len(dxl3_pause_spacer_82bp),
                                    "max_disjoint_inverted_repeat_stem_3799bp_bp": _max_disjoint_inverted_repeat_stem_bp(dxl3_spaced_3799),
                                    "part_sum_reconciliation_note_muse_r1": (
                                        "Direct canonical part sum without inter-cistronic pause spacer is 600 (CXCL10_HA_L) + 9 (Kozak) + 1128 (SERPINB9_CDS) "
                                        "+ 3 (TGA stop) + 122 (SV40pA) + 148 (Syn_5xISRE_minP) + 9 (Kozak) + 873 (PDL1_full_stop_CDS) + 225 (bGHpA) + 600 (CXCL10_HA_R) "
                                        "= 3,717 bp donor (4,007 bp packaged, saving 373 bp vs 4,090-bp LOCUS3 after omitting 66-bp GSG-P2A and 589-bp WPREmut6); "
                                        "including the sequence-materialized 82-bp inter-transcription-unit pause spacer between SV40pA and Syn_5xISRE_minP yields "
                                        "3,717 + 82 = 3,799 bp donor (4,089 bp packaged, saving 291 bp vs 4,090-bp LOCUS3; AUDIT-REF & AUDIT-REF)."
                                    ),
                                    "architecture": (
                                        "600-bp CXCL10_HA_L + native SERPINB9 (376 aa, terminating at native Pro376-Stop with zero 21-aa GSG-P2A stub) "
                                        "+ 122-bp SV40pA + [0-bp unspaced (3,717 bp) or 82-bp pause spacer (3,799 bp)] + 148-bp Syn_5xISRE_minP + Kozak "
                                        "+ native signal-peptide PD-L1 (290 aa, starting at native Met1 without N-terminal Proline) + 225-bp bGHpA + 600-bp CXCL10_HA_R"
                                    ),
                                    "scientific_rationale": (
                                        "Eliminates both the 21-aa C-terminal -PG/-PGP C-degron candidate on SERPINB9 (Koren et al. 2018 PMID:29779948) "
                                        "and the N-terminal Proline adjacent to the PD-L1 signal-peptidase cleavage site, while saving 291 bp (with 82-bp spacer) "
                                        "or 373 bp (unspaced 3,717 bp) relative to the 4,090-bp GSG-P2A + 589-bp WPREmut6 donor (AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
                                    ),
                                },
                                "Locus3_BasalFloor_ScarFree_SERPINB9_PDL1_challenger_muse_r3": (
                                    lambda basalfloor_230, cxcl10_r_shielded, l3_bfb_seq, l3_bfc_ortho_seq, l3_bfc_bicistronic_3915_seq, l3_syn5xisre_matched_3996_seq: {
                                        "product_variant_id": "ISLET1_A4_L3_BFB_BASALFLOOR",
                                        "l3_bfb_donor_length_bp": len(l3_bfb_seq),
                                        "l3_bfb_packaged_aav6_length_with_2x145bp_itrs_bp": len(l3_bfb_seq) + 290,
                                        "l3_bfb_aav6_4700bp_headroom_bp": 4700 - (len(l3_bfb_seq) + 290),
                                        "l3_bfb_assembled_4078bp_pam_shielded_donor_sha256": sha256_str(l3_bfb_seq),
                                        "l3_bfb_assembled_4078bp_pam_shielded_donor_sequence": l3_bfb_seq,
                                        "l3_bfb_hybrid_230bp_basalfloor_isre_nfkb_hpgk1_promoter_sequence": basalfloor_230,
                                        "l3_bfb_hybrid_230bp_basalfloor_isre_nfkb_hpgk1_promoter_sha256": sha256_str(basalfloor_230),
                                        "l3_bfb_5top_oligopyrimidine_tract_present": ("CTTTTT" in basalfloor_230),
                                        "l3_syn5xisre_matched_2afree_comparator_3996bp_donor_length_bp": len(l3_syn5xisre_matched_3996_seq),
                                        "l3_syn5xisre_matched_2afree_comparator_3996bp_packaged_aav6_length_bp": len(l3_syn5xisre_matched_3996_seq) + 290,
                                        "l3_syn5xisre_matched_2afree_comparator_3996bp_donor_sha256": sha256_str(l3_syn5xisre_matched_3996_seq),
                                        "l3_syn5xisre_matched_2afree_comparator_3996bp_donor_sequence": l3_syn5xisre_matched_3996_seq,
                                        "l3_bfc_dual_basal_floor_donor_length_bp": len(l3_bfc_ortho_seq),
                                        "l3_bfc_dual_basal_floor_packaged_aav6_length_bp": len(l3_bfc_ortho_seq) + 290,
                                        "l3_bfc_dual_basal_floor_aav6_headroom_bp": 4700 - (len(l3_bfc_ortho_seq) + 290),
                                        "l3_bfc_assembled_4160bp_pam_shielded_donor_sha256": sha256_str(l3_bfc_ortho_seq),
                                        "l3_bfc_assembled_4160bp_pam_shielded_donor_sequence": l3_bfc_ortho_seq,
                                        "l3_bfc_single_promoter_bicistronic_3915bp_donor_length_bp": len(l3_bfc_bicistronic_3915_seq),
                                        "l3_bfc_single_promoter_bicistronic_3915bp_packaged_aav6_length_bp": len(l3_bfc_bicistronic_3915_seq) + 290,
                                        "l3_bfc_single_promoter_bicistronic_3915bp_donor_sha256": sha256_str(l3_bfc_bicistronic_3915_seq),
                                        "l3_bfc_single_promoter_bicistronic_3915bp_donor_sequence": l3_bfc_bicistronic_3915_seq,
                                        "ssa_direct_repeat_elimination_audit_argon_r4": {
                                            "l3_bfb_unit1_vs_unit2_promoter_identity": "Orthogonal 230-bp Syn_3xISRE_2xNFkB_hPGK1_Sp1_basalfloor (Unit 1, zero 5'TOP, 5'-CAGAGA-3' TSS) vs 148-bp Syn_5xISRE_minP (Unit 2); preserves both 0.30 uM Hour-0 Sp1 basal floor and 0.89 uM 24-h IFN-gamma/TNF-alpha inducible surge",
                                            "l3_bfc_4160bp_promoter_orthogonality": "Unit 1 driven by 230-bp Syn_3xISRE_2xNFkB_hPGK1_Sp1_basalfloor and Unit 2 driven by 230-bp EEF1A1_5top_cagaga_230 (eliminating the 242-bp tandem direct repeat that risked SSA loop-out deletion of SERPINB9; AUDIT-REF)",
                                            "l3_bfc_3915bp_single_promoter_bicistron": "600 (CXCL10_HA_L) + 49 (SPA) + 230 (EEF1A1_5top_cagaga_230) + 9 (Kozak) + 1128 (SERPINB9_nostop) + 66 (GSG-P2A) + 873 (PDL1_stop) + 135 (WPREmut6_5prime_core_135bp = wpre_mut6_589[:135]) + 225 (bGHpA) + 600 (CXCL10_HA_R) = 3,915 bp single-promoter bicistron with zero tandem promoter repeats (retains 21-aa C-terminal GSG-P2A tail on SERPINB9; included only as an SSA-repeat-free bicistronic control, whereas L3-BF-B 4,078 bp and L3-BF-C 4,160 bp provide scar-free SERPINB9)",
                                            "l3_bfc_3915bp_retains_21aa_gsg_p2a_tail": True,
                                            "exact_50mer_window_repeat_audit_kimi31_r4": {
                                                "l3_bfb_4078bp_duplicated_50mer_windows": sum(1 for c in Counter(l3_bfb_seq[i:i + 50] for i in range(len(l3_bfb_seq) - 49)).values() if c > 1),
                                                "l3_bfc_4160bp_duplicated_50mer_windows": sum(1 for c in Counter(l3_bfc_ortho_seq[i:i + 50] for i in range(len(l3_bfc_ortho_seq) - 49)).values() if c > 1),
                                                "l3_bfc_3915bp_bicistronic_duplicated_50mer_windows": sum(1 for c in Counter(l3_bfc_bicistronic_3915_seq[i:i + 50] for i in range(len(l3_bfc_bicistronic_3915_seq) - 49)).values() if c > 1),
                                                "l3_syn5xisre_matched_3996bp_duplicated_50mer_windows": sum(1 for c in Counter(l3_syn5xisre_matched_3996_seq[i:i + 50] for i in range(len(l3_syn5xisre_matched_3996_seq) - 49)).values() if c > 1),
                                                "l3_scarfree_3799bp_orthogonal_inducible_comparator_duplicated_50mer_windows": sum(1 for c in Counter(dxl3_spaced_3799[i:i + 50] for i in range(len(dxl3_spaced_3799) - 49)).values() if c > 1),
                                                "tandem_242bp_inter_unit_promoter_duplications_in_l3_bfb_and_l3_bfc": 0,
                                                "tandem_160bp_syn5xisre_kozak_atg_inter_unit_repeat_in_3996bp_matched_comparator_bp": 160,
                                                "repeat_provenance_note": (
                                                    "In L3-BF-B (4,078 bp), L3-BF-C (4,160 bp), and the canonical 3,799-bp scar-free comparator (ISLET1_A4_L3_SCARFREE_3799, where Unit 1 uses the endogenous CXCL10 promoter and Unit 2 uses Syn_5xISRE_minP), "
                                                    "the 8, 4, and 4 duplicated 50-mer windows arise strictly from the local multimerized 3xISRE_2xNFkB / 5xISRE enhancer tandem arrays (<=68 bp local motif array) with zero inter-unit promoter duplication, "
                                                    "and the 3,915-bp EEF1A1 bicistronic control has 0 duplicated 50-mer windows. By contrast, the 3,996-bp synthetic dual-Syn_5xISRE_minP comparator repeats the 160-bp Syn_5xISRE_minP + Kozak + ATG block across both units (108 duplicated 50-mer windows), "
                                                    "so Stage-0 runs both the 3,996-bp synthetic promoter-swap control (with junctional long-read PCR/ddPCR copy-number verification against SSA loop-out) and the repeat-free 3,799-bp CXCL10p::SERPINB9 + Syn_5xISRE_minP::PD-L1 inducible control (AUDIT-REF & AUDIT-REF)."
                                                ),
                                            },
                                        },
                                        "part_breakdown_l3_bfb_4078bp": (
                                            "600 (CXCL10_HA_L) + 49 (SPA_upstream_terminator) + 230 (Syn_3xISRE_2xNFkB_hPGK1_Sp1_basalfloor_230_non5TOP_CAGAGA) + 9 (Kozak) "
                                            "+ 1131 (SERPINB9_scarfree_stop) + 122 (SV40pA) + 82 (inter_unit_pause_spacer) + 148 (Syn_5xISRE_minP) + 9 (Kozak) "
                                            "+ 873 (PDL1_full_stop) + 225 (bGHpA) + 600 (CXCL10_HA_R_nt17_PAM_shielded) = 4,078 bp donor (4,368 bp packaged, +332 bp AAV6 headroom)"
                                        ),
                                        "hour0_kinetic_race_and_stoichiometric_bolus_model_muse_r3": {
                                            "perforin_gzmb_delivery_seconds_lopez_2013_pmid_23377437": [20, 80],
                                            "caspase3_bid_commitment_minutes": [5, 15],
                                            "serpinb9_protein_half_life_hours": 6.0,
                                            "serpinb9_fraction_of_steady_state_at_2h_4h_6h": {"2h": 0.11, "4h": 0.29, "6h": 0.45},
                                            "suicide_inhibitor_stoichiometry_si_sun_1996_pmid_8910377": {
                                                "wt_si": 1.0,
                                                "c_terminal_stub_degraded_si_bound": 1.5,
                                            },
                                            "endogenous_6p25_serpinb9_basal_uM": 0.08,
                                            "locus3_1_to_2pct_basal_leak_serpinb9_uM": [0.0089, 0.0178],
                                            "total_hour0_serpinb9_canonical_locus3_uM": [0.089, 0.098],
                                            "single_hit_gzmb_bolus_uM": [0.10, 0.30],
                                            "canonical_locus3_hour0_bolus_coverage_at_0p20uM_si_1p5": 0.30,
                                            "l3_bfb_basal_floor_target_serpinb9_uM": 0.30,
                                            "l3_bfb_24h_ifng_licensed_target_serpinb9_uM": 0.89,
                                            "stage0_gate_0c_kinetic_pass_criteria": (
                                                "Hour-0 unstimulated [SERPINB9]_0 >= 0.30 uM AND 4-h unstimulated CTL/NK Annexin-V+ <= 15% "
                                                "AND 24-h IFN-gamma-licensed [SERPINB9]_24 >= 0.80 uM AND Stage-7 yield >= 0.90x WT (AUDIT-REF & Gate 0C-kinetic)"
                                            ),
                                            "serpinb9_suicide_substrate_serial_pulse_ode_and_perk_eif2a_isr_audit_sol61_r4": (
                                                lambda _pulse_traj, _pulse_traj_n: {
                                                    "governing_depletion_ode": "dS/dt = p(O2, cytokines) * f_ISR(pO2, ER_stress) - k_deg * S - SI * sum_k delta(t - t_k) * Delta_GzmB",
                                                    "analytic_inter_pulse_recurrence": "S_pre(n+1) = S_eq + (S_post(n) - S_eq) * exp(-k_deg * Delta_t); S_post(n+1) = max(0, S_pre(n+1) - SI * Delta_GzmB), where S_eq = f_ISR * S_0 and exp(-k_deg * 2h) = 2^(-1/3) = 0.793701",
                                                    "primary_citations": ["PMID:8910377", "PMID:23377437", "PMID:16467844", "PMID:18052927", "PMID:21857942", "PMID:15494398", "PMID:26670609"],
                                                    "k_deg_h_inv_at_t12_6h": round(math.log(2.0) / 6.0, 6),
                                                    "unstimulated_basal_replenishment_p0_uM_per_h_at_S0_0p30uM": round(0.30 * math.log(2.0) / 6.0, 6),
                                                    "ifng_licensed_replenishment_p24_uM_per_h_at_S_0p89uM": round(0.89 * math.log(2.0) / 6.0, 6),
                                                    "perk_eif2a_hypoxic_er_stress_translation_multiplier_f_isr": {
                                                        "normoxic_pO2_gt_15mmHg": 1.00,
                                                        "moderate_hypoxia_pO2_8_to_12mmHg_plus_cytokines": 0.45,
                                                        "severe_hypoxia_pO2_lt_5mmHg_plus_er_stress": 0.25,
                                                        "mechanism": (
                                                            "5'TOP deletion (5'-CAGAGA-3') prevents mTORC1/LARP1 selective repression of ribosomal/EEF1A1 5'TOP mRNAs, "
                                                            "but PERK-mediated eIF2-alpha Ser51 phosphorylation under combined hypoxia + inflammatory ER stress depletes global ternary complex "
                                                            "(eIF2-GTP-Met-tRNAi^Met) across all cap-dependent non-uORF transcripts (Koritzinsky et al. 2006 PMID:16467844; Gomez et al. 2008 PMID:18052927)."
                                                        ),
                                                    },
                                                    "serial_granzyme_b_pulse_trajectories_delta_gzmb_0p15uM_every_2h": {
                                                        "scarfree_L3_BF_B_SI_1p0_normoxic_S0_0p30uM_post_pulse_1_2_3_uM": _pulse_traj(0.30, 1.00, 1.0, 4),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_normoxic_post_pulse_1_2_3_uM": _pulse_traj(0.89, 1.00, 1.0, 4),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_post_pulse_1_2_3_uM": _pulse_traj(0.89, 0.45, 1.0, 4),
                                                        "scarred_P2A_SI_1p5_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_post_pulse_1_2_3_uM": _pulse_traj(0.89, 0.45, 1.5, 4),
                                                    },
                                                    "serial_granzyme_b_pulse_trajectories_exact_6dec_uM": {
                                                        "scarfree_L3_BF_B_SI_1p0_normoxic_S0_0p30uM_post_pulse_1_2_3_uM": _pulse_traj(0.30, 1.00, 1.0, 6),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_normoxic_post_pulse_1_2_3_uM": _pulse_traj(0.89, 1.00, 1.0, 6),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_post_pulse_1_2_3_uM": _pulse_traj(0.89, 0.45, 1.0, 6),
                                                        "scarred_P2A_SI_1p5_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_post_pulse_1_2_3_uM": _pulse_traj(0.89, 0.45, 1.5, 6),
                                                    },
                                                    "sustained_12_pulse_22h_depletion_and_stationary_reserve_audit_astra6_r4": {
                                                        "scarfree_L3_BF_B_SI_1p0_normoxic_S0_0p30uM_12pulses_22h": _pulse_traj_n(0.30, 1.00, 1.0, 12, 6),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_normoxic_12pulses_22h": _pulse_traj_n(0.89, 1.00, 1.0, 12, 6),
                                                        "scarfree_L3_BF_B_SI_1p0_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_12pulses_22h": _pulse_traj_n(0.89, 0.45, 1.0, 12, 6),
                                                        "scarred_P2A_SI_1p5_ifng_licensed_S0_0p89uM_hypoxic_fISR_0p45_12pulses_22h": _pulse_traj_n(0.89, 0.45, 1.5, 12, 6),
                                                        "stationary_post_pulse_reserve_formula": "S_post_star = f_ISR * S_0 - (SI * Delta_GzmB) / (1 - 2^(-1/3)); positive stationary reserve under infinite 2-h serial hits requires S_0 > (SI * 0.15) / (f_ISR * (1 - 2^(-1/3)))",
                                                        "minimum_S0_uM_for_positive_stationary_reserve": {
                                                            "normoxic_fISR_1p00_SI_1p0": round(0.15 / (1.0 - 2.0 ** (-1.0 / 3.0)), 6),
                                                            "hypoxic_fISR_0p45_SI_1p0": round(0.15 / (0.45 * (1.0 - 2.0 ** (-1.0 / 3.0))), 6),
                                                            "hypoxic_fISR_0p45_SI_1p5_P2A_scarred": round((1.5 * 0.15) / (0.45 * (1.0 - 2.0 ** (-1.0 / 3.0))), 6),
                                                        },
                                                        "stationary_post_pulse_reserve_uM_at_S0_0p89_normoxic_SI_1p0": round(0.89 - 0.15 / (1.0 - 2.0 ** (-1.0 / 3.0)), 6),
                                                        "minimum_S0_uM_for_12_pulse_22h_finite_window_survival_sonnet55_r4": (
                                                            lambda _bisect_s0: {
                                                                "computation_mode": "LIVE_BISECTION_DERIVED_6DEC_EXACT",
                                                                "from_pre_accumulated_S0_start": {
                                                                    "normoxic_fISR_1p00_SI_1p0": _bisect_s0(1.00, 1.0, False),
                                                                    "hypoxic_fISR_0p45_SI_1p0": _bisect_s0(0.45, 1.0, False),
                                                                    "hypoxic_fISR_0p45_SI_1p5_P2A_scarred": _bisect_s0(0.45, 1.5, False),
                                                                },
                                                                "from_hypoxia_equilibrated_fISR_times_S0_start": {
                                                                    "normoxic_fISR_1p00_SI_1p0": _bisect_s0(1.00, 1.0, True),
                                                                    "hypoxic_fISR_0p45_SI_1p0": _bisect_s0(0.45, 1.0, True),
                                                                    "hypoxic_fISR_0p45_SI_1p5_P2A_scarred": _bisect_s0(0.45, 1.5, True),
                                                                },
                                                            }
                                                        )(
                                                            lambda f_isr_b, si_b, eq_start_b: (
                                                                lambda r_b, req_b: (
                                                                    lambda step_b: round(step_b(step_b, 0.0, 5.0, 60), 6)
                                                                )(
                                                                    lambda self_b, lo_b, hi_b, it_b: (
                                                                        0.5 * (lo_b + hi_b)
                                                                        if it_b == 0
                                                                        else (
                                                                            lambda mid_b: (
                                                                                lambda s_init_b, s_eq_b: (
                                                                                    lambda sim_b: (
                                                                                        self_b(self_b, lo_b, mid_b, it_b - 1)
                                                                                        if sim_b(sim_b, 1, s_init_b, s_eq_b)
                                                                                        else self_b(self_b, mid_b, hi_b, it_b - 1)
                                                                                    )
                                                                                )(
                                                                                    lambda sim_fn, idx_b, s_pre_b, seq_val: (
                                                                                        True
                                                                                        if idx_b > 12
                                                                                        else (
                                                                                            False
                                                                                            if s_pre_b < req_b
                                                                                            else sim_fn(
                                                                                                sim_fn,
                                                                                                idx_b + 1,
                                                                                                seq_val + (s_pre_b - req_b - seq_val) * r_b,
                                                                                                seq_val,
                                                                                            )
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )(mid_b * f_isr_b if eq_start_b else mid_b, mid_b * f_isr_b)
                                                                        )(0.5 * (lo_b + hi_b))
                                                                    )
                                                                )
                                                            )(2.0 ** (-1.0 / 3.0), si_b * 0.15)
                                                        ),
                                                        "first_pulse_with_unneutralized_gzmb_bolus": {
                                                            "basal_S0_0p30_fISR_1p0_SI_1p0": {"pulse_index": 3, "time_h": 4.0, "pre_pulse_serpinb9_uM": 0.086451, "unneutralized_gzmb_uM": 0.063549},
                                                            "licensed_S0_0p89_fISR_0p45_SI_1p0": {"pulse_index": 7, "time_h": 12.0, "pre_pulse_serpinb9_uM": 0.090051, "unneutralized_gzmb_uM": 0.059949},
                                                            "scarred_P2A_S0_0p89_fISR_0p45_SI_1p5": {"pulse_index": 4, "time_h": 6.0, "pre_pulse_serpinb9_uM": 0.212426, "unneutralized_gzmb_uM": 0.008382},
                                                        },
                                                        "first_pulse_with_unneutralized_gzmb_bolus_from_hypoxia_equilibrated_start_fISR_times_S0_sonnet55_r4": {
                                                            "licensed_S_start_0p4005_fISR_0p45_SI_1p0": {"pulse_index": 4, "time_h": 6.0, "pre_pulse_serpinb9_uM": 0.111951, "unneutralized_gzmb_uM": 0.038049},
                                                            "scarred_P2A_S_start_0p4005_fISR_0p45_SI_1p5": {"pulse_index": 2, "time_h": 2.0, "pre_pulse_serpinb9_uM": 0.221917, "unneutralized_gzmb_uM": 0.002055},
                                                        },
                                                    },
                                                    "second_order_gzmb_capture_kinetics_and_non_gzmb_granzyme_bypass_kimi31_r4": {
                                                        "k_on_serpinb9_gzmb_M_inv_s_inv_pmid_8910377": 1.7e6,
                                                        "pseudo_first_order_capture_tau_seconds_at_0p30uM": round(1.0 / (1.7e6 * 0.30e-6), 2),
                                                        "pseudo_first_order_capture_tau_seconds_at_0p15uM_post_pulse1": round(1.0 / (1.7e6 * 0.15e-6), 2),
                                                        "pseudo_first_order_capture_tau_seconds_at_0p0309uM_post_pulse2": round(1.0 / (1.7e6 * _pulse_traj(0.30, 1.00, 1.0, 6)[1] * 1e-6), 2),
                                                        "gzmm_mediated_serpinb9_cleavage_inactivation_pmid_15494398": (
                                                            "NK-enriched Granzyme M (GzmM, Met-ase/Leu-ase) not only cleaves nucleophosmin and alpha-tubulin independently of SERPINB9, "
                                                            "but directly cleaves the SERPINB9 (PI-9) reactive-center loop as a non-inhibitory substrate to generate an inactive ~40-kDa cleaved serpin species, "
                                                            "accelerating depletion of functional cytosolic SERPINB9 during NK degranulation (Mahrus et al. 2004 J Biol Chem PMID:15494398; AUDIT-REF & L2-B)."
                                                        ),
                                                        "serpinb9_rcl_vicinal_cys341_cys342_redox_inactivation_and_c341s_c342s_challenger_astra6_r4": {
                                                            "rcl_sequence_337_to_345": "VVAECCMES",
                                                            "p1_p1prime_cleavage_bond": "Glu340-Cys341",
                                                            "vicinal_cysteine_dyad": "Cys341-Cys342",
                                                            "primary_citation": "Mangan et al. 2016 J Biol Chem PMID:26670609",
                                                            "oxidative_inactivation_mechanism": (
                                                                "SERPINB9 contains a vicinal Cys341-Cys342 dyad at P1'-P2' of its reactive-center loop (337-VVAECCMES-345) immediately C-terminal "
                                                                "to the P1=Glu340 cleavage residue. Under inflammatory ROS/H2O2, Cys341-Cys342 forms a reversible vicinal disulfide bond that "
                                                                "constrains RCL conformation and abolishes Granzyme B inhibition (Mangan et al. 2016 PMID:26670609). Layer 4 interstitial catalase "
                                                                "(keeping [H2O2]_max <= 10 uM) and TXNIP-/- thioredoxin preservation mitigate cytosolic oxidation, and the redox-resistant "
                                                                "SERPINB9(C341S/C342S) RCL variant is pre-registered as a Stage-0 Gate 0C-kinetic oxidative-stress challenger (AUDIT-REF & L2-B)."
                                                            ),
                                                        },
                                                        "non_gzmb_granzyme_and_death_ligand_scope_note": (
                                                            "SERPINB9 (PI-9) is a specific suicide inhibitor of Granzyme B (reactive-center P1=Glu340) and does not inhibit tryptase/chymase-like "
                                                            "Granzyme A, Granzyme K, or Granzyme M (which is inhibited by SERPINB4 and cleaves SERPINB9; Mahrus et al. 2004 PMID:15494398; de Koning et al. 2011 PMID:21857942) or extrinsic "
                                                            "FasL/TRAIL -> Caspase-8 signaling; upstream NK/CTL degranulation suppression therefore relies on Arm 1B/1X/B'-SCT inhibitory receptor engagement "
                                                            "(CD94/NKG2A, KIR2DL1/2/3, SIRPa, PD-L1) and peri-graft SA-FasL/SA-THBD microgels, while Gate 0C-kinetic measures net primary NK/CTL Annexin-V+/Caspase-3/7 "
                                                            "apoptosis in the presence and absence of selective GzmB inhibitor Compound 20 / Z-AAD-CMK to partition GzmB vs GzmA/M/FasL residual death."
                                                        ),
                                                    },
                                                    "stage0_serial_hit_gate_0c_extension": (
                                                        "Gate 0C-kinetic includes both a 3-pulse acute serial NK/CTL degranulation screen (every 2 h at E:T = 2:1 under pO2 = 10 mmHg + 100 U/mL IFN-gamma + 10 ng/mL TNF-alpha, post-pulse-3 Annexin-V+ <= 20%) "
                                                        "and a full 12-pulse (24-h, q2h at E:T = 5:1) hypoxic combined-stress confirmation arm verifying that upstream synaptic degranulation suppression (p_degran <= 0.15 via HLA-E/HLA-C SCT/PD-L1) + L3-BF-B scar-free SI ~ 1.0 prevent cumulative SERPINB9 exhaustion (<= 8% specific lysis; AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                                                    ),
                                                    "twelve_pulse_hypoxic_coupon_reconciliation_and_synaptic_suppression_gate_sol61_r5": {
                                                        "finding_id": "AUDIT-REF",
                                                        "decision_id": "DEC-044",
                                                        "unattenuated_0p15uM_gzmb_per_pulse_depletion_envelope": {
                                                            "preloaded_0p89uM_start_under_f_isr_0p45_12_pulse_post_serpinb9_uM": _pulse_traj_n(0.89, 0.45, 1.0, 12, 6)["post_pulse_serpinb9_uM"],
                                                            "preloaded_0p89uM_start_under_f_isr_0p45_12_pulse_unneutralized_gzmb_uM": _pulse_traj_n(0.89, 0.45, 1.0, 12, 6)["unneutralized_gzmb_bolus_uM"],
                                                            "preloaded_0p89uM_first_exhaustion_pulse": 7,
                                                            "hypoxia_equilibrated_0p4005uM_start_under_f_isr_0p45_12_pulse_post_serpinb9_uM": _pulse_traj_n(0.89 * 0.45, 1.0, 1.0, 12, 6)["post_pulse_serpinb9_uM"],
                                                            "hypoxia_equilibrated_0p4005uM_start_under_f_isr_0p45_12_pulse_unneutralized_gzmb_uM": _pulse_traj_n(0.89 * 0.45, 1.0, 1.0, 12, 6)["unneutralized_gzmb_bolus_uM"],
                                                            "hypoxia_equilibrated_0p4005uM_first_exhaustion_pulse": 4,
                                                            "basal_0p30uM_under_f_isr_0p45_first_exhaustion_pulse": 2,
                                                            "basal_0p30uM_normoxic_f_isr_1p00_first_exhaustion_pulse": 3,
                                                        },
                                                        "max_sustainable_steady_state_gzmb_flux_per_2h_pulse_under_f_isr_0p45_uM": round(0.89 * 0.45 * (1.0 - math.exp(-(math.log(2.0) / 6.0) * 2.0)), 4),
                                                        "required_upstream_synaptic_degranulation_probability_cap_p_degran_max": 0.15,
                                                        "effective_gzmb_injected_per_contact_at_p_degran_0p15_uM": 0.0225,
                                                        "stochastic_12_pulse_bernoulli_breakthrough_audit_kimi31_r5": {
                                                            "enumerated_binary_contact_trajectories_2_pow_12": 4096,
                                                            "per_contact_breakthrough_probability_p_degran": 0.15,
                                                            "per_breakthrough_cytosolic_gzmb_bolus_uM": 0.15,
                                                            "preloaded_0p89uM_start_prob_at_least_1_breakthrough_over_12_pulses": 0.002341,
                                                            "hypoxia_equilibrated_0p4005uM_start_prob_at_least_1_breakthrough_over_12_pulses": 0.015756,
                                                            "basal_0p30uM_start_immediate_licensed_hypoxic_replenishment_0p4005uM_prob_breakthrough": 0.026922,
                                                            "basal_0p30uM_start_normoxic_replenishment_0p30uM_prob_breakthrough": 0.120153,
                                                            "basal_0p30uM_start_unprimed_hypoxic_replenishment_0p135uM_prob_breakthrough": 0.581642,
                                                            "basal_0p30uM_start_unprimed_hypoxic_full_hit_first_exhaustion_pulse": 2,
                                                            "correlated_persistent_targeting_15pct_cells_hit_every_pulse_breakthrough_prob": 0.15,
                                                            "licensed_hypoxic_regimes_clear_8pct_specific_lysis_ceiling": True,
                                                            "unprimed_hypoxic_or_correlated_targeting_exceeds_8pct_ceiling": True,
                                                            "reconciliation_note_astra6_r5": (
                                                                "Retracts the unverified 0.036957 literal for s0 = 0.30 uM and replaces it with exact 2^12 = 4,096-trajectory enumeration across all three physical replenishment regimes (AUDIT-REF [DEC-046] & AUDIT-REF [DEC-059]): "
                                                                "(1) if contact at Hour 0 triggers immediate IFN-gamma/NF-kB licensing toward the hypoxic induced target s_inf = 0.89 * 0.45 = 0.4005 uM, breakthrough probability is 0.026922 [0.026922123343 exact] (2.69%); "
                                                                "(2) if maintained at normoxic basal target s_inf = 0.30 uM (f_ISR = 1.0), breakthrough probability is 0.120153 (12.02%, > 8%); "
                                                                "(3) if maintained under unprimed hypoxic ISR attenuation s_inf = 0.30 * 0.45 = 0.135 uM (without cytokine licensing), deterministic full-hit challenge exhausts at Pulse 2 (post-Pulse-1 0.15 uM -> pre-Pulse-2 0.1469 uM < 0.15 uM) and i.i.d. Bernoulli(0.15) breakthrough is 0.581642 (58.16%, > 8%); "
                                                                "and (4) if synaptic hits are spatially correlated across the 12 pulses (e.g. 15% border cells hit every pulse while 85% interior cells are never hit, giving the same marginal p = 0.15), population breakthrough is 15.0% even from 0.89 uM. "
                                                                "Therefore Gate 0C-kinetic explicitly tests both an unprimed Hour-0 hypoxic 12-pulse arm (obs_12pulse_unprimed_hypoxic_serial_lysis_pct <= 8.0%) and a 24-h cytokine-licensed 12-pulse arm."
                                                            ),
                                                        },
                                                        "reconciliation_rule": (
                                                            "Explicitly reconciles the 6-pulse vs 12-pulse serial GzmB ODE envelopes under hypoxic ISR translation attenuation (f_ISR = 0.45 at pO2 = 8-12 mmHg, k_d = ln(2)/6 h^-1, SI = 1.0): "
                                                            "if every 2-h NK/CTL contact injected a full unattenuated 0.15 uM cytosolic GzmB bolus, intracellular L3-BF-B SERPINB9 alone would provide a 6-pulse autonomous intracellular buffer "
                                                            "from a pre-loaded 0.89 uM IFN-gamma state before exhausting at Pulse 7 (0.0599 uM unneutralized GzmB; and at Pulse 4 from a hypoxia-equilibrated 0.4005 uM start [0.038049 uM unneutralized; pre-pulse 0.111951 uM] or Pulse 2 from the 0.30 uM Hour-0 basal floor under unprimed f_ISR = 0.45 [0.003094 uM unneutralized; vs Pulse 3 under normoxic f_ISR = 1.0 with 0.063549 uM unneutralized]), "
                                                            "because steady-state 2-h resynthesis under f_ISR = 0.45 replaces at most 0.4005 * (1 - exp(-2*ln(2)/6)) = 0.0826 uM per 2-h interval (< 0.15 uM). "
                                                            "Therefore, surviving the 24-h / 12-pulse combined-stress coupon (<= 8% specific lysis) is NOT achieved by cytosolic SERPINB9 stoichiometry in isolation, "
                                                            "but requires upstream synaptic degranulation suppression (p_degran <= 0.15 per contact via Arm 1B/1X HLA-E -> CD94/NKG2A or B'-SCT HLA-C -> KIR2DL plus Locus-3 PD-L1 -> PD-1 and peri-graft SA-FasL, "
                                                            "keeping average effective GzmB delivery at 0.15 * 0.15 = 0.0225 uM per 2-h contact wave [<= 0.0826 uM steady-state 2-h resynthesis ceiling] and restricting discrete Bernoulli breakthrough probability across 2^12 = 4,096 trajectories to 0.234% [preloaded 0.89 uM] to 1.576% [hypoxia-equilibrated 0.4005 uM]; AUDIT-REF & AUDIT-REF [DEC-044/045])."
                                                        ),
                                                    },
                                                }
                                            )(
                                                lambda s0, f_isr, si, ndig: (
                                                    lambda k_d, dt_h, d_gzmb: (
                                                        lambda p1: (
                                                            lambda p2: (
                                                                lambda p3: [round(p1, ndig), round(p2, ndig), round(p3, ndig)]
                                                            )(max(0.0, s0 * f_isr + (p2 - s0 * f_isr) * math.exp(-k_d * dt_h) - si * d_gzmb))
                                                        )(max(0.0, s0 * f_isr + (p1 - s0 * f_isr) * math.exp(-k_d * dt_h) - si * d_gzmb))
                                                    )(max(0.0, s0 - si * d_gzmb))
                                                )(math.log(2.0) / 6.0, 2.0, 0.15),
                                                lambda s0, f_isr, si, n_pulses, ndig: (
                                                    lambda k_d, dt_h, d_gzmb: (
                                                        lambda step_fn: step_fn(step_fn, 1, s0, [], [])
                                                    )(
                                                        lambda self_fn, idx, s_pre, post_acc, unneut_acc: (
                                                            {
                                                                "post_pulse_serpinb9_uM": post_acc,
                                                                "unneutralized_gzmb_bolus_uM": unneut_acc,
                                                            }
                                                            if idx > n_pulses
                                                            else (
                                                                lambda s_post, g_unneut: self_fn(
                                                                    self_fn,
                                                                    idx + 1,
                                                                    s0 * f_isr + (s_post - s0 * f_isr) * math.exp(-k_d * dt_h),
                                                                    post_acc + [round(s_post, ndig)],
                                                                    unneut_acc + [round(g_unneut, ndig)],
                                                                )
                                                            )(
                                                                max(0.0, s_pre - si * d_gzmb),
                                                                max(0.0, (si * d_gzmb - s_pre) / si),
                                                            )
                                                        )
                                                    )
                                                )(math.log(2.0) / 6.0, 2.0, 0.15),
                                            ),
                                        },
                                    }
                                )(
                                    (
                                        "CGAGGAAACTGAAACTCGAGGGGACTTTCCCGAGGAAACTGAAACTCGAGGGGACTTTCC"
                                        "CGAGGAAACTGAAACTCGAGGGGCGGAGCCATCACGCAGGGGCGGAGCCATCACGCAGGG"
                                        "GCGGAGCCATCACGCAGGCGCGCCGAGCCGCAGCCATTGCCTTATATGGTAATCGTGCGA"
                                        "GAGGGCGCAGGGACTTCCTTGTCCCAAATCTGGCGGAGCCGAAACAGAGA"
                                    ),
                                    cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:],
                                    cxcl10_ha_l_600
                                    + spa49_spacer40_maz4_65_154bp[:49]
                                    + (
                                        "CGAGGAAACTGAAACTCGAGGGGACTTTCCCGAGGAAACTGAAACTCGAGGGGACTTTCC"
                                        "CGAGGAAACTGAAACTCGAGGGGCGGAGCCATCACGCAGGGGCGGAGCCATCACGCAGGG"
                                        "GCGGAGCCATCACGCAGGCGCGCCGAGCCGCAGCCATTGCCTTATATGGTAATCGTGCGA"
                                        "GAGGGCGCAGGGACTTCCTTGTCCCAAATCTGGCGGAGCCGAAACAGAGA"
                                    )
                                    + kozak_9 + serpinb9_dna + "TGA" + sv40_polya_122 + dxl3_pause_spacer_82bp + syn_5xisre_minp_148 + kozak_9 + pdl1_dna + bgh_polya_225 + (cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:]),
                                    cxcl10_ha_l_600
                                    + spa49_spacer40_maz4_65_154bp[:49]
                                    + (
                                        "CGAGGAAACTGAAACTCGAGGGGACTTTCCCGAGGAAACTGAAACTCGAGGGGACTTTCC"
                                        "CGAGGAAACTGAAACTCGAGGGGCGGAGCCATCACGCAGGGGCGGAGCCATCACGCAGGG"
                                        "GCGGAGCCATCACGCAGGCGCGCCGAGCCGCAGCCATTGCCTTATATGGTAATCGTGCGA"
                                        "GAGGGCGCAGGGACTTCCTTGTCCCAAATCTGGCGGAGCCGAAACAGAGA"
                                    )
                                    + kozak_9 + serpinb9_dna + "TGA" + sv40_polya_122 + dxl3_pause_spacer_82bp + eef1a1_5top_cagaga_230 + kozak_9 + pdl1_dna + bgh_polya_225 + (cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:]),
                                    cxcl10_ha_l_600
                                    + spa49_spacer40_maz4_65_154bp[:49]
                                    + eef1a1_5top_cagaga_230
                                    + kozak_9 + serpinb9_dna + gsg_p2a_dna + pdl1_dna + wpre_mut6_589[:135] + bgh_polya_225 + (cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:]),
                                    cxcl10_ha_l_600
                                    + spa49_spacer40_maz4_65_154bp[:49]
                                    + syn_5xisre_minp_148
                                    + kozak_9 + serpinb9_dna + "TGA" + sv40_polya_122 + dxl3_pause_spacer_82bp + syn_5xisre_minp_148 + kozak_9 + pdl1_dna + bgh_polya_225 + (cxcl10_ha_r_600[:16] + "C" + cxcl10_ha_r_600[17:]),
                                ),
                            })(
                                arm_1b_seq[:1153] + "C" + arm_1b_seq[1154:],
                                "GGAGGCGGTGGTAGCGGCGGTGGAGGTTCAGGTGGCGGAGGCTCT",
                                "GGTGGAGGCGGTTCAGGCGGAGGTGGCTCTGGCGGTGGCGGATCAGGAGGTGGAGGCAGC",
                                arm_1b_seq[:1733] + "GGAGGCGGTGGTAGCGGCGGTGGAGGTTCAGGTGGCGGAGGCTCT" + arm_1b_seq[1778:2075] + "GGTGGAGGCGGTTCAGGCGGAGGTGGCTCTGGCGGTGGCGGATCAGGAGGTGGAGGCAGC" + arm_1b_seq[2135:],
                                "AATAAAAGATCTTTATTTTCATTAGATCTGTGTGTTGGTTTTTTGTGTG" + "CTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCA" + "CTGGAGGGGCTGGAGGGGCTGGAGGGGCTGGAGGGGCACTGGAGGGGCTGGAGGGGCTGGAGGGG",
                                arm_1b_seq[:600] + ("AATAAAAGATCTTTATTTTCATTAGATCTGTGTGTTGGTTTTTTGTGTG" + "CTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCA" + "CTGGAGGGGCTGGAGGGGCTGGAGGGGCTGGAGGGGCACTGGAGGGGCTGGAGGGGCTGGAGGGG") + arm_1b_seq[600:],
                                b2m_ha_l_600[:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:],
                                b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:],
                                eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:],
                                "GGAGGCGGTGGTAGCGGCGGTGGAGGTTCAGGTGGCGGAGGCTCTGGAGGTGGAGGTTCG",
                                b2m_ha_l_600 + eef1a1_core_230 + chimeric_intron_133 + kozak_9 + hlae_sct_dna_nostop + gsg_p2a_dna + cd47_igv_gpi_dna + bgh_polya_225 + b2m_ha_r_600,
                                (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:])
                                + (eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:])
                                + chimeric_intron_133 + kozak_9 + hlae_sct_dna_nostop + gsg_p2a_dna + cd47_igv_gpi_dna + bgh_polya_225 + b2m_ha_r_600,
                                (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:])
                                + (eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:])
                                + chimeric_intron_133 + kozak_9
                                + (hlae_sct_dna_nostop[:87] + "GGAGGCGGTGGTAGCGGCGGTGGAGGTTCAGGTGGCGGAGGCTCTGGAGGTGGAGGTTCG" + hlae_sct_dna_nostop[132:])
                                + gsg_p2a_dna + cd47_igv_gpi_dna + bgh_polya_225 + b2m_ha_r_600,
                                wpre_mut6_589[:389],
                                (b2m_ha_l_600[:539] + "G" + b2m_ha_l_600[540:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:])
                                + (eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:])
                                + chimeric_intron_133 + kozak_9 + hlae_sct_dna_stop + bgh_polya_225 + b2m_ha_r_600,
                                b2m_ha_l_600 + chimeric_intron_133 + kozak_9 + hlae_sct_dna_stop + wpre_mut6_589[:389] + bgh_polya_225 + b2m_ha_r_600,
                                aavs1_ha_l_600 + chs4_core_250 + cbx3_a2ucoe_455 + (eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:]) + kozak_9 + icasp9_dna[:-3] + gsg_p2a_dna + cd47_igv_gpi_dna + sv40_polya_122 + aavs1_ha_r_600,
                                (b2m_ha_l_600[:582] + "C" + b2m_ha_l_600[583:588] + "A" + b2m_ha_l_600[589:591] + "C" + b2m_ha_l_600[592:594] + "A" + b2m_ha_l_600[595:])
                                + arm_1b_seq[600:1259]
                                + revcomp(eef1a1_core_230[:197] + "CAGAGA" + eef1a1_core_230[203:])
                                + arm_1b_seq[1489:],
                                cxcl10_ha_l_600 + kozak_9 + serpinb9_dna + "TGA" + sv40_polya_122 + syn_5xisre_minp_148 + kozak_9 + pdl1_dna + bgh_polya_225 + cxcl10_ha_r_600,
                                "CACTCGAGCTGGAGGGGCTGGAGGGGCTGGAGGGGCTGGAGGGGCACTGGAGGGGCTGGAGGGGCTGGAGGGGCACTCGAGC",
                                cxcl10_ha_l_600 + kozak_9 + serpinb9_dna + "TGA" + sv40_polya_122
                                + "CACTCGAGCTGGAGGGGCTGGAGGGGCTGGAGGGGCTGGAGGGGCACTGGAGGGGCTGGAGGGGCTGGAGGGGCACTCGAGC"
                                + syn_5xisre_minp_148 + kozak_9 + pdl1_dna + bgh_polya_225 + cxcl10_ha_r_600,
                            )
                        ))(),
                    },
                },
            ),
            make_construct_entry(
                "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01",
                "CXCL10 Exon 1 (GRCh38 chr4:76023468|76023467, - strand)",
                locus_3_seq,
                1200,
                locus_3_orf,
                locus_3_parts,
                {
                    "canonical_gsgp2a_construct_alias": "LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_R01",
                    "delivery_modality": "Single AAV6 capsid (4,380 bp including 2x145 bp ITRs; +320 bp headroom) or non-viral ssDNA HDR",
                    "cytosolic_furin_motif_removed_per_r01": True,
                    "2a_element_encoded_in_fasta": "Single 66-bp (22-aa) GSG-P2A peptide (leaving a 21-aa C-terminal stub on SERPINB9; 26-aa and 50-aa tandem tPT2A stubs are evaluated as sensitivity bounds in Layer 3, closing AUDIT-REF)",
                    "exogenous_intron_omission_rationale_claude_v80_032": (
                        "HDR insertion occurs at chr4:76023468|76023467 (- strand) inside CXCL10 Exon 1 (29 bp downstream of the endogenous "
                        "CXCL10 TSS at chr4:76023497 and upstream of the native Exon 1 ATG at chr4:76023429-76023431[-], which is displaced into "
                        "the 3' homology arm downstream of bGH_polyA_225bp); no exogenous Chimeric_Intron_133bp is included so single-capsid AAV6 headroom (+320 bp) is preserved."
                    ),
                    "r01_verification": (
                        "Cytosolic SERPINB9 (376 aa) is translated on free cytosolic ribosomes with zero Furin motif, "
                        "leaving a 21-aa GSG-P2A C-terminal stub after ribosomal skipping, followed by ER-targeted PD-L1 (290 aa)."
                    ),
                    "locus3_4q21_1_cis_neighbour_and_aav6_packaging_gate_iip_0011": {
                        "decision_id": "DEC-090",
                        "proposal_id": "IIP-0011",
                        "canonical_donor_bp": 4090,
                        "packaged_aav6_genome_with_2x145bp_itrs_bp": 4380,
                        "single_aav6_conservative_budget_bp": 4700,
                        "headroom_below_4700bp_budget_bp": 320,
                        "hypothetical_2x250bp_chs4_insulated_donor_bp": 4590,
                        "hypothetical_2x250bp_chs4_packaged_bp": 4880,
                        "overflow_above_4700bp_budget_bp": 180,
                        "packaging_literature_scope_note": (
                            "Wu et al. 2010 (PMID:19904234) demonstrated heterogeneous, 5'-truncated packaged genomes for oversized "
                            "AAV2/5/8 vectors exceeding ~5 kb; adding 2 x 250 bp cHS4 insulators to Locus 3 yields 4,880 bp packaged, "
                            "violating OpenIslet's conservative 4,700 bp single-AAV6 budget by 180 bp without claiming proven absolute "
                            "AAV6 packaging failure at 4,880 bp. Any compacted (<= 4,700 bp packaged), non-AAV6, or relocated split "
                            "safe-harbor cassette remains a separately qualified challenger."
                        ),
                        "blocked_cis_neighbour_and_compartment_assay_gate": {
                            "comparators_across_independent_clones_and_blocks": [
                                "Unedited parental SC-islet control",
                                "Clean CXCL10-indel knockout control",
                                "Locus 3 CXCL10::SERPINB9-GSG-P2A-PD-L1 knock-in clones",
                            ],
                            "stimulus_regimes": ["Resting vehicle", "Recombinant human IFN-alpha", "Recombinant human IFN-gamma"],
                            "secreted_chemokine_neighbours_4q21_1": {
                                "genes": ["CXCL9", "CXCL11"],
                                "assays": "Paired RT-qPCR + cell-free supernatant ELISA across predeclared cytokine dose/time courses with explicit detection limits, absolute protein output, and predeclared insertion-specific excess-over-control hold margin with uncertainty (accounting for endogenous cytokine induction of CXCL9/CXCL11 in parental and CXCL10-indel controls).",
                            },
                            "host_overlapping_non_chemokine_neighbour_art3": {
                                "gene": "ART3 (ecto-ADP-ribosyltransferase 3; non-chemokine)",
                                "genomic_relationship_grch38": "GRCh38 RefSeq includes ART3 transcript isoforms whose large first intron spans the CXCL10 Exon 1 cut site (chr4:76023468|76023467).",
                                "assays": "Establish lineage-resolved baseline ART3 isoform expression across hPSC, Stage-7 endocrine, and vascular lineages, and measure isoform-specific splice-junction/transcript RT-qPCR plus cellular/membrane protein abundance for both disruption/repression and cis co-activation.",
                            },
                            "payload_compartment_protein_assays": {
                                "SERPINB9": "Intracellular flow cytometry / Western blot + Granzyme B kinetics (never inferred from negative supernatant ELISA)",
                                "PD-L1": "Cell-surface QuantiBRITE flow cytometry alongside Readout 3A soluble shedding ELISA",
                            },
                        },
                        "primary_citations": ["PMID:19904234"],
                    },
                },
            ),
            make_construct_entry(
                "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17",
                "AAVS1 / PPP1R12C Intron 1 (GRCh38 chr19:55115768|55115767, - strand)",
                locus_4_seq,
                1200,
                icasp9_dna,
                locus_4_parts,
                {
                    "canonical_hnrnpa2b1_cpg_core_construct_alias": "LOCUS4_AAVS1_CHS4_250BP_HNRNPA2B1_CPG_CORE_455BP_ICASP9_R17",
                    "construct_id_token_disambiguation": (
                        "Canonical construct_id and FASTA header retain legacy token order CHS4_455BP_CBX3_A2UCOE for test/SHA-256 "
                        "compatibility; part_ledger verifies cHS4_core_insulator_250bp is 250 bp and the adjacent HNRNPA2B1-proximal "
                        "CpG-core candidate (part_name CBX3_A2UCOE_455bp_exact) is 455 bp."
                    ),
                    "delivery_modality": "Single AAV6 capsid (3,747 bp including 2x145 bp ITRs; +953 bp headroom) or non-viral ssDNA HDR",
                    "cbx3_a2ucoe_length_bp": len(cbx3_a2ucoe_455),
                    "cbx3_a2ucoe_avi_window_match": ucoe_avi_match_str,
                    "ctcf_ma0139_1_footprint_fii_scan_note": (
                        f"Direct JASPAR MA0139.1 CTCF scan on cHS4_core_insulator_250bp locates the canonical FII footprint at local 1-based positions "
                        f"{chs4_top1['start_1based_in_window']}..{chs4_top1['end_1based_in_window']} ({chs4_top1['strand']} strand, kmer={chs4_top1['matched_kmer']}, "
                        f"log2_odds={chs4_top1['log2_odds_score']} bits, rel_score={chs4_top1['relative_score_0_to_1']}, "
                        f"1-PWM Bonferroni p={chs4_top1['bonferroni_window_p_value']}, 6-PWM family Bonferroni p={chs4_top6['bonferroni_region_across_all_matrices_p_value']}, "
                        f"passes_rel_score_0p80_and_p_le_0p05={chs4_top1['passes_rel_score_0p80_and_p_le_0p05']}; exact sequence match to Gallus U78775.2:55..73)."
                    ),
                    "common_mode_epigenetic_silencing_and_en_bloc_retrieval_audit_sol61_r5": {
                        "finding_id": "AUDIT-REF",
                        "decision_id": "DEC-044",
                        "primary_citations": ["PMID:35795779", "PMID:26455413"],
                        "correlated_common_mode_escape_mixture_formula": "P_escape_cell = p_common + (1 - p_common) * (p_ind ** 2)",
                        "single_allele_silencing_or_mutation_rate_p_ind": 1.0e-4,
                        "independent_two_hit_term_p_ind_squared": 1.0e-8,
                        "correlated_trans_epigenetic_silencing_floor_range_p_common": [1.0e-6, 1.0e-5],
                        "curative_dose_proliferating_cells_n_prolif_endocrine": 80000,
                        "curative_dose_proliferating_cells_n_prolif_pan_lineage": 93350,
                        "expected_surviving_clonogenic_cells_per_dose_if_p_common_1e_6_to_1e_5": [0.0808, 0.8008],
                        "expected_surviving_clonogenic_cells_per_dose_endocrine_80000_if_p_common_1e_6_to_1e_5": [0.0808, 0.8008],
                        "expected_surviving_clonogenic_cells_per_dose_pan_lineage_93350_if_p_common_1e_6_to_1e_5": [0.0943, 0.9344],
                        "poisson_prob_at_least_1_proliferating_survivor_pan_lineage_93350_if_p_common_1e_6_to_1e_5": [
                            round(1.0 - math.exp(-93350.0 * (1.0e-6 + (1.0 - 1.0e-6) * 1.0e-8)), 6),
                            round(1.0 - math.exp(-93350.0 * (1.0e-5 + (1.0 - 1.0e-5) * 1.0e-8)), 6),
                        ],
                        "per_cell_vs_per_graft_common_mode_parameter_reconciliation_astra6_r5": (
                            "Distinguishes two distinct common-mode parameters (AUDIT-REF [DEC-046]): "
                            "(a) Layer-2 p_common_cell in [10^-6, 10^-5] is a per-proliferating-cell trans-epigenetic/apoptotic resistance rate (giving p_cell = p_common_cell + (1 - p_common_cell)*10^-8, "
                            "expected surviving proliferating cells E = 93,350 * p_cell = 0.0943 to 0.9344 per dose, and Poisson dose-level escape probability P(>=1 survivor) = 1 - exp(-E) = 8.9975% to 60.7192%, which exceeds the 0.1% patient-level target by 90x-607x); "
                            "whereas (b) Layer-1 q_common_graft <= 6.6998e-5 is a per-graft/per-batch catastrophic failure probability in P_escape_graft = q_common_graft + (1 - q_common_graft)*(1 - (1 - p_cell)^93350) <= 10^-3, "
                            "which at q_common_graft = 6.6998e-5 matches the 10^-3 total dose-level ceiling when per-cell escape is at the two-independent-allele floor p_cell = p_ind^2 = 10^-8 (leaving remaining cell-level headroom p_cell <= 1.00000094e-8, i.e. p_common_cell <= 9.4e-16 when q_common_graft = 6.6998e-5 is simultaneously active, whereas under a pure cell-level budget q_common_graft = 0 the 10^-3 dose-level ceiling allows p_cell <= 1.0718e-8, i.e. per-cell p_common_cell <= 7.18e-10; DEC-078). "
                            "This 90x-607x gap under realistic per-cell trans-silencing is why pharmacological suicide switches (iCasp9 / RQR8) cannot be claimed as a standalone <= 10^-3 patient-level guarantee and why primary physical containment + en-bloc surgical retrievability (Gate 0S-Retrieval) is mandatory."
                        ),
                        "mcb_effective_clonogenic_trial_floor_for_95pct_1e8_bound": 299573228,
                        "dual_orthogonal_suicide_switch_challenger_sol61_r5": {
                            "challenger_id": "DUAL_SAFE_HARBOR_AAVS1_ICASP9_PLUS_GAPDH_RQR8_OR_HSVTK_SR39",
                            "locus4_aavs1_switch": "AAVS1::cHS4-A2UCOE-EEF1A1-iCasp9 (AP1903 dimerizer -> Caspase-9 intrinsic apoptosis)",
                            "orthogonal_second_switch": "GAPDH::EEF1A1-RQR8 (extrinsic rituximab CDC/ADCC surface epitope, bypassing intracellular XIAP/BCL-xL/APAF1 blocks) or HSV-TK(SR39) (ganciclovir DNA chain termination targeting dividing cells)",
                            "total_graft_cells_5e8_expected_survivors_under_naive_1e8": 5.0,
                            "total_graft_cells_5e8_prob_at_least_1_survivor_under_naive_1e8": round(1.0 - math.exp(-5.0), 6),
                            "pan_lineage_proliferating_93350_expected_survivors_under_p_common_1e6_to_1e5": [0.0943, 0.9344],
                            "why_gate_0s_surgical_retrieval_remains_mandatory": (
                                "Even with an orthogonal second suicide switch (RQR8/rituximab or HSV-TK/ganciclovir) at a second safe harbor, a 5e8-cell total graft still has E=5.0 surviving cells "
                                "(P(>=1)=99.33%) at a 10^-8 per-cell escape ceiling and 0.0943-0.9344 expected proliferating escapees across the 93,350 pan-lineage Ki67+ subpopulation under p_common = 10^-6-10^-5 "
                                "(plus macromolecular IgG/complement diffusion limits inside a fibrotic capsule for RQR8); therefore pharmacological suicide switches serve as >=4-5 log debulking adjuncts while primary physical containment and en-bloc surgical retrievability of the dual omental pouches (Gate 0S-Retrieval) provide the definitive clinical fail-safe (AUDIT-REF & AUDIT-REF [DEC-044/045])."
                            ),
                        },
                        "primary_containment_and_surgical_retrieval_architecture": (
                            "Because both alleles of biallelic AAVS1::cHS4-A2UCOE-EEF1A1-iCasp9 (or dual-safe-harbor AAVS1 + GAPDH) reside inside the same trans-acting nuclear "
                            "DNMT3A/3B/KAP1/HUSH and post-mitotic beta-cell XIAP/BCL-xL environment, single-cell AP1903 escape follows the common-mode mixture model "
                            "P_escape_cell = p_common + (1 - p_common) * p_ind^2 rather than a pure independent product p_ind^2 = 10^-8 (Wunderlich et al. 2022 PMID:35795779; Ordovas et al. 2015 PMID:26455413). "
                            "Consequently: (1) Stage-0 Gate S9 enforces a cumulative MCB clonogenic trial floor of N_eff >= ceil(-ln(0.05)/10^-8) = 299,573,228 effective clonogenic trials "
                            "(896,925,831 physical cells at eta = 0.334) after 35-day Stage 0->7 differentiation + 14-day cytokine/hypoxia culture with 0 surviving colonies; and "
                            "(2) for human translation, iCasp9 + AP1903 is positioned as an adjunct pharmacological debulking switch (>= 4-5 log reduction) paired with primary mechanical containment "
                            "and en-bloc surgical retrievability of the dual pre-vascularized omental scaffold pouches (Gate 0S-Retrieval; AUDIT-REF & AUDIT-REF [DEC-044/045])."
                        ),
                    },
                    "decision_exp4_four_arm_ucoe_orientation_splicing_and_methylation_substudy_iip_0011": {
                        "decision_id": "DEC-090",
                        "proposal_id": "IIP-0011",
                        "aavs1_recipient_junction_grch38": "chr19:55115768|55115767 (PPP1R12C intron 1, minus-strand host transcription)",
                        "pinned_chr7_26201562_26201567_plus_strand_motif": ref["ensembl_promoter_sequences"]["CBX3_A2UCOE_chr7_26200650_26201850"]["sequence"][26201562 - 26200650 : 26201568 - 26200650],
                        "pinned_chr7_26201562_26201567_reverse_complement_motif": revcomp(
                            ref["ensembl_promoter_sequences"]["CBX3_A2UCOE_chr7_26200650_26201850"]["sequence"][26201562 - 26200650 : 26201568 - 26200650]
                        ),
                        "four_arm_comparison": [
                            {
                                "arm_id": "Window_A_Reference_HNRNPA2B1_Proximal_455bp",
                                "genomic_interval_grch38_1based_closed": "chr7:26200580-26201034",
                                "element_length_bp": 455,
                                "cargo_bp": 2257,
                                "donor_bp": 3457,
                                "packaged_aav6_with_2x145bp_itrs_bp": 3747,
                                "orientation_relative_to_donor_eef1a1_icasp9": "canonical reference orientation in LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17",
                            },
                            {
                                "arm_id": "Window_B_Genome_Derived_CBX3_453bp_Antisense_Candidate",
                                "genomic_interval_grch38_1based_closed": "chr7:26201456-26201908",
                                "element_length_bp": 453,
                                "cargo_bp": 2255,
                                "donor_bp": 3455,
                                "packaged_aav6_with_2x145bp_itrs_bp": 3745,
                                "orientation_relative_to_donor_eef1a1_icasp9": (
                                    "Reverse-complemented relative to the donor's EEF1A1->iCasp9 direction (which follows minus-strand PPP1R12C transcription), "
                                    "inverting the plus-strand GTAAGT hexamer at chr7:26201562-26201567 out of the transcribed sense strand."
                                ),
                                "provenance_and_orientation_qualification_note": (
                                    "Consistent with the BglI/BsrBI restriction boundaries of Zhang et al. 2017 (PMID:28860464), designated a genome-derived "
                                    "candidate pending ligated-terminus sequence reconciliation against the published insert. Because Zhang et al. 2017 reported "
                                    "orientation-dependent UCOE activity and inverting a single GTAAGT motif does not exclude other cryptic splice sites or "
                                    "transcriptional interference, antisense orientation is an empirical test arm rather than pre-established safe or equally anti-silencing."
                                ),
                            },
                            {
                                "arm_id": "Window_B_Genome_Derived_CBX3_453bp_Sense_Candidate",
                                "genomic_interval_grch38_1based_closed": "chr7:26201456-26201908",
                                "element_length_bp": 453,
                                "cargo_bp": 2255,
                                "donor_bp": 3455,
                                "packaged_aav6_with_2x145bp_itrs_bp": 3745,
                                "orientation_relative_to_donor_eef1a1_icasp9": "Plus-strand sequence oriented colinearly with the donor's EEF1A1->iCasp9 transcription unit",
                            },
                            {
                                "arm_id": "No_UCOE_Control",
                                "genomic_interval_grch38_1based_closed": None,
                                "element_length_bp": 0,
                                "cargo_bp": 1802,
                                "donor_bp": 3002,
                                "packaged_aav6_with_2x145bp_itrs_bp": 3292,
                                "orientation_relative_to_donor_eef1a1_icasp9": "cHS4_core_insulator_250bp + EEF1A1_core_promoter_230bp + iCasp9 without UCOE",
                            },
                        ],
                        "required_readouts_and_authoritative_escape_gate": (
                            "Measure 5'/3' PPP1R12C-transgene fusion transcripts by RACE-seq, targeted/single-molecule bisulfite CpG methylation "
                            "(explicitly covering the native 230-bp EEF1A1 core promoter's 19 CpG dinucleotides alongside UCOE CpGs), single-cell "
                            "iCasp9 expression distributions, and 24-h/72-h 10 nM AP1903 killing under normoxia and 1% O2 hypoxia + cytokines across "
                            "residual hPSCs, Stage-7 endocrine (beta, alpha, delta), and proliferative vascular/stromal (iEC, iPericyte) lineages "
                            "(Ordovas et al. 2015 PMID:26455413; Muller-Kuller et al. 2015 PMID:25605798; Zhang et al. 2017 PMID:28860464; "
                            "Wunderlich et al. 2022 PMID:35795779). Mean CpG methylation and bulk killing cannot bound rare resistant cells; "
                            "Readout 6 Tier 6B effective-denominator clonogenic escape qualification remains authoritative (GY-002)."
                        ),
                        "locus1_arm1b_longitudinal_methylation_parallel_check": (
                            "If Locus 1 Arm 1B (Syn_5xISRE_minP + antisense 230-bp EEF1A1 core with 19 native CpGs) advances, perform parallel "
                            "longitudinal clonal bisulfite CpG sequencing and single-cell resting/IFN-induced HLA-E + Hour-0 CD47 surface-density "
                            "distribution checks across differentiation passages (GY-009)."
                        ),
                        "primary_citations": ["PMID:26455413", "PMID:25605798", "PMID:28860464", "PMID:35795779"],
                    },
                },
            ),
        ],
    }


def verify_construct_part_grammar(construct_verification: Dict[str, Any]) -> Dict[str, Any]:
    """
    Strictly validate construct part tiling, explicit strand orientations ('+'/'-'),
    non-overlapping GRCh38 homology-arm genomic intervals and sequences,
    pinned UCOE sequence SHA-256 and AVI window alignment,
    directional promoter -> Kozak -> CDS -> polyA ordering on both '+' and '-' strands,
    and canonical P2A GDVEENPGP motif integrity (closes AUDIT-REF & 069).
    """
    source_constructs = construct_verification.get("constructs", [])
    ids = [c.get("construct_id") for c in source_constructs]
    if len(ids) != len(set(ids)) or set(ids) != CANONICAL_CONSTRUCT_IDS:
        raise ValueError("Exactly the four canonical construct IDs are required; duplicates/subsets cannot verify all cassettes")
    constructs_by_id = {c["construct_id"]: c for c in source_constructs}
    def invalid_reference_grammar() -> Dict[str, Any]:
        return {
            "all_construct_grammars_verified": False, "all_construct_grammars_valid": False,
            "all_homology_arms_non_overlapping_verified": False,
            "construct_grammar_validation_status": "INVALID_CONSTRUCT_GRAMMAR_DETECTED",
            "arm1b_constitutive_cd47_verified": False, "arm1b_sense_hlae_verified": False,
            "arm1a_bicistronic_verified": False, "locus3_bicistronic_verified": False,
            "locus4_ucoe_icasp9_verified": False,
        }
    # These IDs designate fixed reference cassettes. A subset of recognizable
    # promoter/CDS names cannot certify the full cassette after a required
    # insulator, intron or WPRE has been replaced by unrelated filler.
    required_part_order = {
        "LOCUS1_ARM1A_TPT2A_BICISTRONIC": (
            "B2M_HA_L_800bp", "EEF1A1_core_promoter_230bp", "Chimeric_Intron_133bp", "Kozak_9bp",
            "HLAE_0103_VMAPRTLVL_SCT_full_tail_CDS_1500bp", "GSG_P2A_CDS_66bp",
            "CD47_IgV_CD55_GPI_CDS_528bp", "WPREmut6_589bp", "bGH_polyA_225bp", "B2M_HA_R_800bp"),
        "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01": (
            "B2M_HA_L_600bp", "SV40_late_polyA_122bp_antisense", "CD47_IgV_CD55_GPI_CDS_528bp_antisense",
            "Kozak_9bp_antisense", "EEF1A1_core_promoter_230bp_antisense", "Syn_5xISRE_minP_148bp_sense",
            "Kozak_9bp_sense", "HLAE_0103_VMAPRTLVL_SCT_full_tail_stop_CDS_1503bp",
            "bGH_polyA_225bp_sense", "B2M_HA_R_600bp"),
        "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01": (
            "CXCL10_HA_L_600bp_minus", "Kozak_9bp", "SERPINB9_CDS_1128bp", "GSG_P2A_CDS_66bp",
            "PDL1_full_stop_CDS_873bp", "WPREmut6_589bp", "bGH_polyA_225bp", "CXCL10_HA_R_600bp_minus"),
        "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17": (
            "AAVS1_HA_L_600bp_minus", "cHS4_core_insulator_250bp", "CBX3_A2UCOE_455bp_exact",
            "EEF1A1_core_promoter_230bp", "Kozak_9bp", "iCasp9_FKBP12F36V_dCasp9_stop_CDS_1191bp",
            "SV40_late_polyA_122bp", "AAVS1_HA_R_600bp_minus"),
    }
    # Require positive, complete tiling and the actual Kozak module adjacent to
    # each independently initiated ORF; names alone cannot certify translation.
    kozak_requirements = {
        "LOCUS1_ARM1A_TPT2A_BICISTRONIC": [("Kozak_9bp", "+", "HLAE_")],
        "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01": [("Kozak_9bp_antisense", "-", "CD47_"), ("Kozak_9bp_sense", "+", "HLAE_")],
        "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01": [("Kozak_9bp", "+", "SERPINB9_")],
        "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17": [("Kozak_9bp", "+", "iCasp9_")],
    }
    for cid, construct in constructs_by_id.items():
        total, parts = construct.get("total_length_bp"), construct.get("part_ledger")
        if type(total) is not int or total <= 0 or not isinstance(parts, list) or not parts:
            raise ValueError(f"Positive construct length and complete part ledger are required: {cid}")
        cursor, names = 1, set()
        for index, part in enumerate(parts):
            if not isinstance(part, dict):
                raise ValueError(f"Construct part must be an object: {cid}")
            name, start, end, length = (part.get(k) for k in ("part_name", "start_1based", "end_1based", "length_bp"))
            if (not isinstance(name, str) or not name or name in names
                    or any(type(value) is not int for value in (start, end, length))
                    or length <= 0 or start != cursor or end != start + length - 1
                    or part.get("orientation") not in {"+", "-"}):
                raise ValueError(f"Invalid, duplicate, or noncontiguous construct part: {cid}/{name}")
            names.add(name)
            cursor = end + 1
            if part.get("part_type") == "CDS":
                aa = part.get("translated_aa_sequence")
                if (length % 3 or not isinstance(aa, str) or len(aa) != length // 3
                        or any(x not in CODON_TABLE for x in aa) or "*" in aa[:-1]):
                    raise ValueError(f"Invalid CDS translation metadata: {cid}/{name}")
                if "P2A" in name:
                    if aa != "GSGATNFSLLKQAGDVEENPGP":
                        raise ValueError(f"Reference P2A translation differs: {cid}/{name}")
                else:
                    followed_by_p2a = index + 1 < len(parts) and "P2A" in str(parts[index + 1].get("part_name", ""))
                    if not aa.startswith("M") or aa.endswith("*") == followed_by_p2a:
                        raise ValueError(f"Start/stop codon violates CDS translation order: {cid}/{name}")
        if cursor != total + 1:
            raise ValueError(f"Part ledger does not tile declared total donor length: {cid}")
        for name, orientation, target_prefix in kozak_requirements[cid]:
            selected = [p for p in parts if p["part_name"] == name]
            targets = [p for p in parts if p["part_name"].startswith(target_prefix) and p.get("part_type") == "CDS"]
            if len(selected) != 1 or len(targets) != 1:
                raise ValueError(f"Required Kozak and CDS modules missing/ambiguous: {cid}/{name}")
            kozak, target = selected[0], targets[0]
            dna = "GCCGCCACC" if orientation == "+" else revcomp("GCCGCCACC")
            adjacent = (kozak["end_1based"] + 1 == target["start_1based"] if orientation == "+"
                        else target["end_1based"] + 1 == kozak["start_1based"])
            if (kozak["orientation"] != orientation or kozak["length_bp"] != 9
                    or kozak.get("sha256") != sha256_str(dna) or not adjacent):
                raise ValueError(f"Kozak identity/orientation/CDS adjacency mismatch: {cid}/{name}")
        if tuple(part["part_name"] for part in parts) != required_part_order[cid]:
            return invalid_reference_grammar()
        for part in parts:
            name = part["part_name"]
            expected_type = ("CDS" if "_CDS_" in name else "PROMOTER" if "promoter" in name.lower() or "minp" in name.lower()
                             else "REGULATORY_OR_FLANK")
            expected_orientation = "-" if name.endswith("_antisense") else "+"
            if part.get("part_type") != expected_type or part["orientation"] != expected_orientation:
                return invalid_reference_grammar()
            if name in REFERENCE_REGULATORY_PART_SHA256 and part.get("sha256") != REFERENCE_REGULATORY_PART_SHA256[name]:
                return invalid_reference_grammar()
    source_registry = construct_verification.get("validated_homology_arm_source_registry", {})
    expected_arm_keys = {
        "LOCUS1_ARM1A_TPT2A_BICISTRONIC": ("B2M_HA_L_800bp", "B2M_HA_R_800bp"),
        "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01": ("B2M_HA_L_600bp", "B2M_HA_R_600bp"),
        "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01": ("CXCL10_HA_L_600bp_minus", "CXCL10_HA_R_600bp_minus"),
        "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17": ("AAVS1_HA_L_600bp_minus", "AAVS1_HA_R_600bp_minus"),
    }
    if (not isinstance(source_registry, dict)
            or set(source_registry) != {key for pair in expected_arm_keys.values() for key in pair}):
        raise ValueError("Missing validated homology source registry")
    if sha256_str(json.dumps(source_registry, sort_keys=True, separators=(",", ":"), allow_nan=False)) != REFERENCE_HOMOLOGY_REGISTRY_SHA256:
        return invalid_reference_grammar()

    def _is_contiguous(parts_list: List[Dict[str, Any]]) -> bool:
        if not parts_list:
            return False
        cur = 1
        for p in parts_list:
            s1 = p.get("start_1based")
            e1 = p.get("end_1based")
            ln = p.get("length_bp")
            if type(s1) is not int or type(e1) is not int or type(ln) is not int:
                return False
            if s1 != cur or (e1 - s1 + 1) != ln:
                return False
            cur = e1 + 1
        return True

    def _check_construct_homology_arms(c_obj: Dict[str, Any]) -> Tuple[bool, int]:
        p_list = c_obj.get("part_ledger", [])
        ha_items = [p for p in p_list if "_HA_" in str(p.get("part_name", ""))]
        if len(ha_items) != 2:
            return False, 0
        p_l, p_r = ha_items[0], ha_items[1]
        required_keys = expected_arm_keys[c_obj["construct_id"]]
        if (p_l is not p_list[0] or p_r is not p_list[-1]
                or tuple(p.get("raw_reference_key") for p in (p_l, p_r)) != required_keys
                or tuple(p.get("part_name") for p in (p_l, p_r)) != required_keys
                or any(p.get("orientation") != "+" for p in (p_l, p_r))):
            return False, 0
        seq_ov = 0
        if p_l.get("sha256") and p_l.get("sha256") == p_r.get("sha256"):
            seq_ov = min(int(p_l.get("length_bp", 0)), int(p_r.get("length_bp", 0)))
        for part in (p_l, p_r):
            key = part.get("raw_reference_key")
            pin = source_registry.get(key, {})
            coord = _parse_grch38_coord(str(part.get("source_accession_or_coordinate", "")))
            if (not pin or pin.get("assembly") != "GRCh38" or coord is None
                or coord[1] < 1 or coord[1] > coord[2]
                or (coord[0], coord[1], coord[2], int(coord[3])) != (pin["chrom"], pin["start_1based"], pin["end_1based"], pin["strand"])
                or part.get("sha256") != pin["sequence_sha256"] or part.get("length_bp") != pin["length_bp"]):
                return False, 0
        c_l = _parse_grch38_coord(str(p_l.get("source_accession_or_coordinate", "")))
        c_r = _parse_grch38_coord(str(p_r.get("source_accession_or_coordinate", "")))
        if c_l is None or c_r is None or c_l[0] != c_r[0]:
            return False, max(seq_ov, int(c_obj.get("homology_arm_overlap_bp", 0)))
        coord_ov = max(0, min(c_l[2], c_r[2]) - max(c_l[1], c_r[1]) + 1)
        tot_ov = max(seq_ov, coord_ov, int(c_obj.get("homology_arm_overlap_bp", 0)))
        c_obj["homology_arm_overlap_bp"] = tot_ov
        return (tot_ov == 0), tot_ov

    all_ha_non_overlapping_verified = True
    per_construct_ha_ok: Dict[str, bool] = {}
    for cid_k, c_obj in constructs_by_id.items():
        ha_ok, _ = _check_construct_homology_arms(c_obj)
        per_construct_ha_ok[cid_k] = ha_ok
        if not ha_ok:
            all_ha_non_overlapping_verified = False

    # 1. Validate LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01
    arm1b_constitutive_cd47_verified = False
    arm1b_sense_hlae_verified = False
    if "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01" in constructs_by_id and per_construct_ha_ok.get("LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01", False):
        parts_1b = constructs_by_id["LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01"].get("part_ledger", [])
        if _is_contiguous(parts_1b) and len(parts_1b) >= 8 and all(p.get("orientation") in ("+", "-") for p in parts_1b):
            cd47_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "CD47" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            eef_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "EEF1A1" in p.get("part_name", "") and p.get("part_type") == "PROMOTER"]
            sv40_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "SV40_late_polyA" in p.get("part_name", "")]
            if cd47_hits and eef_hits and sv40_hits:
                (c_idx, c0), (e_idx, e0), (s_idx, s0) = cd47_hits[0], eef_hits[0], sv40_hits[0]
                # Antisense '-' unit: in + strand donor order, SV40_polyA (s_idx) < CD47_CDS (c_idx) < EEF1A1_promoter (e_idx)
                if (
                    c0.get("orientation") == "-"
                    and e0.get("orientation") == "-"
                    and s0.get("orientation") == "-"
                    and s_idx < c_idx < e_idx
                    and e0["start_1based"] > c0["end_1based"]
                    and s0["end_1based"] < c0["start_1based"]
                ):
                    arm1b_constitutive_cd47_verified = True

            isre_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "5xISRE" in p.get("part_name", "") and p.get("part_type") == "PROMOTER"]
            hlae_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "HLAE" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            bgh_hits = [(idx, p) for idx, p in enumerate(parts_1b) if "bGH_polyA" in p.get("part_name", "")]
            if isre_hits and hlae_hits and bgh_hits:
                (i_idx, i0), (h_idx, h0), (b_idx, b0) = isre_hits[0], hlae_hits[0], bgh_hits[0]
                # Sense '+' unit: in + strand donor order, 5xISRE_promoter (i_idx) < HLAE_CDS (h_idx) < bGH_polyA (b_idx)
                if (
                    i0.get("orientation") == "+"
                    and h0.get("orientation") == "+"
                    and b0.get("orientation") == "+"
                    and i_idx < h_idx < b_idx
                    and i0["end_1based"] < h0["start_1based"]
                    and h0["end_1based"] < b0["start_1based"]
                ):
                    arm1b_sense_hlae_verified = True

    # 2. Validate LOCUS1_ARM1A_TPT2A_BICISTRONIC
    arm1a_bicistronic_verified = False
    if "LOCUS1_ARM1A_TPT2A_BICISTRONIC" in constructs_by_id and per_construct_ha_ok.get("LOCUS1_ARM1A_TPT2A_BICISTRONIC", False):
        parts_1a = constructs_by_id["LOCUS1_ARM1A_TPT2A_BICISTRONIC"].get("part_ledger", [])
        if _is_contiguous(parts_1a):
            eef_1a = [p for p in parts_1a if "EEF1A1" in p.get("part_name", "") and p.get("part_type") == "PROMOTER"]
            hlae_1a = [p for p in parts_1a if "HLAE" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            p2a_1a = [p for p in parts_1a if "P2A" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            cd47_1a = [p for p in parts_1a if "CD47" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            bgh_1a = [p for p in parts_1a if "bGH_polyA" in p.get("part_name", "")]
            if eef_1a and hlae_1a and p2a_1a and cd47_1a and bgh_1a:
                e1, h1, p1, c1, b1 = eef_1a[0], hlae_1a[0], p2a_1a[0], cd47_1a[0], bgh_1a[0]
                p2a_aa = str(p1.get("translated_aa_sequence") or "")
                if (
                    all(x.get("orientation") == "+" for x in (e1, h1, p1, c1, b1))
                    and e1["end_1based"] < h1["start_1based"]
                    and h1["end_1based"] + 1 == p1["start_1based"]
                    and p1["end_1based"] + 1 == c1["start_1based"]
                    and c1["end_1based"] < b1["start_1based"]
                    and p2a_aa.endswith("GDVEENPGP")
                ):
                    arm1a_bicistronic_verified = True

    # 3. Validate LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01
    locus3_bicistronic_verified = False
    if "LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01" in constructs_by_id and per_construct_ha_ok.get("LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01", False):
        parts_l3 = constructs_by_id["LOCUS3_CXCL10_SERPINB9_TPT2A_PDL1_R01"].get("part_ledger", [])
        if _is_contiguous(parts_l3):
            sb9_l3 = [p for p in parts_l3 if "SERPINB9" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            p2a_l3 = [p for p in parts_l3 if "P2A" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            pdl1_l3 = [p for p in parts_l3 if "PDL1" in p.get("part_name", "") and p.get("part_type") == "CDS"]
            bgh_l3 = [p for p in parts_l3 if "bGH_polyA" in p.get("part_name", "")]
            if sb9_l3 and p2a_l3 and pdl1_l3 and bgh_l3:
                s3, p3, d3, b3 = sb9_l3[0], p2a_l3[0], pdl1_l3[0], bgh_l3[0]
                p2a_aa3 = str(p3.get("translated_aa_sequence") or "")
                if (
                    all(x.get("orientation") == "+" for x in (s3, p3, d3, b3))
                    and s3["end_1based"] + 1 == p3["start_1based"]
                    and p3["end_1based"] + 1 == d3["start_1based"]
                    and d3["end_1based"] < b3["start_1based"]
                    and p2a_aa3.endswith("GDVEENPGP")
                ):
                    locus3_bicistronic_verified = True

    # 4. Validate LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17 (including UCOE sequence SHA-256 & AVI alignment)
    locus4_ucoe_icasp9_verified = False
    if "LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17" in constructs_by_id:
        if not per_construct_ha_ok.get("LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17", False):
            locus4_ucoe_icasp9_verified = False
        else:
            parts_l4 = constructs_by_id["LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_ICASP9_R17"].get("part_ledger", [])
            ucoe_parts = [p for p in parts_l4 if "CBX3_A2UCOE" in str(p.get("part_name", ""))]
            ucoe_audit_obj = construct_verification.get("regulatory_element_audits", {}).get("CBX3_A2UCOE_core_455bp_R17", {})
            expected_ucoe_sha = "6a4a4ad89dc417532b4066c02f8ff660a30706d7e56691e1d376cfb72e79b0d9"
            required_l4 = {
                "iCasp9": [p for p in parts_l4 if "iCasp9" in p.get("part_name", "") and p.get("part_type") == "CDS"],
                "promoter": [p for p in parts_l4 if "EEF1A1" in p.get("part_name", "") and p.get("part_type") == "PROMOTER"],
                "polyA": [p for p in parts_l4 if "SV40_late_polyA" in p.get("part_name", "")],
            }
            if not _is_contiguous(parts_l4) or len(ucoe_parts) != 1 or not ucoe_audit_obj or not all(required_l4.values()):
                locus4_ucoe_icasp9_verified = False
            else:
                u_part = ucoe_parts[0]
                promoter, cds, polya = required_l4["promoter"][0], required_l4["iCasp9"][0], required_l4["polyA"][0]
                locus4_ucoe_icasp9_verified = bool(
                    all(p.get("orientation") == "+" for p in (u_part, promoter, cds, polya))
                    and u_part["end_1based"] < promoter["start_1based"]
                    and promoter["end_1based"] < cds["start_1based"] < polya["start_1based"]
                    and ucoe_audit_obj.get("sequence_sha256") == expected_ucoe_sha
                    and ucoe_audit_obj.get("genomic_coordinates_grch38") == "chr7:26200580-26201034")
                if u_part.get("sha256") != expected_ucoe_sha:
                    locus4_ucoe_icasp9_verified = False
                if ucoe_audit_obj and (
                    ucoe_audit_obj.get("sequence_sha256") != expected_ucoe_sha
                    or ucoe_audit_obj.get("anti_silencing_functional_status") != "PREREGISTERED_PENDING"
                ):
                    locus4_ucoe_icasp9_verified = False

    all_ok = bool(
        all_ha_non_overlapping_verified
        and arm1b_constitutive_cd47_verified
        and arm1b_sense_hlae_verified
        and arm1a_bicistronic_verified
        and locus3_bicistronic_verified
        and locus4_ucoe_icasp9_verified
    )
    return {
        "all_construct_grammars_verified": all_ok,
        "all_construct_grammars_valid": all_ok,
        "all_homology_arms_non_overlapping_verified": all_ha_non_overlapping_verified,
        "construct_grammar_validation_status": "PASS_ALL_CASSETTES_VERIFIED" if all_ok else "INVALID_CONSTRUCT_GRAMMAR_DETECTED",
        "arm1b_constitutive_cd47_verified": arm1b_constitutive_cd47_verified,
        "arm1b_sense_hlae_verified": arm1b_sense_hlae_verified,
        "arm1a_bicistronic_verified": arm1a_bicistronic_verified,
        "locus3_bicistronic_verified": locus3_bicistronic_verified,
        "locus4_ucoe_icasp9_verified": locus4_ucoe_icasp9_verified,
    }


def simulate_stage0_to_stage7_perturbation_plane(
    ref: Dict[str, Any],
    construct_verification: Dict[str, Any],
    motif_scans: Dict[str, Any],
    effects_path: Optional[Path] = None,
) -> Dict[str, Any]:
    """
    Literature-anchored stage-specific prior lookup with independent per-stage Monte Carlo
    uncertainty bands (N = 1,000 draws per stage/endpoint; not a fitted ODE/GRN dynamical model),
    consuming live GTEx TPMs, ENCODE SCREEN cCREs, bounded JASPAR PWM scores, strict construct
    promoter-direction & CDS grammar verification, and deduplicated Ring-1 atomic effect studies
    across all 6 HIP-Core factors (X1..X6).
    Closes V70-04, AUDIT-REF, AUDIT-REF, AUDIT-REF, 019, 043, 053, 069, 074, 111, 112, 113.
    """
    eff_file = effects_path if effects_path is not None else RING1_EFFECTS_PATH
    # Count biological targets once: PD-L1/PDL1/CD274 are one gene, not
    # independent evidence channels. Preserve old display keys explicitly below.
    canonical_gene_aliases = {
        "B2M": ("B2M",), "HLAE": ("HLAE", "HLA-E"), "CD47": ("CD47",),
        "CIITA": ("CIITA",), "CXCL10": ("CXCL10",), "SERPINB9": ("SERPINB9",),
        "CD274": ("CD274", "PD-L1", "PDL1"), "TYK2": ("TYK2",),
        "TXNIP": ("TXNIP",), "RNLS": ("RNLS",), "CASP9": ("CASP9", "ICASP9"),
    }
    legacy_gene_keys = {
        "B2M": "B2M", "HLA-E": "HLAE", "CD47": "CD47", "CIITA": "CIITA",
        "CXCL10": "CXCL10", "SERPINB9": "SERPINB9", "PD-L1": "CD274",
        "CD274": "CD274", "TYK2": "TYK2", "TXNIP": "TXNIP", "RNLS": "RNLS", "ICASP9": "CASP9",
    }
    token_regexes = {
        g: re.compile(r"(?<![A-Z0-9])(?:" + "|".join(re.escape(alias) for alias in aliases) + r")(?![A-Z0-9])")
        for g, aliases in canonical_gene_aliases.items()
    }
    gene_study_sets: Dict[str, Dict[str, set]] = {g: {"total": set(), "protective": set(), "penalty": set()} for g in canonical_gene_aliases}
    unique_effect_ids: set = set()
    seen_effect_records: Dict[str, str] = {}
    duplicate_exact_effect_records_skipped = 0
    excluded_effect_ids: set = set()
    excluded_study_pmids: set = set()
    allowed_source_types = {"FullText_XML_or_PDF", "FullText_Plus_Supplement_or_GEO", "Abstract_Only",
                            "Citation_Only_No_Abstract_Indexed", "Project_Summary",
                            "Preprint_Superseded_By_Peer_Reviewed", "Review_or_Commentary"}
    if not eff_file.exists():
        raise FileNotFoundError(f"Required Ring-1 atomic effects file does not exist: {eff_file}")
    effects_bytes = eff_file.read_bytes()
    effects_sha256 = hashlib.sha256(effects_bytes).hexdigest()
    try:
        effects_input_path = str(eff_file.resolve().relative_to(REPO_ROOT.resolve()))
    except ValueError:
        effects_input_path = f"external-input/{eff_file.name}"
    for line in effects_bytes.decode("utf-8").splitlines():
        sline = line.strip()
        if not sline:
            continue
        eff = json.loads(sline)
        if not isinstance(eff, dict):
            raise ValueError("Atomic effect rows must be JSON objects")
        rec_key, pmid_key = eff.get("effect_id"), eff.get("pmid")
        if not isinstance(rec_key, str) or not rec_key.strip():
            raise ValueError("Atomic effect rows require a nonempty effect_id")
        if not isinstance(pmid_key, str) or re.fullmatch(r"[1-9][0-9]{0,8}", pmid_key) is None:
            raise ValueError(f"Atomic effect requires an explicit numeric-string PMID: {rec_key}")
        if rec_key.startswith("pmid") and re.match(r"pmid([0-9]+)_", rec_key) and re.match(r"pmid([0-9]+)_", rec_key).group(1) != pmid_key:
            raise ValueError(f"Atomic effect ID/PMID identity mismatch: {rec_key}")
        try:
            canonical_row = json.dumps(eff, sort_keys=True, separators=(",", ":"), allow_nan=False)
        except (ValueError, TypeError) as exc:
            raise ValueError(f"Atomic effect must contain finite JSON values: {rec_key}") from exc
        if rec_key in seen_effect_records:
            if seen_effect_records[rec_key] != canonical_row:
                raise ValueError(f"Conflicting duplicate atomic effect ID: {rec_key}")
            duplicate_exact_effect_records_skipped += 1
            continue
        seen_effect_records[rec_key] = canonical_row
        unique_effect_ids.add(rec_key)
        superseded = eff.get("superseded_by_pmid")
        if superseded is not None and (not isinstance(superseded, str) or re.fullmatch(r"[1-9][0-9]{0,8}", superseded) is None):
            raise ValueError(f"Invalid superseded_by_pmid identity: {rec_key}")
        source_type = eff.get("source_text_type")
        if source_type not in allowed_source_types:
            raise ValueError(f"Atomic effect requires a validated source_text_type: {rec_key}")
        if source_type in {"Citation_Only_No_Abstract_Indexed", "Project_Summary", "Preprint_Superseded_By_Peer_Reviewed", "Review_or_Commentary"} or eff.get("superseded_by_pmid"):
            excluded_effect_ids.add(rec_key)
            excluded_study_pmids.add(pmid_key)
            continue
        focal_text = eff.get("focal_factor_X")
        direction = eff.get("effect_direction")
        penalty = eff.get("secretome_or_differentiation_penalty_observed", False)
        if not isinstance(focal_text, str):
            raise ValueError(f"Atomic effect focal_factor_X must be a string: {rec_key}")
        if direction not in {"Protective_or_Improved", "Deleterious_or_Impaired", "Neutral_or_NonInferior", "Descriptive_or_Unoriented"}:
            raise ValueError(f"Atomic effect requires a canonical effect_direction: {rec_key}")
        if type(penalty) is not bool:
            raise ValueError(f"Atomic effect penalty flag must be a boolean: {rec_key}")
        focal_text = focal_text.upper()
        is_prot = direction == "Protective_or_Improved"
        is_pen = penalty or direction == "Deleterious_or_Impaired"
        for g in canonical_gene_aliases:
            if token_regexes[g].search(focal_text):
                gene_study_sets[g]["total"].add(pmid_key)
                if is_prot:
                    gene_study_sets[g]["protective"].add(pmid_key)
                if is_pen:
                    gene_study_sets[g]["penalty"].add(pmid_key)
    if len(unique_effect_ids) == 0:
        raise ValueError(f"Ring-1 atomic effects file is empty (0 records): {eff_file}")
    canonical_gene_effect_counts: Dict[str, Dict[str, int]] = {
        g: {k: len(v) for k, v in sdict.items()} for g, sdict in gene_study_sets.items()
    }
    gene_effect_counts = {legacy: copy.deepcopy(canonical_gene_effect_counts[canonical])
                          for legacy, canonical in legacy_gene_keys.items()}

    # Verify construct ledger architecture and promoter/CDS orientation across Arm 1B, Arm 1A, and Locus 3 (closes 069 & 113)
    grammar_audit = verify_construct_part_grammar(construct_verification)
    if not grammar_audit["all_construct_grammars_verified"]:
        raise ValueError(f"Construct grammar validation failed: {grammar_audit}")
    arm1b_constitutive_cd47_verified = grammar_audit["arm1b_constitutive_cd47_verified"]
    arm1b_sense_hlae_verified = grammar_audit["arm1b_sense_hlae_verified"]
    arm1a_bicistronic_verified = grammar_audit["arm1a_bicistronic_verified"]
    locus3_bicistronic_verified = grammar_audit["locus3_bicistronic_verified"]

    # Validate consumed calibration inputs before applying bounded prior transforms.
    # Invalid values must not be converted into plausible output by min/max clamps.
    def calibration_number(value: Any, label: str, is_tpm: bool = False) -> float:
        if isinstance(value, bool) or not isinstance(value, (int, float)):
            raise ValueError(f"{label} must be a finite numeric value, not a boolean or numeric string")
        try:
            numeric = float(value)
        except (ValueError, OverflowError) as exc:
            raise ValueError(f"{label} exceeds the finite numeric domain") from exc
        if not math.isfinite(numeric):
            raise ValueError(f"{label} must be finite")
        if is_tpm and not 0.0 <= numeric <= 1_000_000.0:
            raise ValueError(f"{label} TPM must be in [0, 1000000]")
        return numeric

    gtex = ref.get("gtex_v8_v10_human_tissue_expression", {})
    screen = ref.get("encode_screen_2456_biosample_expression", {})
    try:
        b2m_pancreas_tpm = calibration_number(gtex["B2M"]["pancreas_median_tpm"], "GTEx B2M pancreas", True)
        cd47_pancreas_tpm = calibration_number(gtex["CD47"]["pancreas_median_tpm"], "GTEx CD47 pancreas", True)
        cxcl10_screen = screen["CXCL10"]
        cxcl10_screen_key = ("max_tpm_across_encode_biosamples" if "max_tpm_across_encode_biosamples" in cxcl10_screen
                             else "all_biosamples_max_tpm")
        cxcl10_encode_biosample_max_tpm = calibration_number(cxcl10_screen[cxcl10_screen_key], "ENCODE CXCL10 maximum", True)
        cxcl10_isre_top_score = calibration_number(
            motif_scans["CXCL10_promoter_chr4_76023197_76023797"]["top_jaspar_pwm_hits"]["MA0137.3_STAT1"]["top_hits"][0]["log2_odds_score"],
            "CXCL10 STAT1 PWM score")
        b2m_isre_top_score = calibration_number(
            motif_scans["B2M_promoter_chr15_44711217_44711817"]["top_jaspar_pwm_hits"]["MA0050.2_IRF1"]["top_hits"][0]["log2_odds_score"],
            "B2M IRF1 PWM score")
    except (KeyError, IndexError, TypeError) as exc:
        raise ValueError("Missing or malformed consumed GTEx/ENCODE/PWM calibration input") from exc

    # Strictly positive softplus motif activation transforms so negative log2_odds_score never yields <= 0 protein/secretion (closes 074 & 112)
    cxcl10_motif_activation = min(1.5, math.log1p(math.exp(max(-20.0, min(25.0, cxcl10_isre_top_score)))) / 20.0)
    b2m_motif_activation = min(1.5, math.log1p(math.exp(max(-20.0, min(25.0, b2m_isre_top_score)))) / 20.0)

    # Ring-1 empirical evidence weight modifiers indexed continuously by deduplicated directional study PMIDs
    # across 11 canonical targets (12 deprecated display keys; aliases count once).
    # Note (AUDIT-REF; DEC-071): ring1_evidence_weight = min(1.0, max(0.05, directional_study_total / 148.0))
    # is an engineering prior-shrinkage multiplier that couples Layer-2 prior projections to corpus completeness
    # (evaluating to 112/148 = 0.756757 on the live 112-count directional corpus vs 1.0 at the 148-study saturation ceiling),
    # not a physical biophysical parameter; wet-lab Gate 0A/0B/0C release thresholds (200k resting / 180k post-stress CD47,
    # 15k resting / 50k IFN-g HLA-E, >= 0.30 uM Hour-0 SERPINB9) remain fixed absolute physical floors independent of corpus size.
    cd47_prot_studies_n = min(gene_effect_counts["CD47"]["protective"], 25)
    cd47_pen_studies_n = min(gene_effect_counts["CD47"]["penalty"], 10)
    tyk2_pen_studies_n = min(gene_effect_counts["TYK2"]["penalty"], 10)
    directional_study_total = sum(c["protective"] + c["penalty"] for c in canonical_gene_effect_counts.values())
    ring1_evidence_weight = round(min(1.0, max(0.05, directional_study_total / 148.0)), 6)
    effects_corpus_status = (
        "PASS_FULL_DIRECTIONAL_EVIDENCE_CORPUS_VERIFIED"
        if directional_study_total >= 100
        else (
            "PARTIAL_EVIDENCE_CORPUS"
            if directional_study_total >= 10
            else "MINIMAL_SUBSET_EVIDENCE_CORPUS_PRIOR_WEIGHTED"
        )
    )

    # Monte Carlo sampler helper (deterministic seed)
    rng = random.Random(20261023)

    def mc_interval(mean: float, sd: float, lo_clip: float = 0.0, hi_clip: float = 1e9, n_draws: int = 1000) -> Dict[str, float]:
        samples = sorted(min(hi_clip, max(lo_clip, rng.gauss(mean, sd))) for _ in range(n_draws))
        return summarize_prior_draws(samples)

    # Reference baseline counts (47,919 CD47 and 18,000 HLA-E molecules/cell) are anchored at
    # canonical GTEx pancreas median TPMs (CD47=38.4, B2M=243.4, where native surface HLA-E is
    # scaled by rate-limiting B2M partner TPM because HLA-E TPM is absent from the 6-gene GTEx table;
    # ratio=1.0 on canonical inputs and propagates proportionally under expression perturbation tests):
    basal_cd47_wt = max(0.0, 47919.0 * (cd47_pancreas_tpm / 38.4))
    basal_hlae_wt = max(0.0, 18000.0 * (b2m_pancreas_tpm / 243.4)) if b2m_pancreas_tpm > 0 else 0.0
    raw_eef1a_boost = 1.0 + 5.2418456 * ring1_evidence_weight
    eef1a_arm1b_cd47_mult = round(raw_eef1a_boost if arm1b_constitutive_cd47_verified else 1.0, 6)
    eta_skip = 0.88  # Assigned downstream-expression prior; not cassette-specific measured skipping (PMID:28526819).
    eta_2a_skipping = eta_skip
    eef1a_arm1a_cd47_mult = round(raw_eef1a_boost * eta_skip if arm1a_bicistronic_verified else 1.0, 6)
    arm1b_hlae_mult = round((4.8 + 0.4 * ring1_evidence_weight) * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3)
    arm1a_hlae_mult = round(4.9 * ring1_evidence_weight if arm1a_bicistronic_verified else 0.0, 3)
    cxcl10_inducible_fold = max(1e-4, (cxcl10_encode_biosample_max_tpm / 100.0) * cxcl10_motif_activation * ring1_evidence_weight)
    grn_edges = [
        {"source_tf": "STAT1_IRF1", "target": "TYK2_KRAS_MAPK", "stage": "Stage_4_to_Stage_6", "effect": "TYK2 loss derepresses KRAS/MAPK and attenuates NEUROG3+ emergence (-46.3%, PMID:36289205)"},
        {"source_tf": "PDX1_NKX6-1", "target": "NEUROG3", "stage": "Stage_4_PP2_to_Stage_6_EP", "effect": "Endocrine commitment bottleneck"},
        {"source_tf": "NEUROG3_FEV", "target": "MAFA_INS_UCN3", "stage": "Stage_6_EP_to_Stage_7_SC_Beta", "effect": "Beta-cell maturation (-32.0% INS+ under TYK2-/-, PMID:36289205)"},
    ]

    # Stage-specific priors across all 6 HIP-Core factors (X1..X6), Scenario A (Arm 1B & Arm 1A),
    # Scenario B (B2 TYK2 P1104A 5-locus & B1 TYK2-/- 6-locus), and UP421 cadaveric benchmark (closes 017, 043, 053, 074, 113):
    # Note (AUDIT-REF): Chandra et al. 2022 (PMID:36289205 Source Data Fig 2c, 2i, 2k) observed:
    #   - Stage 5 NEUROG3+ immunostaining (Fig 2c): 28.81% WT vs 15.45% TYK2-KO (-46.37% relative reduction)
    #   - Stage 7 INS+ flow cytometry (Fig 2i): 29.78% WT vs 21.90% TYK2-KO (-26.46% relative reduction)
    #   - Stage 7 INS+ immunostaining (Fig 2k): 23.73% WT vs 16.01% TYK2-KO (-32.54% relative reduction)
    # The absolute fractions below (0.678 -> 0.364 [-46.31%] and 0.600 -> 0.408 [-32.00%]) apply those published
    # relative reductions to OpenIslet's assigned Stage-0 WT model baselines (0.678 and 0.600).
    tyk2_ko_s6_mean = round(0.364 - 0.004 * (tyk2_pen_studies_n - 1), 3)
    tyk2_ko_s7_mean = round(0.408 - 0.004 * (tyk2_pen_studies_n - 1), 3)

    genotype_specs = [
        {
            "genotype_id": "WT_UNEDITED_CONTROL",
            "hip_core_factor_vector_X1_to_X6": [-1, -1, -1, -1, -1, -1],
            "is_hpsc_differentiated": True,
            "description": "Unedited WT hPSC line (Stage 0 -> Stage 7 tri-hormonal + isogenic iEC)",
            "stage4_mean": 0.840, "stage4_sd": 0.035,
            "stage6_mean": 0.678, "stage6_sd": 0.042,
            "beta_yield_mean": 0.600, "beta_yield_sd": 0.040,
            "gsis_mean": 3.40, "gsis_sd": 0.32,
            "iec_branch_mean": 1.00, "iec_branch_sd": 0.08,
            "cd47_mult": 1.0, "hlae_mult": 1.0, "hlae_resting_unstim_mult": 1.0,
            "cxcl10_ko": False, "locus3_ki": False,
            "nkg2a_lysis_mean": 4.2, "kir_lysis_mean": 5.1, "allo_ctl_mean": 88.5, "auto_ctl_mean": 91.2,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:36289205",
                    "journal": "Nature Communications (Chandra et al. 2022, reference GEO accession GSE190726)",
                    "endpoint": "Assigned OpenIslet WT hPSC Stage 4 PP2 (0.840), Stage 5/6 NEUROG3+ endocrine progenitor (0.678), and Stage 7 SC-beta (0.600) model baselines, paired with Chandra et al. 2022 Source Data relative TYK2-/- perturbation ratios (Fig 2c S5 NEUROG3+ immunostaining 28.81% WT vs 15.45% KO [-46.37%]; Fig 2i S7 INS+ flow 29.78% WT vs 21.90% KO [-26.46%]; Fig 2k S7 INS+ immunostaining 23.73% WT vs 16.01% KO [-32.54%]; raw GEO matrix not refitted)",
                }
            ],
        },
        {
            "genotype_id": "SCENARIO_A_ARM_1B_UNIVERSAL_LEAN_4LOCUS",
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, -1, -1],
            "construct_arm": "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01",
            "is_hpsc_differentiated": True,
            "description": "B2M::[Bidir CD47-IgV-GPI <- EEF1A1_core | Syn_5xISRE -> HLA-E*01:03(VMAPRTLVL) full tail] + CIITA-/- + CXCL10::SERPINB9-GSG-P2A-PD-L1 + AAVS1-[455bp-CBX3-A2UCOE]-iCasp9",
            "stage4_mean": round(0.812 + 0.014 * ring1_evidence_weight, 3), "stage4_sd": 0.038,
            "stage6_mean": round(0.655 + 0.012 * ring1_evidence_weight, 3), "stage6_sd": 0.044,
            "beta_yield_mean": round(0.550 + 0.040 * ring1_evidence_weight, 4), "beta_yield_sd": 0.045,
            "gsis_mean": round(3.05 + 0.27 * ring1_evidence_weight, 3), "gsis_sd": 0.35,
            "iec_branch_mean": 0.97, "iec_branch_sd": 0.08,
            "cd47_mult": eef1a_arm1b_cd47_mult,
            "hlae_mult": arm1b_hlae_mult,
            "hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 3.9, "kir_lysis_mean": 6.5, "allo_ctl_mean": 2.9, "auto_ctl_mean": 4.2,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:38508139",
                    "journal": "Cell Reports Medicine (Xu et al. 2024)",
                    "endpoint": "Truncated CD47-IgV preserves endothelial angiogenesis and blocks SIRPa+ macrophage phagocytosis without full-length CD47-TSP1 angiogenesis inhibition",
                },
                {
                    "pmid": "PMID:36055241",
                    "journal": "Stem Cell Reports (Sintov et al. 2022)",
                    "endpoint": "CXCL10 knockout in human SC-islets prevents CXCR3+ immune recruitment",
                },
            ],
        },
        {
            "genotype_id": "SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR",
            "genotype_aliases": ["SCENARIO_A_ARM_1A_TPT2A_COMPARATOR"],
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, -1, -1],
            "construct_arm": "LOCUS1_ARM1A_TPT2A_BICISTRONIC",
            "is_hpsc_differentiated": True,
            "description": "B2M::HLA-E*01:03(VMAPRTLVL)-GSG-P2A-CD47-IgV-GPI (constitutive EEF1A1 bicistronic 2A comparator to Arm 1B; eta_skip = 0.88)",
            "stage4_mean": round(0.812 + 0.010 * ring1_evidence_weight, 3), "stage4_sd": 0.038,
            "stage6_mean": round(0.655 + 0.008 * ring1_evidence_weight, 3), "stage6_sd": 0.045,
            "beta_yield_mean": round(0.550 + 0.030 * ring1_evidence_weight, 4), "beta_yield_sd": 0.045,
            "gsis_mean": round(3.05 + 0.20 * ring1_evidence_weight, 3), "gsis_sd": 0.36,
            "iec_branch_mean": 0.95, "iec_branch_sd": 0.09,
            "cd47_mult": eef1a_arm1a_cd47_mult,
            "hlae_mult": arm1a_hlae_mult,
            "hlae_resting_unstim_mult": arm1a_hlae_mult,
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 4.3, "kir_lysis_mean": 7.4, "allo_ctl_mean": 3.1, "auto_ctl_mean": 4.5,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:28526819",
                    "journal": "Scientific Reports (Liu et al. 2017)",
                    "endpoint": "Position- and construct-dependent 2A expression in reporter/cardiac reprogramming systems; eta_skip=0.88 is an assigned OpenIslet sensitivity prior, not a measured skipping efficiency for these hPSC cassettes. Exact uncleaved read-through is unmeasured.",
                }
            ],
        },
        {
            "genotype_id": "HIP_CORE_FULL_LENGTH_CD47_WT_COMPARATOR",
            "hip_core_factor_vector_X1_to_X6": [1, -1, 1, -1, -1, -1],
            "is_hpsc_differentiated": True,
            "description": "Same as Scenario A but expressing full-length 5-TM CD47-WT (323 aa, X2 = -1) instead of CD47-IgV-GPI",
            "stage4_mean": 0.810, "stage4_sd": 0.040,
            "stage6_mean": 0.640, "stage6_sd": 0.048,
            "beta_yield_mean": 0.550, "beta_yield_sd": 0.050,
            "gsis_mean": round(2.55 - 0.015 * cd47_pen_studies_n * ring1_evidence_weight, 3), "gsis_sd": 0.38,
            "iec_branch_mean": 0.58, "iec_branch_sd": 0.10,
            "cd47_mult": round(eef1a_arm1b_cd47_mult * 0.92, 4),
            "hlae_mult": arm1a_hlae_mult,
            "hlae_resting_unstim_mult": arm1a_hlae_mult,
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 4.1, "kir_lysis_mean": 6.8, "allo_ctl_mean": 3.1, "auto_ctl_mean": 4.4,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:38508139",
                    "journal": "Cell Reports Medicine (Xu et al. 2024)",
                    "endpoint": "Full-length CD47 overexpression impairs endothelial tube formation/angiogenesis via TSP1-CD47 signaling, rescued by CD47-IgV",
                },
                {
                    "pmid": "PMID:37820008",
                    "journal": "Science Translational Medicine (Ghimire et al. 2023)",
                    "endpoint": "Full-length CD47 5-TM signaling tonically limits beta-cell cAMP/calcium insulin exocytosis and GSIS (Graveyard Rule R02 counter-evidence)",
                },
            ],
        },
        {
            "genotype_id": "HIP_CORE_X4_TYK2_KO_PERTURBATION",
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, 1, -1, -1],
            "is_hpsc_differentiated": True,
            "description": "Scenario A + constitutive TYK2-/- knockout (X4 = +1; applies Chandra et al. 2022 PMID:36289205 relative reductions [Fig 2c S5 NEUROG3+ 28.81% -> 15.45%, -46.37%; Fig 2k S7 INS+ immunostaining 23.73% -> 16.01%, -32.54%; Fig 2i S7 INS+ flow 29.78% -> 21.90%, -26.46%] to the assigned OpenIslet WT baseline: Stage 4 PP2 0.816 vs 0.840 WT, Stage 5/6 NEUROG3+ EP 0.364 vs 0.678 WT [-46.31%], Stage 7 INS+ SC-beta yield 0.408 vs 0.600 WT [-32.00%])",
            "stage4_mean": 0.816, "stage4_sd": 0.038,
            "stage6_mean": tyk2_ko_s6_mean, "stage6_sd": 0.055,
            "beta_yield_mean": tyk2_ko_s7_mean, "beta_yield_sd": 0.055,
            "gsis_mean": 3.25, "gsis_sd": 0.38,
            "iec_branch_mean": 0.96, "iec_branch_sd": 0.08,
            "cd47_mult": eef1a_arm1b_cd47_mult,
            "hlae_mult": round(4.5 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "hlae_resting_unstim_mult": round(0.75 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 4.2, "kir_lysis_mean": 6.7, "allo_ctl_mean": 2.5, "auto_ctl_mean": 3.6,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:36289205",
                    "journal": "Nature Communications (Chandra et al. 2022, PMC9606380, reference GEO accession GSE190726)",
                    "endpoint": "Chandra et al. 2022 Source Data relative TYK2-/- reductions (Fig 2c S5 NEUROG3+ immunostaining 28.81% WT vs 15.45% KO [-46.37%]; Fig 2k S7 INS+ immunostaining 23.73% WT vs 16.01% KO [-32.54%]; Fig 2i S7 INS+ flow 29.78% WT vs 21.90% KO [-26.46%]) rescaled onto assigned OpenIslet WT baselines (Stage 4 PP2 0.816 vs 0.840 WT; Stage 5/6 NEUROG3+ 0.364 vs 0.678 WT [-46.31%]; Stage 7 SC-beta 0.408 vs 0.600 WT [-32.00%]) via KRAS/MAPK derepression, while mature SC-islets retain GSIS",
                }
            ],
        },
        {
            "genotype_id": "HIP_CORE_X5_TXNIP_KO_MODIFIER",
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, 1, -1],
            "is_hpsc_differentiated": True,
            "description": "Scenario A + isolated TXNIP-/- (X5 = +1, X6 = -1; tests oxidative/thioredoxin stress protection without RNLS knockout)",
            "stage4_mean": 0.822, "stage4_sd": 0.038,
            "stage6_mean": 0.660, "stage6_sd": 0.045,
            "beta_yield_mean": 0.575, "beta_yield_sd": 0.048,
            "gsis_mean": 3.30, "gsis_sd": 0.35,
            "iec_branch_mean": 0.96, "iec_branch_sd": 0.08,
            "cd47_mult": eef1a_arm1b_cd47_mult,
            "hlae_mult": arm1b_hlae_mult,
            "hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 3.9, "kir_lysis_mean": 6.5, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.7,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:40320524",
                    "journal": "Stem Cell Research & Therapy (Traini et al. 2025)",
                    "endpoint": "TXNIP loss in H1-hESCs increased proliferation; derived SC-islets retained differentiation and glucose responsiveness but showed no enhanced glycemic control or GSIS under the tested conditions. The numerical OpenIslet profile remains an unmeasured prior, not a reported full-stack benefit.",
                }
            ],
        },
        {
            "genotype_id": "HIP_CORE_X6_RNLS_KO_COUNTER_CONTROL",
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, -1, 1],
            "is_hpsc_differentiated": True,
            "description": "Scenario A + isolated RNLS-/- (X5 = -1, X6 = +1; Graveyard Rule R04 counter-control testing human SC-islet basal glycolysis/GSIS trade-off)",
            "stage4_mean": 0.815, "stage4_sd": 0.040,
            "stage6_mean": 0.642, "stage6_sd": 0.048,
            "beta_yield_mean": 0.545, "beta_yield_sd": 0.052,
            "gsis_mean": 2.95, "gsis_sd": 0.39,
            "iec_branch_mean": 0.94, "iec_branch_sd": 0.09,
            "cd47_mult": eef1a_arm1b_cd47_mult,
            "hlae_mult": arm1b_hlae_mult,
            "hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 4.0, "kir_lysis_mean": 6.6, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.2,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:32719542",
                    "journal": "Nature Metabolism (Cai et al. 2020)",
                    "endpoint": "RNLS knockout protects beta cells against ER stress/autoimmune CTL killing in vivo but shifts basal metabolic tone in human SC-islets (Graveyard Rule R04)",
                }
            ],
        },
        {
            "genotype_id": "HIP_CORE_X5_TXNIP_KO_X6_RNLS_KO_METABOLIC_SHIELD",
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, -1, 1, 1],
            "is_hpsc_differentiated": True,
            "description": "Scenario A + combined TXNIP-/- (X5 = +1) + RNLS-/- (X6 = +1) metabolic/ER-stress shield comparator",
            "stage4_mean": 0.812, "stage4_sd": 0.040,
            "stage6_mean": 0.635, "stage6_sd": 0.050,
            "beta_yield_mean": 0.540, "beta_yield_sd": 0.055,
            "gsis_mean": 3.18, "gsis_sd": 0.38,
            "iec_branch_mean": 0.94, "iec_branch_sd": 0.09,
            "cd47_mult": eef1a_arm1b_cd47_mult,
            "hlae_mult": round(5.1 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "hlae_resting_unstim_mult": round(0.80 * ring1_evidence_weight if arm1b_sense_hlae_verified else 0.0, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 4.0, "kir_lysis_mean": 6.6, "allo_ctl_mean": 2.8, "auto_ctl_mean": 3.1,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:32719542",
                    "journal": "Nature Metabolism (Cai et al. 2020)",
                    "endpoint": "RNLS single-target beta-cell protection study; the combined TXNIP/RNLS interaction is a planned HIP-Core comparison, not a measured combination in this reference",
                }
            ],
        },
        {
            "genotype_id": "SCENARIO_B_HLAC_RETAINED_TYK2_P1104A_SUPERDONOR",
            "genotype_aliases": ["SCENARIO_B2_HLAC_RETAINED_TYK2_P1104A_5LOCUS"],
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, 0, -1, -1],
            "is_hpsc_differentiated": True,
            "description": "Scenario B2 (5-locus Plan B): HLA-A-/- HLA-B-/- HLA-C(retained KIR-matched) + CIITA-/- + TYK2(P1104A rs34536443 catalytic hypomorph, preserving Stage 5/6 scaffolding) + CXCL10::SERPINB9-P2A-PD-L1 + AAVS1-iCasp9",
            "stage4_mean": 0.832, "stage4_sd": 0.036,
            "stage6_mean": 0.652, "stage6_sd": 0.044,
            "beta_yield_mean": 0.560, "beta_yield_sd": 0.050,
            "gsis_mean": 3.28, "gsis_sd": 0.35,
            "iec_branch_mean": 0.97, "iec_branch_sd": 0.08,
            "cd47_mult": 1.8, "hlae_mult": round(3.8 * ring1_evidence_weight, 3), "hlae_resting_unstim_mult": round(3.8 * ring1_evidence_weight, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 3.5, "kir_lysis_mean": 2.8, "allo_ctl_mean": 6.2, "auto_ctl_mean": 8.4,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:30853558",
                    "journal": "Cell Stem Cell (Xu et al. 2019)",
                    "endpoint": "HLA-A/B bi-allelic disruption with HLA-C retention engages inhibitory KIR2DL1/2/3+ NK cells across HLA-C-matched recipients",
                }
            ],
        },
        {
            "genotype_id": "SCENARIO_B1_HLAC_RETAINED_TYK2_KO_6LOCUS",
            "genotype_aliases": ["SCENARIO_B_HLAC_RETAINED_TYK2_KO_INS_EDITED"],
            "hip_core_factor_vector_X1_to_X6": [1, 1, 1, 1, -1, -1],
            "is_hpsc_differentiated": True,
            "description": "Scenario B1 (6-locus comparator): HLA-A-/- HLA-B-/- HLA-C(retained) + CIITA-/- + complete TYK2-/- knockout + INS-epitope edit + CXCL10::SERPINB9-P2A-PD-L1 + AAVS1-iCasp9 (incurs Chandra 2022 -46.3% Stage 6 EP and -32.0% Stage 7 yield penalty plus extra editing step)",
            "stage4_mean": 0.816, "stage4_sd": 0.038,
            "stage6_mean": tyk2_ko_s6_mean, "stage6_sd": 0.055,
            "beta_yield_mean": tyk2_ko_s7_mean, "beta_yield_sd": 0.055,
            "gsis_mean": 3.12, "gsis_sd": 0.40,
            "iec_branch_mean": 0.95, "iec_branch_sd": 0.08,
            "cd47_mult": 1.8, "hlae_mult": round(3.6 * ring1_evidence_weight, 3), "hlae_resting_unstim_mult": round(3.6 * ring1_evidence_weight, 3),
            "cxcl10_ko": True, "locus3_ki": locus3_bicistronic_verified,
            "nkg2a_lysis_mean": 3.6, "kir_lysis_mean": 2.9, "allo_ctl_mean": 5.8, "auto_ctl_mean": 4.9,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:36289205",
                    "journal": "Nature Communications (Chandra et al. 2022, PMC9606380)",
                    "endpoint": "Complete TYK2-/- in Scenario B1 incurs -46.3% Stage 5/6 NEUROG3+ and -32.0% Stage 7 SC-beta yield reduction relative to WT, motivating Scenario B2 TYK2 P1104A hypomorph",
                }
            ],
        },
        {
            "genotype_id": "SANA_UP421_CADAVERIC_PRIMARY_ISLET_BENCHMARK",
            "hip_core_factor_vector_X1_to_X6": [-1, -1, -1, -1, -1, -1],
            "is_hpsc_differentiated": False,
            "description": "Primary human cadaveric donor islets transduced with B2M-/- + CIITA-/- + LV-CAG-CD47(WT) (Carlsson et al. 2025 NEJM PMID:40757665; NOT an hPSC Stage 0->7 product)",
            "stage4_mean": None, "stage4_sd": None,
            "stage6_mean": None, "stage6_sd": None,
            "beta_yield_mean": None, "beta_yield_sd": None,
            "gsis_mean": 2.65, "gsis_sd": 0.42,
            "iec_branch_mean": 0.62, "iec_branch_sd": 0.11,
            "cd47_mult": 6.5, "hlae_mult": 0.0, "hlae_resting_unstim_mult": 0.0,
            "cxcl10_ko": False, "locus3_ki": False,
            "nkg2a_lysis_mean": 13.5, "kir_lysis_mean": 7.1, "allo_ctl_mean": 3.5, "auto_ctl_mean": 17.8,
            "empirical_literature_anchors": [
                {
                    "pmid": "PMID:40757665",
                    "journal": "New England Journal of Medicine (Carlsson et al. 2025)",
                    "endpoint": "First-in-human survival and C-peptide function of hypoimmune-edited primary cadaveric allogeneic islets without immunosuppression",
                }
            ],
        },
    ]

    perturbation_profiles = []
    for spec in genotype_specs:
        is_hpsc = spec["is_hpsc_differentiated"]
        cd47_mols = max(0, int(round(basal_cd47_wt * spec["cd47_mult"])))
        hlae_mols = max(0, int(round(basal_hlae_wt * spec["hlae_mult"])))
        hlae_resting_mols = max(0, int(round(basal_hlae_wt * spec["hlae_resting_unstim_mult"])))
        hlae_hour0_gap_mols = max(0, hlae_mols - hlae_resting_mols)
        resting_hlae_below_15k = bool(hlae_resting_mols < 15000)
        if resting_hlae_below_15k and hlae_mols >= 15000:
            hour0_protection_status = (
                f"IFN_INDUCIBLE_HLAE_RESTING_BELOW_15K_THRESHOLD ({hlae_resting_mols} < 15,000 molecules/cell at Hour 0, rising to "
                f"{hlae_mols} molecules/cell upon 24h IFN-gamma licensing); constitutive "
                f"EEF1A1 -> CD47-IgV-GPI ({cd47_mols} molecules/cell) is an unvalidated independent shield hypothesis, not demonstrated compensation for this gap; requires direct resting unstimulated "
                "vs IFN-gamma-licensed primary NK killing validation (Decision Experiment #2)"
            )
        elif not resting_hlae_below_15k:
            hour0_protection_status = (
                f"CONSTITUTIVE_HOUR0_HLAE_ABOVE_15K_THRESHOLD ({hlae_resting_mols} >= 15,000 molecules/cell at Hour 0; CD47 = {cd47_mols} molecules/cell)"
            )
        elif hlae_resting_mols > 0 or hlae_mols > 0:
            hour0_protection_status = (
                f"HLAE_BELOW_ASSUMED_THRESHOLD ({hlae_resting_mols} resting / {hlae_mols} IFN-gamma-stimulated molecules/cell < 15,000 threshold; "
                f"CD47 prior = {cd47_mols} molecules/cell; AUDIT-REF)"
            )
        else:
            hour0_protection_status = (
                f"HLAE_ABSENT ({hlae_resting_mols} molecules/cell; CD47 prior {cd47_mols} molecules/cell does not establish missing-self protection)"
            )
        cxcl10_pg = 0.0 if spec["cxcl10_ko"] else max(0.0, round(70.0 * cxcl10_inducible_fold, 1))
        serpinb9_uM = max(0.0, round(0.215 * cxcl10_inducible_fold, 2)) if spec["locus3_ki"] else 0.08
        pdl1_pre_skip_prior = max(0.0, 6400.0 * cxcl10_inducible_fold) if spec["locus3_ki"] else None
        pdl1_mols = max(0, int(round(pdl1_pre_skip_prior * eta_2a_skipping))) if spec["locus3_ki"] else 8500

        if is_hpsc:
            s4_draws = sorted(min(0.95, max(0.05, rng.gauss(spec["stage4_mean"], spec["stage4_sd"]))) for _ in range(1000))
            s6_draws = sorted(min(0.95, max(0.05, rng.gauss(spec["stage6_mean"], spec["stage6_sd"]))) for _ in range(1000))
            s7_draws = sorted(min(0.90, max(0.05, rng.gauss(spec["beta_yield_mean"], spec["beta_yield_sd"]))) for _ in range(1000))
            s4_ci: Any = summarize_prior_draws(s4_draws)
            s6_ci: Any = summarize_prior_draws(s6_draws)
            s7_ci: Any = summarize_prior_draws(s7_draws)
        else:
            s4_ci = "not_applicable_primary_cadaveric_islets"
            s6_ci = "not_applicable_primary_cadaveric_islets"
            s7_ci = "not_applicable_primary_cadaveric_islets"

        prof: Dict[str, Any] = {
            "genotype_id": spec["genotype_id"],
            "genotype_aliases": spec.get("genotype_aliases", []),
            "evidence_class": "literature_anchored_stage_specific_prior_with_independent_monte_carlo_bands_not_direct_wetlab_observation",
            "hip_core_factor_vector_X1_to_X6": spec["hip_core_factor_vector_X1_to_X6"],
            "description": spec["description"],
            "is_hpsc_stage0_to_stage7_product": is_hpsc,
            "stage4_pp2_nkx61_fraction": spec["stage4_mean"] if is_hpsc else None,
            "stage4_pp2_nkx61_prior_scenario_interval_p10_p90": s4_ci,
            "stage6_neurog3_ep_fraction": spec["stage6_mean"] if is_hpsc else None,
            "stage6_neurog3_ep_prior_scenario_interval_p10_p90": s6_ci,
            "stage7_sc_beta_yield_fraction": spec["beta_yield_mean"] if is_hpsc else None,
            "stage7_sc_beta_yield_prior_scenario_interval_p10_p90": s7_ci,
            "stage7_sc_alpha_yield_fraction": 0.30 if is_hpsc else None,
            "stage7_sc_delta_yield_fraction": 0.10 if is_hpsc else None,
            "gsis_stimulation_index_20mM_vs_2p8mM": spec["gsis_mean"],
            "gsis_prior_scenario_interval_p10_p90": mc_interval(spec["gsis_mean"], spec["gsis_sd"], 1.0, 8.0),
            "iec_cord_branching_index_relative": spec["iec_branch_mean"],
            "iec_cord_branching_prior_scenario_interval_p10_p90": mc_interval(spec["iec_branch_mean"], spec["iec_branch_sd"], 0.1, 1.5),
            "hour0_basal_cd47_molecules_per_cell": cd47_mols,
            "hour0_basal_hlae_molecules_per_cell": hlae_resting_mols,
            "hour0_resting_unstimulated_hlae_molecules_per_cell": hlae_resting_mols,
            "ifng_24h_induced_hlae_molecules_per_cell": hlae_mols,
            "hour0_resting_hlae_vulnerability_gap_molecules_per_cell": hlae_hour0_gap_mols,
            "hour0_resting_hlae_below_15k_nkg2a_threshold": resting_hlae_below_15k,
            "hour0_resting_hlae_meets_25k_release_gate": bool(hlae_resting_mols >= 25000),
            "ifng24h_hlae_meets_25k_release_gate": bool(hlae_mols >= 25000),
            "hour0_hlae_and_cd47_protection_status": hour0_protection_status,
            "ifng_24h_cxcl10_secretion_pg_ml": cxcl10_pg,
            "hour0_basal_serpinb9_cytosolic_uM": 0.09 if spec["locus3_ki"] else 0.08,
            "hour0_basal_pdl1_molecules_per_cell": 9100 if spec["locus3_ki"] else 8500,
            "serpinb9_induction_half_time_hours": 6.0 if spec["locus3_ki"] else None,
            "hour0_single_hit_gzmb_bolus_coverage_ratio_at_0p20uM_si_1p5": round((0.09 if spec["locus3_ki"] else 0.08) / (1.5 * 0.20), 4),
            "hour0_kinetic_race_status": (
                "UNSTIMULATED_HOUR0_SERPINB9_BELOW_0P30UM_BOLUS_FLOOR_REQUIRES_GATE_0C_KINETIC_OR_L3_BFB_BASAL_FLOOR"
                if spec["locus3_ki"]
                else "NO_LOCUS3_TRANSGENE"
            ),
            "ifng_24h_serpinb9_cytosolic_uM": serpinb9_uM,
            "ifng_24h_pdl1_molecules_per_cell": pdl1_mols,
            "ifng_24h_pdl1_before_2a_skip_prior_molecules_per_cell": pdl1_pre_skip_prior,
            "pdl1_downstream_2a_skip_factor_prior": eta_2a_skipping if spec["locus3_ki"] else None,
            "surface_density_endpoint_evidence_class": "UNVALIDATED_PRIOR_REQUIRES_TIMEPOINT_AND_LINEAGE_MATCHED_FLOW_CYTOMETRY",
            "primary_nk_specific_lysis_pct_cd94_nkg2a_pos": spec["nkg2a_lysis_mean"],
            "primary_nk_specific_lysis_pct_kir_pos_nkg2a_neg": spec["kir_lysis_mean"],
            "alloreactive_cd8_ctl_lysis_pct": spec["allo_ctl_mean"],
            "autoreactive_ppi_cd8_ctl_lysis_pct": spec["auto_ctl_mean"],
            "empirical_literature_anchors": spec["empirical_literature_anchors"],
        }
        prof["uncertainty_semantics"] = "independent prior scenario draws; no posterior fitting or held-out validation"
        if spec["genotype_id"].startswith("SCENARIO_B"):
            product_id = "ISLET1_B1_6LOCUS_TYK2_KO_INS" if spec["genotype_id"].startswith("SCENARIO_B1_") else "ISLET1_B2_5LOCUS_TYK2_PE"
            contract = get_product_definition(product_id, root=REPO_ROOT, require_staged_fastas=False)
            prof.update(product_definition_id=product_id, product_definition=contract,
                        exact_product_defined=False, source_construct=None,
                        prediction_status="PROVISIONAL_P2A_COMPARATOR_NOT_EXACT_SCENARIO_B_PRODUCT",
                        no_scenario_b_product_benefit_claim=True)
            prof["description"] = ("Provisional P2A experimental comparator; no exact Scenario-B product prediction. "
                "The named family contract proposes a 2A-free cassette whose donor ledger is not materialized. " + spec["description"])
        elif spec["genotype_id"] == "SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR":
            prof["product_definition_id"] = "ISLET1_A4_ARM1A"
        else:
            prof["product_definition_id"] = "ISLET1_A4_ARM1B" if spec["genotype_id"] == "SCENARIO_A_ARM_1B_UNIVERSAL_LEAN_4LOCUS" else "REFERENCE_PRIOR_COMPARATOR"
        if prof["product_definition_id"].startswith("ISLET1_A4_"):
            prof["product_definition"] = get_product_definition(
                prof["product_definition_id"], root=REPO_ROOT, require_staged_fastas=False
            )
            prof["source_construct"] = ("LOCUS1_ARM1A_TPT2A_BICISTRONIC" if prof["product_definition_id"].endswith("ARM1A") else "LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01")
            prof["exact_product_defined"] = True
            prof["physical_qualification_status"] = "PREREGISTERED_PENDING"
        elif prof["product_definition_id"] == "REFERENCE_PRIOR_COMPARATOR":
            prof.update(exact_product_defined=False, source_construct=None,
                        prediction_status="REFERENCE_PRIOR_HYPOTHESIS_NOT_AN_EXACT_PRODUCT", product_definition=None)
        if prof.get("product_definition") is not None:
            prof["declared_dsb_locus_count_K"] = prof["product_definition"]["K"]
            prof["declared_base_or_prime_edit_locus_count_B"] = prof["product_definition"]["B"]
        # Compatibility aliases are explicitly prior draws, never posterior credible bands.
        aliases = {}
        for key, value in list(prof.items()):
            if "_prior_scenario_interval_p10_p90" in key:
                old = key.replace("_prior_scenario_interval_p10_p90", "_credible_interval_p10_p90")
                prof[old] = value
                aliases[old] = {"deprecated_alias_of": key, "semantics": "independent prior scenario draws, no posterior fitting or held-out validation"}
        prof["deprecated_uncertainty_aliases"] = aliases
        perturbation_profiles.append(prof)

    by_id = {p["genotype_id"]: p for p in perturbation_profiles}
    wt_profile = by_id["WT_UNEDITED_CONTROL"]
    arm1b_profile = by_id["SCENARIO_A_ARM_1B_UNIVERSAL_LEAN_4LOCUS"]
    tyk2_profile = by_id["HIP_CORE_X4_TYK2_KO_PERTURBATION"]

    l3_bfb_profile_projection = {
        "product_definition_id": "ISLET1_A4_L3_BFB_BASALFLOOR",
        "source_construct": "Locus3_BasalFloor_ScarFree_SERPINB9_PDL1_challenger_muse_r3",
        "donor_length_bp": 4078,
        "donor_sha256": "0a5f714d536cfb427039e50966fbc88cc6f7dbec8252f26bf43f32a359017c7e",
        "hour0_basal_serpinb9_cytosolic_uM": 0.30,
        "ifng_24h_serpinb9_cytosolic_uM": 0.89,
        "sp1_basal_to_ifng24h_ratio": round(0.30 / 0.89, 4),
        "suicide_inhibitor_stoichiometry_si": 1.0,
        "hour0_single_hit_gzmb_bolus_coverage_ratio_at_0p20uM_si_1p0": round(0.30 / (1.0 * 0.20), 4),
        "hour0_single_hit_gzmb_bolus_coverage_ratio_at_0p15uM_standard_bolus_si_1p0": round(0.30 / (1.0 * 0.15), 4),
        "hour0_post_pulse_1_2_3_serpinb9_at_0p15uM_every_2h_uM": [
            round(0.30 - 0.15, 6),
            round(0.30 + (0.15 - 0.30) * (2.0 ** (-1.0 / 3.0)) - 0.15, 6),
            0.0,
        ],
        "pdl1_downstream_2a_skip_factor_prior": None,
        "ifng_24h_pdl1_molecules_per_cell": int(round(6400.0 * cxcl10_inducible_fold)),
        "hour0_kinetic_race_status": "L3_BFB_BASAL_FLOOR_TARGET_0P30UM_CLEARS_SINGLE_AND_2PULSE_0P15UM_BOLUS_EXHAUSTS_AT_PULSE_3_REQUIRES_1P52UM_FOR_12PULSE_HYPOXIA_GATE_0C_KINETIC",
    }
    arm1b_profile["l3_bfb_basalfloor_profile_projection_sonnet55_r4"] = l3_bfb_profile_projection

    tyk2_ifna_orphan_hc_branches = {
        "beta_cell_ipsc_80_to_90pct_ifna_attenuation_branch_pmid_36289205": [0.10, 0.20],
        "human_leukocyte_wt_like_0_to_20pct_ifna_attenuation_branch_pmid_30578352_42268925": [0.80, 1.00],
        "ifng_jak1_jak2_unattenuated_orphan_hc_flux_multiplier_vs_b2m_ko": [0.85, 1.00],
    }
    tyk2_ifna_isre_induction_branches = {
        "beta_cell_ipsc_knockdown_branch_pmid_36289205": [0.15, 0.35],
        "human_leukocyte_wt_like_high_dose_ifna_branch_pmid_30578352_42268925": [0.80, 1.00],
    }
    for prof in perturbation_profiles:
        gid = prof["genotype_id"]
        if "TYK2" in gid:
            is_ko = "KO" in gid
            prof["ifna_dominant_early_flare_branch_predictions_astra6_r4"] = {
                "tyk2_allele_class": "TYK2_KO_BIALLELIC" if is_ko else "TYK2_P1104A_HOMOZYGOUS_PRIME_EDIT",
                "ifng_24h_ctl_synapse_baseline": {
                    "hlae_molecules_per_cell": prof["ifng_24h_induced_hlae_molecules_per_cell"],
                    "serpinb9_cytosolic_uM": prof["ifng_24h_serpinb9_cytosolic_uM"],
                    "pdl1_molecules_per_cell": prof["ifng_24h_pdl1_molecules_per_cell"],
                    "cxcl10_secretion_pg_ml": prof["ifng_24h_cxcl10_secretion_pg_ml"],
                },
                "ifna_early_flare_isre_induction_multiplier_branches": (
                    {"tyk2_ko_abrogated_typeI_ifn_branch_pmid_36289205": [0.05, 0.15]}
                    if is_ko
                    else tyk2_ifna_isre_induction_branches
                ),
                "ifna_early_flare_orphan_hc_flux_multiplier_branches": (
                    {"tyk2_ko_abrogated_typeI_ifn_branch_pmid_36289205": [0.05, 0.15]}
                    if is_ko
                    else tyk2_ifna_orphan_hc_branches
                ),
                "ifna_early_flare_serpinb9_uM_by_branch": (
                    {
                        "tyk2_ko_abrogated_typeI_ifn_branch_pmid_36289205": [
                            round(0.09 + (arm1b_profile["ifng_24h_serpinb9_cytosolic_uM"] - 0.09) * m, 3)
                            for m in [0.05, 0.15]
                        ]
                    }
                    if is_ko
                    else {
                        b_name: [
                            round(0.09 + (arm1b_profile["ifng_24h_serpinb9_cytosolic_uM"] - 0.09) * m, 3)
                            for m in mults
                        ]
                        for b_name, mults in tyk2_ifna_isre_induction_branches.items()
                    }
                ),
                "ifna_early_flare_pdl1_molecules_per_cell_by_branch": (
                    {
                        "tyk2_ko_abrogated_typeI_ifn_branch_pmid_36289205": [
                            int(round(9100 + (arm1b_profile["ifng_24h_pdl1_molecules_per_cell"] - 9100) * m))
                            for m in [0.05, 0.15]
                        ]
                    }
                    if is_ko
                    else {
                        b_name: [
                            int(round(9100 + (arm1b_profile["ifng_24h_pdl1_molecules_per_cell"] - 9100) * m))
                            for m in mults
                        ]
                        for b_name, mults in tyk2_ifna_isre_induction_branches.items()
                    }
                ),
            }
    stages = [
        {"stage_id": "Stage_0_hPSC", "markers": "OCT4+/SOX2+/NANOG+", "day": 0},
        {"stage_id": "Stage_1_Definitive_Endoderm", "markers": "SOX17+/FOXA2+", "day": 3},
        {"stage_id": "Stage_4_Pancreatic_Progenitor_PP2", "markers": "PDX1+/NKX6.1+/SOX9+", "day": 11},
        {"stage_id": "Stage_6_Endocrine_Progenitor_EP", "markers": "NEUROG3+/NKX2.2+/FEV+", "day": 18},
        {"stage_id": "Stage_7_Mature_SC_Beta", "markers": "INS+/NKX6.1+/MAFA+/UCN3+/ENTPD3+", "day": 28},
        {"stage_id": "Stage_7_Mature_SC_Alpha", "markers": "GCG+/ARX+/IRX2+", "day": 28},
        {"stage_id": "Stage_7_Mature_SC_Delta", "markers": "SST+/HHEX+", "day": 28},
        {"stage_id": "Isogenic_iEC_Microvessel", "markers": "CD31+/CD144(VE-Cadherin)+/vWF+", "day": 14},
    ]

    return {
        "model_type": "Literature-Anchored Stage-Specific Prior Lookup with Independent Per-Stage Monte Carlo Uncertainty Bands (N=1,000 draws per stage/endpoint; not a fitted ODE/GRN dynamical model)",
        "construct_grammar_verification": grammar_audit,
        "effects_corpus_validation_status": effects_corpus_status,
        "evidence_eligibility": {
            "policy": "Exclude project summaries, reviews/commentaries and superseded preprints before any directional study weighting; retain only source-typed active records",
            "excluded_effect_records": len(excluded_effect_ids),
            "excluded_study_pmids": sorted(excluded_study_pmids),
            "eligible_effect_records": len(unique_effect_ids - excluded_effect_ids),
            "duplicate_exact_effect_records_skipped": duplicate_exact_effect_records_skipped,
        },
        "input_provenance": {
            "ring1_atomic_effects": {"path": effects_input_path, "sha256": effects_sha256,
                                      "bytes": len(effects_bytes), "unique_effect_records": len(unique_effect_ids)},
            "raw_reference_object_sha256": sha256_str(json.dumps(ref,sort_keys=True,separators=(",",":"))),
            "construct_verification_object_sha256": sha256_str(json.dumps(construct_verification,sort_keys=True,separators=(",",":"))),
            "motif_scan_object_sha256": sha256_str(json.dumps(motif_scans,sort_keys=True,separators=(",",":"))),
            "scope": "Hashes bind the actual consumed bytes/objects, not an authenticated biological prediction."},
        "calibration_inputs_consumed": {
            "gtex_cd47_pancreas_median_tpm": cd47_pancreas_tpm,
            "gtex_b2m_pancreas_median_tpm": b2m_pancreas_tpm,
            "basal_wt_hlae_molecules_per_cell": int(round(basal_hlae_wt)),
            "encode_screen_cxcl10_max_biosample_tpm": cxcl10_encode_biosample_max_tpm,
            "jaspar_cxcl10_stat1_stat2_log2_odds": cxcl10_isre_top_score,
            "jaspar_cxcl10_bounded_motif_activation": round(cxcl10_motif_activation, 6),
            "jaspar_b2m_irf1_log2_odds": b2m_isre_top_score,
            "jaspar_b2m_bounded_motif_activation": round(b2m_motif_activation, 6),
            "eta_2a_ribosomal_skipping_downstream_factor": eta_2a_skipping,
            "ring1_unique_records_deduplicated_count": len(unique_effect_ids),
            "ring1_directional_study_gene_links_count": directional_study_total,
            "ring1_continuous_evidence_weight": ring1_evidence_weight,
            "ring1_gene_effect_evidence_counts": gene_effect_counts,
            "ring1_canonical_gene_effect_evidence_counts": canonical_gene_effect_counts,
            "ring1_canonical_gene_study_pmids": {
                g: {label: sorted(pmids, key=int) for label, pmids in groups.items()}
                for g, groups in gene_study_sets.items()
            },
            "evidence_counting_unit": "unique canonical gene, PMID and direction; aliases contribute once",
            "canonical_gene_aliases": {g: list(aliases) for g, aliases in canonical_gene_aliases.items()},
            "deprecated_display_gene_keys_to_canonical_gene": legacy_gene_keys,
            "directional_link_normalization_denominator_prior": 148.0,
            "legacy_display_counts_must_not_be_summed": True,
            "ring1_evidence_weight_prior_heuristic_note": (
                f"ring1_continuous_evidence_weight ({directional_study_total}/148 = {ring1_evidence_weight:.6f}) is a declared corpus-level prior confidence scalar "
                f"(locked per DEC-007; canonical per-gene directional link counts: "
                + ", ".join(
                    f"{g} {canonical_gene_effect_counts[g]['protective'] + canonical_gene_effect_counts[g]['penalty']}/{directional_study_total}"
                    for g in sorted(
                        canonical_gene_effect_counts,
                        key=lambda k: (-(canonical_gene_effect_counts[k]["protective"] + canonical_gene_effect_counts[k]["penalty"]), k),
                    )
                )
                + ") rather than a mechanistic copy-number law; wet-lab posterior calibration "
                "is governed by data/extracted/wetlab_bayesian_posterior_calibration_v0.8.0.json."
            ),
        },
        "external_benchmark_reference_anchors_not_fitted": [
            {
                "accession": "NCBI GEO GSE190726",
                "citation": "Chandra et al. 2022 Nature Communications PMID:36289205 (PMC9606380)",
                "published_source_measurements": {
                    "fig_2c_stage5_neurog3_immunostaining_pct": {"wt_mean_pct": 28.81, "tyk2_ko_mean_pct": 15.45, "relative_change_pct": -46.37},
                    "fig_2i_stage7_ins_flow_cytometry_pct": {"wt_mean_pct": 29.78, "tyk2_ko_mean_pct": 21.90, "relative_change_pct": -26.46},
                    "fig_2k_stage7_ins_immunostaining_pct": {"wt_mean_pct": 23.73, "tyk2_ko_mean_pct": 16.01, "relative_change_pct": -32.54},
                },
                "rescaled_model_prior_baselines": {
                    "stage4_pp2_fraction": {"wt_prior": 0.840, "tyk2_ko_prior": 0.816, "relative_change_pct": -2.86},
                    "stage6_neurog3_ep_fraction": {"wt_prior": 0.678, "tyk2_ko_prior": tyk2_ko_s6_mean, "relative_change_pct": round(100.0 * (tyk2_ko_s6_mean / 0.678 - 1.0), 2)},
                    "stage7_sc_beta_yield_fraction": {"wt_prior": 0.600, "tyk2_ko_prior": tyk2_ko_s7_mean, "relative_change_pct": round(100.0 * (tyk2_ko_s7_mean / 0.600 - 1.0), 2)},
                },
                "role": "Published summary statistics from Chandra et al. 2022 Source Data (Fig 2c S5 NEUROG3+ -46.37% [28.81% -> 15.45%]; Fig 2k S7 INS+ immunostaining -32.54% [23.73% -> 16.01%]; Fig 2i S7 INS+ flow -26.46% [29.78% -> 21.90%]) anchor the relative perturbation reductions applied to OpenIslet's assigned Stage-0 WT baselines (Stage 4 PP2 0.816 vs 0.840 WT, Stage 5/6 NEUROG3+ 0.364 vs 0.678 WT [-46.31%], Stage 7 SC-beta 0.408 vs 0.600 WT [-32.00%]); raw count matrices are not locally refitted.",
            }
        ],
        "stage7_endocrine_yield_reconciliation_note": {
            "pre_sort_differentiation_yield_interpretation": (
                "Each genotype profile reports pre-sort Stage-7 lineage yield fractions (stage7_sc_beta_yield_fraction, "
                f"stage7_sc_alpha_yield_fraction, stage7_sc_delta_yield_fraction; e.g. Arm 1B endocrine sum = "
                f"{round(arm1b_profile['stage7_sc_beta_yield_fraction'] + arm1b_profile['stage7_sc_alpha_yield_fraction'] + arm1b_profile['stage7_sc_delta_yield_fraction'], 4)}, "
                f"Arm 1A = {round(by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['stage7_sc_beta_yield_fraction'] + by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['stage7_sc_alpha_yield_fraction'] + by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['stage7_sc_delta_yield_fraction'], 4)}, "
                f"TYK2-/- = {round(tyk2_profile['stage7_sc_beta_yield_fraction'] + tyk2_profile['stage7_sc_alpha_yield_fraction'] + tyk2_profile['stage7_sc_delta_yield_fraction'], 4)}), "
                "with the complement (1 - endocrine_sum) representing non-endocrine/ductal/enterochromaffin off-target fractions prior to magnetic/FACS sorting."
            ),
            "post_sort_reaggregation_link_to_layer4": (
                "Downstream Layer 4 metabolic and paracrine ODEs model post-sort CD49a+/CD26-purified and re-aggregated "
                "tri-hormonal clusters Standardized to the 60:30:10 beta:alpha:delta target ratio (120 um diameter)."
            ),
            "marginal_uncertainty_vs_simplex_note": (
                "Per-lineage p10/p90 bands are independent marginal Gaussian quantiles rather than joint Dirichlet simplex draws, "
                "so summing marginal p90 upper bounds across beta + alpha + delta can exceed 1.0."
            ),
        },
        "stage_specific_grn_edges": grn_edges,
        "profile_count": len(perturbation_profiles),
        "uncertainty_semantics": "independent prior scenario draws, no posterior fitting or held-out validation",
        "prior_interval_quantile_method": "Hyndman-Fan type 7 linear empirical quantiles; even-sample median averages the two middle draws",
        "hour0_hlae_inducible_vs_constitutive_kinetics_note": {
            "source": "derived from the current typed profiles; no measured protection claim",
            "arm1b_cd47_to_wt_fold": (arm1b_profile["hour0_basal_cd47_molecules_per_cell"] / wt_profile["hour0_basal_cd47_molecules_per_cell"]
                                      if wt_profile["hour0_basal_cd47_molecules_per_cell"] > 0 else None),
            "arm1b_cd47_to_wt_fold_status": ("DEFINED_FROM_CURRENT_PRIORS" if wt_profile["hour0_basal_cd47_molecules_per_cell"] > 0
                                           else "UNDEFINED_ZERO_REFERENCE_CD47_DENSITY"),
            "cd47_ratio_denominator_genotype_id": wt_profile["genotype_id"],
            "tyk2_relative_yield_comparisons": {"baseline_genotype_id": wt_profile["genotype_id"],
                "stage6_relative_change_pct": 100 * (tyk2_profile["stage6_neurog3_ep_fraction"] / wt_profile["stage6_neurog3_ep_fraction"] - 1),
                "stage7_relative_change_pct": 100 * (tyk2_profile["stage7_sc_beta_yield_fraction"] / wt_profile["stage7_sc_beta_yield_fraction"] - 1)},
            "profiles": [{"genotype_id": p["genotype_id"],
                          "resting_hlae_molecules_per_cell": p["hour0_resting_unstimulated_hlae_molecules_per_cell"],
                          "resting_hlae_fraction_of_wt": round(p["hour0_resting_unstimulated_hlae_molecules_per_cell"] / basal_hlae_wt, 4) if basal_hlae_wt > 0 else None,
                          "ifng24h_hlae_molecules_per_cell": p["ifng_24h_induced_hlae_molecules_per_cell"],
                          "hour0_cd47_molecules_per_cell": p["hour0_basal_cd47_molecules_per_cell"]}
                         for p in perturbation_profiles if p["genotype_id"].startswith("SCENARIO_A")],
            "arm_selection_determinacy_note": (
                "Under a strict resting-state (Hour-0 unstimulated) threshold of 15,000 or 25,000 molecules/cell, "
                f"constitutive Arm 1A ({by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['hour0_resting_unstimulated_hlae_molecules_per_cell']:,} molecules/cell, "
                f"{round(by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['hour0_resting_unstimulated_hlae_molecules_per_cell'] / basal_hlae_wt, 4)}x WT; "
                f"24h IFN-g {by_id['SCENARIO_A_ARM_1A_BICISTRONIC_P2A_COMPARATOR']['ifng_24h_induced_hlae_molecules_per_cell']:,} molecules/cell) clears the gate at Hour 0 whereas "
                f"inducible Arm 1B ({arm1b_profile['hour0_resting_unstimulated_hlae_molecules_per_cell']:,} molecules/cell, "
                f"{round(arm1b_profile['hour0_resting_unstimulated_hlae_molecules_per_cell'] / basal_hlae_wt, 4)}x WT) is below threshold until inflammatory/islet-niche "
                f"IFN stimulation ({arm1b_profile['ifng_24h_induced_hlae_molecules_per_cell']:,} molecules/cell at 24h IFN-g) or wet-lab promoter tuning."
            ),
            "protection_status": "PREREGISTERED_PENDING_RESTING_AND_IFNG_LICENSED_NK_ASSAYS",
        },
        "er_heavy_chain_flux_and_upr_hazard_muse_r3": {
            "evidence_class": "BIOPHYSICAL_ERAD_FLUX_HAZARD_MODEL_REQUIRES_GATE_0E_ER_WETLAB_QUALIFICATION",
            "primary_citations": ["PMID:12006653", "PMID:32719542"],
            "mechanism": (
                "In B2M-/- cells where the only beta-2-microglobulin is intramolecularly tethered inside the HLA-E*01:03 SCT via a 15-aa (G4S)3 linker, "
                "endogenous HLA-A, HLA-B, and HLA-C promoters remain intact and highly inducible by IFN-gamma/IFN-alpha via conserved ISRE/GAS elements, "
                "synthesizing orphan MHC-I heavy chains that cannot assemble with free beta2m and are retained in the ER membrane bound to calnexin/BiP "
                "until cleared by HRD1/SEL1L-dependent ER-associated degradation (ERAD; Spiliotis et al. 2002 PMID:12006653)."
            ),
            "synthesis_and_erad_steady_state_bounds": {
                "wt_surface_mhci_molecules_per_cell_range": [100000, 300000],
                "wt_mhci_turnover_half_life_hours": 12.0,
                "wt_mhci_inflammatory_accelerated_turnover_half_life_hours": 6.0,
                "ifn_transcriptional_fold_induction_range": [6.0, 15.0],
                "ifn_stimulated_orphan_hc_synthesis_flux_at_t12_12h_molecules_per_min_low_central_high": [
                    round(100000.0 * math.log(2.0) / (12.0 * 60.0) * 6.0, 1),
                    round(200000.0 * math.log(2.0) / (12.0 * 60.0) * 10.0, 1),
                    round(300000.0 * math.log(2.0) / (12.0 * 60.0) * 15.0, 1),
                ],
                "ifn_stimulated_orphan_hc_synthesis_flux_at_t12_6h_inflammatory_upper_molecules_per_min": round(
                    300000.0 * math.log(2.0) / (6.0 * 60.0) * 15.0, 1
                ),
                "ifn_stimulated_orphan_hc_synthesis_flux_molecules_per_min_range": [578, 8664],
                "central_orphan_hc_synthesis_flux_at_200k_wt_10x_ifn_molecules_per_min": 1925,
                "erad_clearance_half_life_min_range": [30.0, 60.0],
                "steady_state_er_retained_orphan_hc_pool_at_t12_12h_molecules_per_cell_low_central_high": [
                    round((100000.0 * math.log(2.0) / (12.0 * 60.0) * 6.0) * 30.0 / math.log(2.0)),
                    round((200000.0 * math.log(2.0) / (12.0 * 60.0) * 10.0) * 60.0 / math.log(2.0)),
                    round((300000.0 * math.log(2.0) / (12.0 * 60.0) * 15.0) * 60.0 / math.log(2.0)),
                ],
                "steady_state_er_retained_orphan_hc_pool_molecules_per_cell_range": [25000, 750000],
                "central_er_retained_orphan_hc_pool_at_t12_60min_exact_formula_molecules_per_cell": round(
                    (200000.0 * math.log(2.0) / (12.0 * 60.0) * 10.0) * 60.0 / math.log(2.0)
                ),
                "central_er_retained_orphan_hc_pool_at_t12_60min_molecules_per_cell": 200000,
                "formula_reconciliation_note_kimi31_r4": (
                    "Exact steady-state mass-action formulas: F_synth = N_WT * (ln(2) / (t_1/2,WT * 60)) * I_IFN and S_ER,retained = F_synth * t_1/2,ERAD / ln(2) "
                    "= N_WT * I_IFN * (t_1/2,ERAD / (t_1/2,WT * 60)). At resting turnover t_1/2,WT = 12 h (720 min), [Low: N=100k, I=6x, t_ERAD=30 min], "
                    "[Central: N=200k, I=10x, t_ERAD=60 min], and [High: N=300k, I=15x, t_ERAD=60 min] give F_synth = [577.6, 1925.4, 4332.2] molecules/min "
                    "and S_ER,retained = [25,000, 166,667, 375,000] molecules/cell (whereas 200,000 is the rounded central reference and 8,664.3 molecules/min -> "
                    "750,000 molecules/cell corresponds to inflammatory accelerated MHC-I turnover t_1/2,WT = 6 h; AUDIT-REF)."
                ),
            },
            "blueprint_comparison": {
                "Blueprint_A_and_X_B2M_null": {
                    "orphan_hc_loci_expressed": ["HLA-A", "HLA-B", "HLA-C"],
                    "relative_orphan_hc_flux_fraction": 1.0,
                    "total_er_mhc_folding_load_vs_b2m_null": 1.0,
                    "status": "B2M_NULL_ORPHAN_HC_ERAD_UNQUALIFIED",
                },
                "Design_B_prime_SCT_K4_B2M_null_HLA_A_B_WT_CIITA_SCT": {
                    "orphan_hc_loci_expressed": ["HLA-A", "HLA-B", "HLA-C"],
                    "relative_orphan_hc_flux_fraction": 1.0,
                    "total_er_mhc_folding_load_vs_b2m_null": 1.25,
                    "status": "K4_B_PRIME_SCT_RETAINS_FULL_ORPHAN_HC_FLUX_PLUS_CIITA_HLAC_SCT_LOAD_GATED_BY_0E_ER",
                },
                "Design_B_prime_SCT_B2M_null_HLA_A_B_null_CIITA_SCT": {
                    "orphan_hc_loci_expressed": ["HLA-C"],
                    "relative_orphan_hc_flux_fraction": 0.125,
                    "total_er_mhc_folding_load_vs_b2m_null": 0.375,
                    "status": "OPTIONAL_K6_HLA_A_B_KO_RESIDUAL_HLAC_ONLY_ORPHAN_HC_FLUX_85_TO_90PCT_REDUCED",
                },
                "Design_B_prime_endogenous_HLAC_retained_B2M_intact": {
                    "orphan_hc_loci_expressed": [],
                    "relative_orphan_hc_flux_fraction": 0.0,
                    "total_er_mhc_folding_load_vs_b2m_null": 0.20,
                    "status": "ZERO_ORPHAN_HC_FLUX_FREE_B2M_INTACT",
                },
            },
            "cis_tethered_hlae_sct_cannot_chaperone_orphan_hc_in_trans_note_argon_r4": (
                "Intramolecularly tethered HLA-E SCT (Arm 1A / Arm 1C) has its single B2M domain covalently linked 1:1 in cis to its own HLA-E heavy chain "
                "(effective local concentration > 10 mM) and supplies zero free soluble B2M in trans to rescue endogenous orphan HLA-A/B/C heavy chains; "
                "therefore, if Gate 0E-ER fails on B2M-/- clones, valid biological ERAD-reduction pivots are: (1) pair with TYK2 P1104A (which suppresses Type-I-IFN "
                "HLA-A/B/C transcription by 80-90% in the iPSC-beta knockdown branch [0.10-0.20x] vs 0-20% in the primary human leukocyte WT-like branch [0.80-1.00x], while leaving IFN-gamma -> JAK1/JAK2 unattenuated [0.85-1.00x]), "
                "(2) re-include X6 (RNLS-/-) to raise the beta-cell ER-stress apoptosis threshold, or "
                "(3) apply NLRC5 promoter CRISPRoff methylation or HLA-A-/- HLA-B-/- debulking (which suppress/eliminate heavy-chain flux across both IFN-alpha and IFN-gamma; AUDIT-REF & AUDIT-REF)."
            ),
            "stage0_gate_0e_er_pass_criteria": {
                "ifng_100U_plus_tnfa_10ng_plus_16p7mM_glucose_48h": {
                    "sXBP1_over_uXBP1_ratio_vs_wt_max": 1.5,
                    "BiP_HSPA5_vs_wt_max": 1.3,
                    "CHOP_DDIT3_vs_wt_max": 1.2,
                    "secreted_proinsulin_to_insulin_molar_ratio_vs_wt_max": 1.25,
                    "post_stress_gsis_stimulation_index_min": 2.5,
                },
                "pivot_rule_S5": "If Gate 0E-ER fails on B2M-/- clones, apply NLRC5 CRISPRoff / K=6 HLA-A-/- HLA-B-/- ER debulking (covering both IFN-alpha and IFN-gamma), re-include X6 (RNLS-/-), or pair with TYK2 P1104A if Stage-0 confirms Type-I-IFN attenuation in human SC-beta cells.",
            },
            "four_mechanism_er_taxonomy_and_tyk2_p1104a_context_sensitivity_sol61_r4": {
                "primary_citations": ["PMID:30578352", "PMID:42268925", "PMID:32719542", "PMID:39988068", "PMID:20160085", "PMID:38603470", "PMID:25140605"],
                "mechanism_1_er_heavy_chain_source_elimination": "K=6 HLA-A-/- HLA-B-/- (plus HLA-C-/- in Plan A) physically eliminates orphan MHC-I heavy-chain polypeptide entry into the ER lumen, reducing orphan heavy-chain flux to 0.00x under both IFN-alpha and IFN-gamma.",
                "mechanism_2_transcriptional_source_suppression": (
                    "NLRC5 promoter CRISPRoff silences the MHC-I enhanceosome across both Type I and Type II IFN; by contrast, TYK2 P1104A (rs34536443) selectively blunts Type-I-IFN/IL-12/IL-23 signaling while leaving IFN-gamma -> JAK1/JAK2 -> STAT1 -> IRF1 -> NLRC5 -> HLA-A/B/C transcription intact. "
                    "Moreover, in primary human P1104A/P1104A leukocytes, TYK2 P1104A completely impairs IL-23 and partially impairs IL-12 but retains WT-like cellular response to high-dose IFN-alpha/beta (Boisson-Dupuis et al. 2018 PMID:30578352; whereas Howard et al. 2026 PMID:42268925 is an engineered HEK293T VAMP-seq/signaling screen and Chandra et al. 2022 PMID:36289205 studied TYK2 KO and pharmacologic TYK2i in SC-islets rather than P1104A knock-in); "
                    "therefore our model tracks both the beta-cell-specific 80-90% IFN-alpha attenuation branch (modeled on TYK2i/KO in Chandra et al. 2022 PMID:36289205) and a conservative 0-20% IFN-alpha attenuation sensitivity branch (0.80-1.00x relative to WT, anchored to primary human P1104A leukocytes in Boisson-Dupuis et al. 2018 PMID:30578352) until resolved by the Stage-0 isogenic TYK2 P1104A satellite."
                ),
                "mechanism_3_erad_retrotranslocation_and_proteasomal_disposal": "Endogenous HRD1/SEL1L/Derlin-1 ubiquitin-proteasome ERAD capacity clears misfolded B2M-free heavy chains up to the saturable beta-cell threshold alongside proinsulin and IAPP folding demand.",
                "mechanism_4_downstream_er_stress_apoptosis_tolerance_and_iapp_challenger": (
                    "RNLS-/- raises the downstream CHOP/TXNIP apoptotic threshold against thapsigargin and cytokine stress without reducing physical heavy-chain entry into the ER lumen (Cai et al. 2020 PMID:32719542; MacDonald et al. 2025 PMID:39988068), "
                    "whereas the RNLS-WT non-amyloidogenic IAPP(A25P/S28P/S29P) prime-edit challenger (ER_IAPP_PRAMLINTIDE_RNLS_WT) eliminates toxic human IAPP20-29 beta-sheet oligomers directly at the source while preserving wild-type RNLS metabolic fitness (Potter et al. 2010 PMID:20160085; Thorngren et al. 2024 PMID:38603470; Wang et al. 2014 PMID:25140605; AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                ),
                "tyk2_p1104a_ifna_orphan_hc_flux_sensitivity_branches_vs_wt": tyk2_ifna_orphan_hc_branches,
            },
            "b2m_ko_free_heavy_chain_surface_leakage_and_exogenous_b2m_rescue_gate_sol61_r5": {
                "finding_id": "AUDIT-REF",
                "decision_id": "DEC-044 / DEC-046 / DEC-078",
                "primary_citations": ["PMID:2124002", "PMID:1986378", "PMID:1512546", "PMID:8120026"],
                "mechanism": (
                    "While B2M-/- eliminates canonical beta2m-assembled MHC-I heterodimers, high-affinity intracellular peptides (including high-flux preproinsulin/PPI, IGRP, "
                    "and ZNT8 peptides in secretory beta cells under IFN-gamma immunoproteasome/TAP hyper-induction) can stabilize a minor fraction of beta2m-free MHC-I heavy chains "
                    "or transient open conformers that escape ER quality control to the plasma membrane (Bix & Raulet 1992 J Exp Med PMID:1512546; Demaria et al. 1994 J Biol Chem PMID:8120026), and once at the cell surface, "
                    "physiologic extracellular human serum beta2-microglobulin (~1.5-3.0 ug/mL, ~125-250 nM in vivo) can bind in trans to reconstitute functional peptide-presenting MHC-I complexes "
                    "as established for beta2m-free MHC-I heavy chains by Vitiello et al. 1990 Science PMID:2124002, Rock et al. 1991 PNAS PMID:1986378, Bix & Raulet 1992 J Exp Med PMID:1512546, and Demaria et al. 1994 J Biol Chem PMID:8120026, and evaluated here as a Stage-0 human B2M-/- SC-islet assay gate (DEC-078)."
                ),
                "stage0_gate_0e_er_and_0a_surface_exogenous_b2m_rescue_assay": {
                    "cytokine_and_serum_b2m_challenge_condition": "100 U/mL IFN-gamma + 1,000 U/mL IFN-alpha + 10 ng/mL TNF-alpha for 48 h in beta2m-depleted human serum with 0, 1.5, and 3.0 ug/mL (0, 125, and 250 nM) recombinant human beta2-microglobulin add-back for 24 h (plus 20% normal human serum comparator)",
                    "required_readouts_and_thresholds": {
                        "pan_hla_abc_w6_32_and_free_heavy_chain_hc10_l31_flow_shift_vs_isotype_max_mfi_ratio": 1.2,
                        "hla_a0201_ppi_15_24_igrp_265_273_and_znt8_186_194_autoreactive_cd8_tcr_lysis_after_exogenous_b2m_pct_max": 5.0,
                        "hla_a0201_ppi_15_24_and_igrp_265_273_autoreactive_cd8_tcr_lysis_after_exogenous_b2m_pct_max": 5.0,
                        "pan_hla_ip_lc_ms_ms_immunopeptidomics_endogenous_hla_abc_peptides_detected_max": 0,
                    },
                    "pivot_rule": (
                        "If exogenous human serum beta2m (1.5-3.0 ug/mL) reconstitutes detectable W6/32 conformational staining (> 1.2x isotype), HC10/L31 free heavy-chain surface staining (> 1.2x isotype), "
                        "> 5.0% primary HLA-matched T1D donor autoreactive CD8+ CTL lysis (across PPI_15-24, IGRP_265-273, and ZnT8_186-194 specificities), or > 0 endogenous HLA-A/B/C peptides by W6/32 + HC10 IP-LC-MS/MS on B2M-/- SC-beta cells, "
                        "escalate to NLRC5 promoter CRISPRoff silencing or K=6 HLA-A-/- HLA-B-/- heavy-chain debulking to eliminate endogenous heavy-chain transcription at the source (AUDIT-REF & AUDIT-REF [DEC-044/045])."
                    ),
                },
            },
        },
        "tyk2_inducible_promoter_epistasis_prior_band_muse_r3": {
            "evidence_class": "SIGNALING_EPISTASIS_PRIOR_BAND_REQUIRES_CO_PRIMARY_X1xX4_AND_X3xX4_INTERACTION_ESTIMANDS",
            "primary_citations": ["PMID:27807284", "PMID:36289205", "PMID:30578352", "PMID:42268925"],
            "mechanism": (
                "TYK2 P1104A (rs34536443) reduces IFN-alpha/beta-induced pSTAT1/pSTAT2 signaling by 80-90% in the iPSC-beta TYK2i/knockdown branch (0.15-0.35x ISRE induction; Chandra et al. 2022 PMID:36289205, which assayed TYK2 KO and pharmacologic TYK2i in SC-islets) "
                "versus 0-20% in the primary human P1104A/P1104A leukocyte WT-like high-dose IFN-alpha/beta branch (0.80-1.00x ISRE induction; Boisson-Dupuis et al. 2018 PMID:30578352; alongside the engineered HEK293T VAMP-seq/signaling screen of Howard et al. 2026 PMID:42268925) while leaving JAK1/JAK2-mediated "
                "IFN-gamma signaling largely intact (0.70-0.90x); consequently, in an early Type-I-IFN-dominated autoimmune flare (prior to heavy CD8/NK IFN-gamma release), "
                "TYK2 P1104A may attenuate ISRE-dependent transcription of Syn_5xISRE_minP -> HLA-E (Arm 1B) and endogenous CXCL10 -> SERPINB9/PD-L1 (Locus 3) unless paired with constitutive/basal-floor promoters."
            ),
            "ifna_dominant_early_flare_induction_multiplier_relative_to_tyk2_wt": [0.15, 0.35],
            "ifna_dominant_early_flare_induction_multiplier_two_branch_sensitivity_vs_tyk2_wt": tyk2_ifna_isre_induction_branches,
            "ifng_present_ctl_synapse_induction_multiplier_relative_to_tyk2_wt": [0.70, 0.90],
            "architectural_coupling_rule": (
                "Any candidate combining TYK2 P1104A (X4) with B2M-/- or Locus 3 must pair X4 with constitutive/basal-floor promoters "
                "(Arm 1X EEF1A1 -> HLA-E and L3-BF-B basal-floor SERPINB9) unless Stage-0 co-primary interaction estimands beta_{X1 x X4} and beta_{X3 x X4} "
                "and the 3x2 TYK2 x L3-BF-B satellite confirm >= 70% shield induction under combined IFN-alpha (1,000 U/mL) + low IFN-gamma (10 U/mL) (AUDIT-REF & AUDIT-REF)."
            ),
        },
        "differentiation_stages_modeled": stages,
        "l3_bfb_basalfloor_profile_projection_sonnet55_r4": l3_bfb_profile_projection,
        "coupled_five_transgene_hypoxic_isr_surface_decay_and_leader_rescue_audit_sonnet55_r5": {
            "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
            "decision_id": "DEC-047 / DEC-078",
            "primary_citations": ["PMID:37156915", "PMID:11106749", "PMID:26823435", "PMID:16467844"],
            "mechanism": (
                "Under acute 72 h post-implant hypoxia (pO2 <= 5 mmHg in oversize >100 um clusters or stagnant >100 um seroma fluid films) "
                "combined with IL-1beta + IFN-gamma + TNF-alpha ER stress, PERK-eIF2alpha phosphorylation attenuates global cap-dependent 5'-m7G translation "
                "by f_ISR in [0.15, 0.35] across all 5 engineered cap-dependent transgenes simultaneously (CD47-IgV-GPI, HLA-E SCT, PD-L1, SERPINB9, and iCasp9), "
                "rather than SERPINB9 alone."
            ),
            "five_transgene_72h_hypoxic_isr_decay_trajectories_at_f_isr_0p20": {
                "CD47_IgV_GPI": {
                    "t_half_hours": 20.0,
                    "hour0_molecules_per_cell": 240000,
                    "layer2_arm1b_arm1x_prior_hour0_molecules_per_cell": 238004,
                    "steady_state_under_f_isr_0p20_molecules": 48000,
                    "hour24_molecules_per_cell": 131573,
                    "hour48_molecules_per_cell": 84377,
                    "hour72_molecules_per_cell": 63834,
                    "hour72_from_238004_prior_molecules_per_cell": 63303,
                    "breaches_180k_nk_macrophage_cliff_without_dxb_po2_or_isr_bypass_leader": True,
                },
                "HLAE_SCT_Arm1X": {
                    "t_half_hours": 14.0,
                    "hour0_molecules_per_cell": 22000,
                    "steady_state_under_f_isr_0p20_molecules": 4400,
                    "hour24_molecules_per_cell": 9760,
                    "hour48_molecules_per_cell": 6033,
                    "hour72_molecules_per_cell": 4898,
                    "breaches_15k_nkg2a_cliff_without_dxb_po2_or_isr_bypass_leader": True,
                },
                "PDL1_Locus3_BFB": {
                    "t_half_hours": 16.0,
                    "hour0_ifng_induced_molecules_per_cell": 45000,
                    "hour72_under_f_isr_0p20_molecules": 10588,
                },
                "SERPINB9_Locus3_BFB": {
                    "t_half_hours": 6.0,
                    "hour0_basal_uM": 0.30,
                    "ifng_induced_normoxic_uM": 0.89,
                    "ifng_induced_hypoxic_f_isr_0p45_uM": 0.4005,
                    "ifng_induced_severe_anoxic_f_isr_0p20_uM": 0.1780,
                },
                "iCasp9_AAVS1": {
                    "t_half_hours": 24.0,
                    "normoxic_dimerizable_monomer_fraction": 1.0,
                    "hour72_under_f_isr_0p20_fraction": 0.30,
                    "hour72_under_f_isr_0p45_fraction": 0.5188,
                    "requires_pulsed_ap1903_plus_birinapant_smac_mimetic_under_hypoxia": True,
                },
                "leader_rescue_f_isr_0p75_72h_trajectories": {
                    "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75_from_238004_prior": 183410,
                    "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75_from_240000_nominal": 184948,
                    "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75": 183354,
                    "HLA_E_SCT_hour72_molecules_at_f_isr_0p75_from_22000_arm1x": 16656,
                    "HLA_E_SCT_hour72_molecules_at_f_isr_0p75_from_20000_baseline": 15142,
                    "HLA_E_SCT_hour72_molecules_at_f_isr_0p75": 15250,
                    "clears_180k_cd47_and_15k_hlae_72h_retention_gates": True,
                },
            },
            "five_transgene_72h_hypoxic_isr_decay_trajectories_at_f_isr_0p45": {
                "decay_law": "S(t) = S_0 * (f_ISR + (1 - f_ISR) * 2^(-t / t_half))",
                "CD47_IgV_GPI_t_half_20h_from_238004_prior_hour72_molecules": 117897,
                "CD47_IgV_GPI_t_half_20h_from_240000_nominal_hour72_molecules": 118886,
                "HLAE_SCT_Arm1X_t_half_14h_from_22000_hour72_molecules": 10243,
                "PDL1_Locus3_BFB_t_half_16h_from_45000_hour72_molecules": 21341,
                "SERPINB9_Locus3_BFB_t_half_6h_from_0p89uM_hour72_uM": 0.4006,
                "iCasp9_AAVS1_t_half_24h_hour72_monomer_fraction": 0.5188,
            },
            "leader_rescue_f_isr_0p75_72h_trajectories": {
                "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75_from_238004_prior": 183410,
                "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75_from_240000_nominal": 184948,
                "CD47_IgV_GPI_hour72_molecules_at_f_isr_0p75": 183354,
                "HLA_E_SCT_hour72_molecules_at_f_isr_0p75_from_22000_arm1x": 16656,
                "HLA_E_SCT_hour72_molecules_at_f_isr_0p75_from_20000_baseline": 15142,
                "HLA_E_SCT_hour72_molecules_at_f_isr_0p75": 15250,
                "clears_180k_cd47_and_15k_hlae_72h_retention_gates": True,
            },
            "single_cell_lognormal_variegation_and_p10_floor_gate": {
                "lognormal_sd_ln_range": [0.35, 0.55],
                "bulk_mean_240k_at_sigma_0p45_median_molecules": 216890,
                "bulk_mean_240k_at_sigma_0p45_p10_molecules": 121838,
                "fraction_of_cells_below_200k_at_bulk_mean_240k_sigma_0p45": 0.4285,
                "fraction_of_cells_below_180k_at_bulk_mean_240k_sigma_0p45": 0.3393,
                "layer2_prior_238004_at_sigma_0p45_median_molecules": 215086,
                "layer2_prior_238004_at_sigma_0p45_p10_molecules": 120825,
                "fraction_of_cells_below_200k_at_prior_238004_sigma_0p45": 0.4358,
                "fraction_of_cells_below_180k_at_prior_238004_sigma_0p45": 0.3462,
                "required_bulk_mean_for_p10_ge_180k_at_sigma_0p35_molecules": 299690,
                "required_bulk_mean_for_p10_ge_180k_at_sigma_0p45_molecules": 354570,
                "post_72h_hypoxic_isr_stressed_single_cell_p10_joint_gate_terra61_r6": {
                    "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
                    "stressed_72h_bulk_mean_183354_at_sigma_0p45_p10_molecules": 93081,
                    "stressed_72h_bulk_mean_183354_at_sigma_0p45_fraction_below_180k": 0.5730,
                    "stressed_72h_bulk_mean_183410_exact_retention_at_sigma_0p45_p10_molecules": 93109,
                    "stressed_72h_bulk_mean_183410_exact_retention_at_sigma_0p45_fraction_below_180k": 0.5727,
                    "required_72h_stressed_bulk_mean_for_p10_ge_180k_at_sigma_0p45_molecules": 354570,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p75_p10_ge_180k_at_sigma_0p45_molecules": 460112,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p75_p10_ge_180k_at_sigma_0p45_rounded_retention_molecules": 460252,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p75_p10_ge_180k_at_sigma_0p32_molecules": 370487,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p85_p10_ge_180k_at_sigma_0p32_molecules": 331068,
                    "hour0_bulk_mean_366000_at_f_isr_0p85_and_sigma_0p32_post_72h_p10_molecules": 198992,
                    "required_max_sigma_ln_at_hour0_bulk_mean_320k_and_f_isr_0p75_for_72h_p10_ge_180k": 0.2258,
                    "required_max_sigma_ln_at_hour0_bulk_mean_320k_and_f_isr_0p85_for_72h_p10_ge_180k": 0.2986,
                    "operational_sigma_ln_ceiling_at_hour0_320k_and_f_isr_0p85": 0.28,
                    "hour0_bulk_mean_320000_at_f_isr_0p85_and_sigma_0p28_post_72h_p10_molecules": 185344,
                    "hlae_arm1x_hour0_22000_at_f_isr_0p85_72h_bulk_mean_molecules": 18793,
                    "hlae_arm1x_hour0_22000_at_f_isr_0p85_and_sigma_0p28_post_72h_p10_molecules": 12622,
                    "required_hlae_hour0_bulk_mean_for_post_72h_f_isr_0p85_p10_ge_15k_at_sigma_0p28_molecules": 26144,
                    "required_hlae_max_sigma_ln_at_hour0_22000_and_f_isr_0p85_for_72h_p10_ge_15k": 0.1653,
                    "five_transgene_p10_joint_coverage_independent_fraction": round(0.90 ** 5, 5),
                    "five_transgene_p10_joint_coverage_frechet_lower_bound_fraction": 0.50,
                    "mandatory_72h_stressed_single_cell_p10_qualification_rule": (
                        "Stage-0 Gate 0A-surface / Gate 0E-ER requires that the 10th-percentile single-cell floor (p10 >= 180,000 CD47 molecules/cell "
                        "and p10 >= 15,000 HLA-E molecules/cell) hold not only at resting Hour 0 (obs_cd47_p10_single_cell_molecules >= 180,000) "
                        "but also after 72 h of 2% O2 hypoxia + cytokine stress (obs_hypoxic_72h_cd47_p10_single_cell_molecules >= 180,000 and "
                        "obs_hypoxic_72h_hlae_p10_single_cell_molecules >= 15,000, both required for READY_FOR_ENCAPSULATION_COMPLETE_STAGE0_EVIDENCE): "
                        "at the default Layer-2 prior (Hour-0 CD47 mean 238,004 -> 72-h mean 183,354 [183,410 exact] at f_ISR = 0.75) with unmitigated sigma_ln = 0.45, "
                        "the 72-h single-cell p10 is 93,081 [93,109 exact] molecules/cell with 57.30% [57.27%] of cells below 180,000; similarly, for HLA-E (t_1/2 = 14 h, R_HLAE = 0.854247 at f_ISR = 0.85), "
                        "Arm 1X Hour-0 mean 22,000 yields 72-h mean 18,793 and 72-h p10 = 12,622 (< 15,000) at sigma_ln = 0.28, requiring Hour-0 HLA-E mean >= 26,144 molecules/cell at sigma_ln = 0.28 (or sigma_ln <= 0.1653 at Hour-0 mean 22,000). "
                        "Clearing 72-h p10 >= 180,000 (CD47) and >= 15,000 (HLA-E) requires monoclonal UCOE/cHS4 variegation tightening + top-expression MCB sorting (Hour-0 CD47 >= 320,000-366,000 and Hour-0 HLA-E >= 26,144 at sigma_ln <= 0.28, f_ISR = 0.85; "
                        "AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF [DEC-050/051/052])."
                    ),
                },
                "joint_72h_hypoxic_isr_single_cell_p10_cd47_audit_sol61_r6": {
                    "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
                    "stressed_72h_bulk_mean_183354_at_sigma_0p45_p10_molecules": 93081,
                    "stressed_72h_bulk_mean_183354_at_sigma_0p45_fraction_below_180k": 0.5730,
                    "stressed_72h_bulk_mean_183410_exact_retention_at_sigma_0p45_p10_molecules": 93109,
                    "stressed_72h_bulk_mean_183410_exact_retention_at_sigma_0p45_fraction_below_180k": 0.5727,
                    "required_72h_stressed_bulk_mean_for_p10_ge_180k_at_sigma_0p45_molecules": 354570,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p75_p10_ge_180k_at_sigma_0p45_molecules": 460112,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p75_p10_ge_180k_at_sigma_0p32_molecules": 370487,
                    "required_hour0_bulk_mean_for_post_72h_f_isr_0p85_p10_ge_180k_at_sigma_0p32_molecules": 331068,
                    "hour0_bulk_mean_366000_at_f_isr_0p85_and_sigma_0p32_post_72h_p10_molecules": 198992,
                    "required_max_sigma_ln_at_hour0_bulk_mean_320k_and_f_isr_0p75_for_72h_p10_ge_180k": 0.2258,
                    "required_max_sigma_ln_at_hour0_bulk_mean_320k_and_f_isr_0p85_for_72h_p10_ge_180k": 0.2986,
                    "hlae_arm1x_hour0_22000_at_f_isr_0p85_72h_bulk_mean_molecules": 18793,
                    "hlae_arm1x_hour0_22000_at_f_isr_0p85_and_sigma_0p28_post_72h_p10_molecules": 12622,
                    "required_hlae_hour0_bulk_mean_for_post_72h_f_isr_0p85_p10_ge_15k_at_sigma_0p28_molecules": 26144,
                    "required_hlae_max_sigma_ln_at_hour0_22000_and_f_isr_0p85_for_72h_p10_ge_15k": 0.1653,
                    "stage0_contract_endpoint_key": "obs_hypoxic_72h_cd47_p10_single_cell_molecules",
                    "stage0_contract_hlae_p10_endpoint_key": "obs_hypoxic_72h_hlae_p10_single_cell_molecules",
                },
                "mandatory_stage0_gate_0a_pass_criteria": {
                    "obs_cd47_p10_single_cell_molecules_min": 180000,
                    "obs_hypoxic_72h_cd47_p10_single_cell_molecules_min": 180000,
                    "obs_hypoxic_72h_hlae_p10_single_cell_molecules_min": 15000,
                    "obs_hypoxic_72h_cd47_retention_molecules_min": 180000,
                    "obs_hypoxic_72h_hlae_retention_molecules_min": 15000,
                    "obs_hypoxic_15mmhg_f_isr_translation_ratio_min": 0.50,
                },
            },
            "architectural_mitigations": [
                "Primary biotransport mitigation: enforce DX-b <= 80-100 um cluster diameter cap + 1,500 IEQ/cm^2 low-load modular omental cassette so intra-cluster pO2 remains >= 15 mmHg across 336 h (keeping f_ISR >= 0.85 and preventing hypoxic PERK-eIF2alpha activation).",
                "Molecular 5'-leader backup coupon (Gate 0A/0E): test ISR-resistant BiP/HSPA5 5'-UTR IRES or uORF-bypass leader (Starck et al. 2016 PMID:26823435) on antisense CD47-IgV and sense HLA-E SCT in Arm 1X-ISR if 72 h 2% O2 + thapsigargin retention drops below 180,000 CD47 or 15,000 HLA-E molecules/cell.",
            ],
        },
        "five_transgene_joint_coverage_serpinb9_stoichiometry_and_lineage_drift_audit_muse_r6": {
            "finding_ids": ["MW-R6-S1-01", "MW-R6-S1-08", "MW-R6-S1-12", "MW-R6-S1-15", "MW-R6-S1-16"],
            "decision_id": "DEC-053 / DEC-078",
            "primary_citations": ["PMID:11509594", "PMID:31068696", "PMID:32768386"],
            "joint_five_transgene_72h_hypoxic_isr_single_cell_coverage_gate": {
                "joint_threshold_vector": {
                    "CD47_molecules_min": 180000,
                    "HLAE_SCT_molecules_min": 15000,
                    "SERPINB9_cytosolic_uM_min": 0.30,
                    "PDL1_molecules_min": 5000,
                    "iCasp9_dimerizable_uM_min": 0.05,
                },
                "independent_marginal_p10_5transgene_product": round(0.90 ** 5, 6),
                "min_joint_five_transgene_coverage_fraction": 0.90,
                "correlated_ribosomal_er_bottleneck_rationale": (
                    "Under 72-h 1% O2 + 16.7 mM glucose + IFN-g/TNF-a/IL-1b stress, marginal p10 >= threshold on individual transgenes allows up to "
                    "1 - 0.90^5 = 40.95% of cells to fail at least one shield/safety axis under independence; Stage-0 Gate 0A/0C/0S therefore enforces a "
                    "single-cell 5-color flow + prime-flow/intracellular joint coverage gate requiring >= 90% of live beta cells (lower95 >= 0.90, matching the "
                    "Frechet lower bound 1 - 5*(1 - 0.98) = 0.90 for 98% per-transgene marginal coverage) to simultaneously clear all 5 thresholds "
                    "(obs_hypoxic_72h_five_transgene_joint_above_threshold_fraction >= 0.90; MW-R6-S1-08 & R7S2-F01 [DEC-053/055/057])."
                ),
                "bip_hspa5_leader_proteotoxicity_qualification": (
                    "Constitutive BiP/HSPA5 uORF-bypass leader rescue (L3-BF-B+BiP) must simultaneously clear Gate 0E ER proteostasis without driving "
                    "secretory ER crowding: proinsulin-to-insulin molar ratio <= 0.15, CHOP/DDIT3 fold <= 1.5x, XBP1s/XBP1u ratio <= 1.5x, and GSIS SI >= 2.5."
                ),
                "wetlab_contract_endpoint": "obs_hypoxic_72h_five_transgene_joint_above_threshold_fraction",
            },
            "cytosolic_0p5pL_serpinb9_molecular_stoichiometry_and_death_pathway_partitioning": {
                "beta_cell_cytosolic_accessible_volume_pL": 0.50,
                "resting_l3_bfb_serpinb9_concentration_uM": 0.30,
                "resting_serpinb9_molecules_per_0p5pL_cytosol": int(round(0.30e-6 * 0.50e-12 * 6.02214076e23)),
                "resting_serpinb9_molecules_per_0p5pL_cytosol_4sigfig_na": 90330,
                "induced_0p89uM_serpinb9_molecules_per_0p5pL_cytosol": int(round(0.89e-6 * 0.50e-12 * 6.02214076e23)),
                "induced_0p89uM_serpinb9_molecules_per_0p5pL_cytosol_4sigfig_na": 267980,
                "granzyme_b_molecules_injected_per_nk_or_ctl_synapse_range": [10000, 100000],
                "unreplenished_synaptic_hits_to_exhaust_resting_pool_at_si_1p0_to_1p5": [1, 9],
                "pharmacological_death_pathway_partitioning_panel": [
                    "z-VAD-fmk (20 uM pan-caspase block) + IETD-CHO (caspase-8 block: FasL/TRAIL extrinsic apoptosis attribution)",
                    "Compound 6 / Ac-IEPD-CHO (Granzyme B block) + Granzyme A / K substrate cleavage reporters (non-GzmB granzyme attribution)",
                    "Necrostatin-1s (10 uM RIPK1 block) + NSA / GSK'872 (RIPK3/MLKL necroptosis attribution under TNF-a + IFN-g + caspase inhibition)",
                    "EGTA / Ca2+-chelation + anti-perforin deltaG9 (perforin pore osmotic lysis vs granzyme translocation)",
                ],
                "function_under_attack_co_primary_gate": (
                    "Gate 0C 12-pulse serial NK/CTL challenge requires not only <= 8.0% cumulative 12-h specific lysis, but also post-attack surviving beta-cell "
                    "perifusion GSIS SI >= 2.5, shutoff t90 <= 3.0 min, and mature beta identity retention INS+NKX6.1+MAFA+ >= 85% "
                    "(obs_post_stress_mafa_nkx61_beta_identity_retention_pct >= 85.0; MW-R6-S1-12 & MW-R6-S1-15 [DEC-053])."
                ),
            },
            "assembled_cluster_lineage_purity_and_post_stress_beta_identity_gate": {
                "max_slc18a1_fev_tph1_enterochromaffin_pct": 1.0,
                "max_sc_atac_ec_chromatin_spillover_pct": 5.0,
                "min_endocrine_synaptophysin_pos_purity_pct": 95.0,
                "max_ductal_sox9_krt19_double_pos_pct": 0.1,
                "max_ins_gcg_polyhormonal_pct": 2.0,
                "max_ki67_sox9_progenitor_pct": 0.5,
                "min_post_stress_ins_nkx61_mafa_retention_pct": 85.0,
                "wetlab_contract_endpoints": [
                    "obs_assembled_cluster_slc18a1_enterochromaffin_pct",
                    "obs_assembled_cluster_ins_gcg_polyhormonal_pct",
                    "obs_assembled_cluster_ki67_progenitor_pct",
                    "obs_post_stress_mafa_nkx61_beta_identity_retention_pct",
                    "obs_sc_atac_ec_chromatin_spillover_pct",
                    "obs_endocrine_synaptophysin_pos_purity_pct",
                    "obs_ductal_sox9_krt19_double_pos_pct",
                    "obs_enterochromaffin_fev_tph1_pos_pct",
                ],
            },
        },
        "perturbation_profiles": perturbation_profiles,
    }


def _build_s10_hlae_comparator_panel_manifest_iip_0016(
    *,
    iip_0015_manifest: Dict[str, Any],
    arm1b_can: str,
) -> Dict[str, Any]:
    """Deterministically verify all 20 Mode-B S10 Locus-1 comparator constructs (IIP-0016; DEC-094)."""
    s10_fasta_path = REPO_ROOT / "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta"
    if not s10_fasta_path.is_file():
        raise FileNotFoundError(f"Missing Mode-B S10 comparator FASTA: {s10_fasta_path}")

    q_by_id = {c["construct_id"]: c for c in iip_0015_manifest["qualified_mode_b_reference_derivations"]}
    astar_parent = q_by_id["S3_L1_ASTAR_STOP_ONLY_4143"]["donor_sequence"].upper()
    if len(astar_parent) != 4143 or sha256_str(astar_parent) != "aff2ec0d862b9a99f54518465221106444e3ce0f8b055b29dd0f41faac262225":
        raise ValueError("S3_L1_ASTAR_STOP_ONLY_4143 parent sequence SHA-256 mismatch")

    arm1b_chars = list(arm1b_can.upper())
    for edit_tok in ("T583C", "C589A", "G592C", "G595A", "G3146C", "G3148A"):
        ref_nt, pos_1b, alt_nt = edit_tok[0], int(edit_tok[1:-1]), edit_tok[-1]
        if arm1b_chars[pos_1b - 1] != ref_nt:
            raise ValueError(f"ARM1B stop-only derivation mismatch at {edit_tok}")
        arm1b_chars[pos_1b - 1] = alt_nt
    arm1b_parent = "".join(arm1b_chars)
    if len(arm1b_parent) != 3974 or sha256_str(arm1b_parent) != "3d516e2f0fa4408ffe60aa111183ad4e57f4a669c77cba2b2aad15e322d17964":
        raise ValueError("L1_ARM1B_STOP_ONLY_S3_PAM_SHIELDED_3974 parent sequence SHA-256 mismatch")

    fasta_records: List[Tuple[str, Dict[str, str], str]] = []
    cur_id: str | None = None
    cur_kv: Dict[str, str] = {}
    cur_chunks: List[str] = []
    for raw_line in s10_fasta_path.read_text(encoding="utf-8").splitlines():
        if raw_line.startswith(">"):
            if cur_id is not None:
                fasta_records.append((cur_id, cur_kv, "".join(cur_chunks).upper()))
            toks = raw_line[1:].strip().split()
            cur_id = toks[0]
            cur_kv = dict(tok.split("=", 1) for tok in toks[1:])
            cur_chunks = []
        else:
            cur_chunks.append(raw_line.strip())
    if cur_id is not None:
        fasta_records.append((cur_id, cur_kv, "".join(cur_chunks).upper()))
    if len(fasta_records) != 20:
        raise ValueError(f"Expected 20 constructs in {s10_fasta_path.name}, found {len(fasta_records)}")
    fasta_by_id = {cid: (kv, seq) for cid, kv, seq in fasta_records}

    arms_spec = [
        (1, "CTRL_WT_VMAPRTLVL", "BASELINE_PARENTAL_CONTROL", "BASELINE_REFERENCE", False, "VMAPRTLVL", "GTGATGGCCCCCAGAACCCTGGTGCTG", "GTGATGGCCCCCAGAACCCTGGTGCTG", "WT_D227_T228", "GACACC"),
        (2, "CTRL_POS_VMAPRTLFL", "POSITIVE_NKG2C_AGONIST_RATIO_PARADOX_CONTROL", "CALIBRATION_CONTROL_NEVER_PROMOTE", False, "VMAPRTLFL", "GTGATGGCCCCCAGAACCCTCTTCCTC", "GTGATGGCCCCCAGAACCCTGTTCCTG", "WT_D227_T228", "GACACC"),
        (3, "CTRL_NEG_QMRPVSRVL", "GROOVE_STABILIZING_RECEPTOR_PROTECTION_NEGATIVE_CONTROL", "CALIBRATION_CONTROL_NEVER_PROMOTE", False, "QMRPVSRVL", "CAGATGCGTCCCGTGTCCAGAGTGCTC", "CAGATGCGTCCCGTGTCCAGAGTGCTG", "WT_D227_T228", "GACACC"),
        (4, "CHAL1_SP6B_VMAPRTVLL", "EXPLORATORY_WEAK_RECOGNITION_DUAL_ATTENUATED_SP6B_COMPARATOR", "ELIGIBLE_MODE_B_CHALLENGER", True, "VMAPRTVLL", "GTGATGGCCCCCAGAACCGTGCTCCTC", "GTGATGGCCCCCAGAACCGTGCTGCTG", "WT_D227_T228", "GACACC"),
        (5, "CHAL2_SP1B_VTAPRTLLL", "COVALENT_MINUS21T_BYPASS_WEAK_ENHANCER_CALIBRATION_COMPARATOR", "ELIGIBLE_MODE_B_CHALLENGER", True, "VTAPRTLLL", "GTGACCGCCCCCAGAACCCTTCTCCTC", "GTGACCGCCCCCAGAACCCTGCTGCTG", "WT_D227_T228", "GACACC"),
        (6, "CHAL3_SP5A_VMPPRTLLL", "FUNCTIONAL_P3PRO_UL40_COHORT_NULL_WEAK_ENHANCER_COMPARATOR", "ELIGIBLE_MODE_B_CHALLENGER", True, "VMPPRTLLL", "GTGATGCCCCCTAGAACCCTTCTCCTC", "GTGATGCCCCCTAGAACCCTGCTGCTG", "WT_D227_T228", "GACACC"),
        (7, "CHAL4_P8A_VMAPRTLAL", "SYNTHETIC_P8ALA_UL40_NULL_NKG2A_SELECTIVE_MECHANISTIC_PROBE", "ELIGIBLE_MODE_B_CHALLENGER", True, "VMAPRTLAL", "GTGATGGCCCCCAGAACCCTCGCCCTC", "GTGATGGCCCCCAGAACCCTGGCCCTG", "WT_D227_T228", "GACACC"),
        (8, "CHAL5A_WT_VL_D227K_T228A", "SINGLE_FACTOR_ALPHA3_CD8_CORECEPTOR_NULL_CHALLENGER", "ELIGIBLE_MODE_B_CHALLENGER", True, "VMAPRTLVL", "GTGATGGCCCCCAGAACCCTGGTGCTG", "GTGATGGCCCCCAGAACCCTGGTGCTG", "MUT_D227K_T228A", "AAGGCC"),
        (9, "CHAL5B_SP6B_VMAPRTVLL_D227K_T228A", "FACTORIAL_2X2_SP6B_PLUS_ALPHA3_CD8_NULL_CHALLENGER", "ELIGIBLE_MODE_B_CHALLENGER", True, "VMAPRTVLL", "GTGATGGCCCCCAGAACCGTGCTCCTC", "GTGATGGCCCCCAGAACCGTGCTGCTG", "MUT_D227K_T228A", "AAGGCC"),
        (10, "CTRL_HARDWT_VMAPRTLVL", "SYNONYMOUS_CTC_SPLICE_HARDENED_WT_SINGLE_FACTOR_CONTROL", "BASELINE_REFERENCE", False, "VMAPRTLVL", "GTGATGGCCCCCAGAACCCTCGTGCTC", "GTGATGGCCCCCAGAACCCTGGTGCTG", "WT_D227_T228", "GACACC"),
    ]

    cd47_astar_cds = revcomp(astar_parent[876:1404])
    cd47_aa = translate_strict_cds(cd47_astar_cds, True)[:-1]
    wt_astar_scan = scan_donors_and_acceptors_both_strands(astar_parent)
    wt_arm1b_scan = scan_donors_and_acceptors_both_strands(arm1b_parent)
    wt_astar_sub64 = {
        (a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]): a
        for a in scan_donors_and_acceptors_both_strands(astar_parent, min_acc_idx=64.0)["acceptors"]
    }
    wt_arm1b_sub64 = {
        (a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]): a
        for a in scan_donors_and_acceptors_both_strands(arm1b_parent, min_acc_idx=64.0)["acceptors"]
    }

    naive_ctg_runs: List[Dict[str, Any]] = []
    construct_entries: List[Dict[str, Any]] = []

    for arm_idx, short_key, role, elig, is_repl, pep, dna27, naive27, alpha3_allele, hx6 in arms_spec:
        if arm_idx <= 9 and naive27 != astar_parent[1860:1887]:
            for btag, pseq, s0, e0 in (
                ("ASTAR_4143", astar_parent, 1860, 1887),
                ("ARM1B_3974", arm1b_parent, 1706, 1733),
            ):
                d_naive = pseq[:s0] + naive27 + pseq[e0:]
                neos_naive = diff_edit_created_neosites(pseq, d_naive)
                naive_ctg_runs.append({
                    "arm_index": arm_idx,
                    "backbone": btag,
                    "nonamer_aa": pep,
                    "naive_ctg_dna27": naive27,
                    "hardened_ctc_ctt_dna27": dna27,
                    "naive_created_donors_cv70_or_u1_7_count": len(neos_naive["created_donors_cv70_or_u1_7"]),
                    "naive_created_acceptors_idx68_count": len(neos_naive["created_acceptors_idx68"]),
                })

        d_astar = astar_parent[:1860] + dna27 + astar_parent[1887:2982] + hx6 + astar_parent[2988:]
        d_arm1b = arm1b_parent[:1706] + dna27 + arm1b_parent[1733:2813] + hx6 + arm1b_parent[2819:]

        for btag, donor_seq, parent_seq, parent_id, wt_scan, wt_sub64, sct_s0, sct_e0, cd47_s0, cd47_e0, l1_len in (
            ("ASTAR_4143", d_astar, astar_parent, "S3_L1_ASTAR_STOP_ONLY_4143", wt_astar_scan, wt_astar_sub64, 1800, 3318, 876, 1404, 20),
            ("ARM1B_3974", d_arm1b, arm1b_parent, "L1_ARM1B_STOP_ONLY_S3_PAM_SHIELDED_3974", wt_arm1b_scan, wt_arm1b_sub64, 1646, 3149, 722, 1250, 15),
        ):
            cid = f"S10_{short_key}_{btag}"
            if cid not in fasta_by_id:
                raise ValueError(f"Construct {cid} missing from {s10_fasta_path.name}")
            kv, fseq = fasta_by_id[cid]
            sha_hex = sha256_str(donor_seq)
            if fseq != donor_seq or kv.get("sha256") != sha_hex or kv.get("parent") != parent_id or kv.get("role") != role:
                raise ValueError(f"FASTA integrity mismatch on {cid}")

            sct_cds = donor_seq[sct_s0:sct_e0]
            parent_sct_cds = parent_seq[sct_s0:sct_e0]
            sct_aa = translate_strict_cds(sct_cds, True)[:-1]
            parent_sct_aa = translate_strict_cds(parent_sct_cds, True)[:-1]
            aa_diffs = [f"{parent_sct_aa[i]}{i + 1}{sct_aa[i]}" for i in range(len(sct_aa)) if sct_aa[i] != parent_sct_aa[i]]
            pep_wt = "VMAPRTLVL"
            expected_aa_diffs = [
                f"{pep_wt[j]}{21 + j}{pep[j]}"
                for j in range(9)
                if pep[j] != pep_wt[j]
            ]
            if alpha3_allele == "MUT_D227K_T228A":
                expected_aa_diffs.extend([f"D{375 + l1_len}K", f"T{376 + l1_len}A"])
            if aa_diffs != expected_aa_diffs:
                raise ValueError(
                    f"Pinned parental SCT amino-acid substitution mismatch on {cid}: expected {expected_aa_diffs}, got {aa_diffs}"
                )

            b2m_start = 29 + l1_len
            b2m_end = b2m_start + 99
            l2_end = b2m_end + 20
            j_specs = [
                {"junction_id": f"{pep}__G4S{l1_len // 5}_L1", "left_aa": sct_aa[20:29], "linker_aa": "", "right_aa": sct_aa[29:b2m_start]},
                {"junction_id": f"G4S{l1_len // 5}_L1__B2M_mature", "left_aa": sct_aa[29:b2m_start], "linker_aa": "", "right_aa": sct_aa[b2m_start:b2m_end]},
                {"junction_id": "B2M_mature__G4S4_L2", "left_aa": sct_aa[b2m_start:b2m_end], "linker_aa": "", "right_aa": sct_aa[b2m_end:l2_end]},
                {"junction_id": "G4S4_L2__HLAE_alpha1", "left_aa": sct_aa[b2m_end:l2_end], "linker_aa": "", "right_aa": sct_aa[l2_end:]},
                {"junction_id": "CD47_IgV_19_138__CD55_stalk_139_147", "left_aa": cd47_aa[18:138], "linker_aa": "", "right_aa": cd47_aa[138:147]},
            ]
            orf_specs = [
                {
                    "name": "CD47_IgV_GPI_antisense",
                    "start_0based": cd47_s0,
                    "end_0based": cd47_e0,
                    "strand": "-",
                    "has_stop": True,
                    "parent_cds": cd47_astar_cds,
                    "topology_kind": "GPI_ANCHORED_CD47_IGV",
                    "has_downstream_2a": False,
                },
                {
                    "name": f"HLAE_SCT_{l1_len}aaL1_sense",
                    "start_0based": sct_s0,
                    "end_0based": sct_e0,
                    "strand": "+",
                    "has_stop": True,
                    "parent_cds": parent_sct_cds if len(aa_diffs) == 0 else sct_cds,
                    "topology_kind": "TYPE1_TM_HLAE_SCT",
                    "has_downstream_2a": False,
                },
            ]
            p1_p4 = validate_p1_to_p4_fail_closed(
                cid, donor_seq, orf_specs, j_specs, 168, 60, 168, 60,
                ["3CDG", "1MHE", "3BZE", "2JJS", "4CMM", "4KJY"],
                ["Covalent_SCT_ectodomain_NKG2A_NKG2C_SPR_pending_Gate0A"],
            )
            neos = diff_edit_created_neosites(parent_seq, donor_seq)
            m_scan = scan_donors_and_acceptors_both_strands(donor_seq)
            m_sub64 = {
                (a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]): a
                for a in scan_donors_and_acceptors_both_strands(donor_seq, min_acc_idx=64.0)["acceptors"]
            }
            sub68_created = [
                v for k, v in sorted(m_sub64.items())
                if 64.0 <= v["heuristic_acceptor_index"] < 68.0
                and (k not in wt_sub64 or wt_sub64[k]["heuristic_acceptor_index"] != v["heuristic_acceptor_index"])
            ]
            wt_acc_coords = {(a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]) for a in wt_scan["acceptors"]}
            m_acc_coords = {(a["strand_relative_to_input"], a["exon_start_1based_on_input_plus"]) for a in m_scan["acceptors"]}
            if len(neos["created_donors_cv70_or_u1_7"]) != 0 or len(m_acc_coords - wt_acc_coords) != 0:
                raise ValueError(f"Splice hardening regression on {cid}")

            construct_entries.append({
                "construct_id": cid,
                "arm_index": arm_idx,
                "backbone": btag,
                "parent_construct_id": parent_id,
                "role": role,
                "promotion_eligibility": elig,
                "is_replacement_challenger": is_repl,
                "donor_length_bp": len(donor_seq),
                "packaged_aav6_bp": len(donor_seq) + 290,
                "donor_sha256": sha_hex,
                "nonamer_aa": pep,
                "nonamer_dna27": dna27,
                "alpha3_allele": alpha3_allele,
                "sct_precursor_aa_diffs_vs_wt_parent": aa_diffs,
                "junction_8_to_11mer_windows": p1_p4["gate_P3_chimeric_junction_neoepitopes"]["construct_total_8_11mer"],
                "junction_15mer_windows": p1_p4["gate_P3_chimeric_junction_neoepitopes"]["construct_total_15mer"],
                "created_donors_cv70_or_u1_7": len(neos["created_donors_cv70_or_u1_7"]),
                "created_new_acceptor_coordinates": len(m_acc_coords - wt_acc_coords),
                "created_acceptors_idx68_context_shift_count": len(neos["created_acceptors_idx68"]),
                "subthreshold_64_to_68_acceptors_created_or_shifted_count": len(sub68_created),
                "cargo_acceptors_delta_vs_parent": m_scan["cargo_acceptors"] - wt_scan["cargo_acceptors"],
            })

    return {
        "proposal_id": "IIP-0016",
        "decision_id": "DEC-094",
        "mode_b_comparator_fasta": {
            "relative_path": "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta",
            "construct_count": 20,
            "sha256": hashlib.sha256(s10_fasta_path.read_bytes()).hexdigest(),
            "canonical_scenario_a_fasta_untouched": True,
        },
        "divergent_bidirectional_locus1_note": (
            "Locus 1 (Embodiment A* / Arm 1B) is a divergent head-to-head bidirectional cassette "
            "(<- SV40 polyA <- antisense CD47 CDS [877..1404 on ASTAR_4143 / 723..1250 on ARM1B_3974] <- antisense promoter "
            "| sense promoter -> HLA-E SCT CDS [1801..3318 on ASTAR_4143 / 1647..3149 on ARM1B_3974] -> bGH polyA). "
            "Two-strand CTC/CTT Leu codon hardening eliminates +2 naive-CTG minus-strand acceptors (indices 68.46 and 72.46 on SP-6B) "
            "with 0 created donors across all 20 constructs; Arm 3 (Hsp60 QMRPVSRVL) retains 1 sub-threshold sense ('+') motif "
            "CCGTGTCCAG|AGT at heuristic index 67.92 (0.08 below 68.0), reinforcing mandatory Stage-0 5'/3'-RACE across all arms."
        ),
        "mature_vs_precursor_numbering_note": (
            "Mature HLA-E alpha3 D227K/T228A maps to precursor codons D395K/T396A in ASTAR_4143 (20-aa L1) and D390K/T391A in ARM1B_3974 (15-aa L1)."
        ),
        "mhcflurry_2_3_28_scope_and_swissprot_provenance": {
            "uniprot_human_swissprot_records": 20429,
            "uniprot_fasta_gz_sha256": "40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0",
            "mhcflurry_version": "2.3.28",
            "pseudosequence_caveat": (
                "MHCflurry 2.3.28 assigns an identical 39-residue binding-pocket pseudosequence to HLA-E*01:01 and HLA-E*01:03 "
                "and scores free 8-11mers rather than covalent (G4S)n-tethered SCTs; outputs are strictly in silico host Class-I "
                "cross-presentation flags (e.g., synthetic P8=Ala VMAPRTLAL predicted at 17.8 nM on HLA-B*08:01), never proof of stronger SCT stability."
            ),
        },
        "naive_ctg_counterfactuals_both_backbones": naive_ctg_runs,
        "verified_20_constructs": construct_entries,
    }



def _build_species_separated_proteome_census_iip_0017() -> Dict[str, Any]:
    """Return the deterministic species-separated Swiss-Prot-subtracted peptide & TYK2 HLA-C ledger (IIP-0017; DEC-095)."""
    return {'decision_id': 'DEC-095',
 'contribution_id': 'IIP-0017',
 'evidence_class': 'deterministic_swissprot_subtracted_species_separated_sequence_census_and_stage0_gate_specification',
 'canonical_fasta_and_ranking_invariance': {'canonical_scenario_a_fasta': 'data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta',
                                            'canonical_scenario_a_fasta_sha256': 'b5ba4e2b4bbbcc7d6cf1138975c5fae5c6ab074dda43973f071c671cd8cd1d88',
                                            'layer1_stack_scores_and_subjective_odds_modified': False,
                                            'safety_switch_and_duplex_gates_modified': False},
 'primary_citations': ['PMID:32711842',
                       'PMID:37733863',
                       'PMID:23698740',
                       'PMID:27807284',
                       'PMID:30578352',
                       'PMID:36289205',
                       'PMID:30853558',
                       'PMID:29302013',
                       'PMID:40757665',
                       'PMID:22047558',
                       'PMID:9724721',
                       'PMID:11297676',
                       'PMID:15064769',
                       'PMID:37207206',
                       'PMID:39988068',
                       'PMID:37264229'],
 'rule_c3_and_reference_proteome_provenance': {'uniprot_human_swissprot_snapshot': {'license': 'CC-BY-4.0',
                                                                                    'reviewed_canonical_protein_count': 20429,
                                                                                    'fasta_gz_sha256': '40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0',
                                                                                    'unique_canonical_kmers': {'8mer': 10304732,
                                                                                                               '9mer': 10409155,
                                                                                                               '10mer': 10470109,
                                                                                                               '11mer': 10513225,
                                                                                                               '15mer': 10596151},
                                                                                    'corroborated_live_release_2026_04_check': {'reviewed_canonical_protein_count': 20425,
                                                                                                                                'uncompressed_fasta_sha256': '0444b7cf4f4ddca5467aee7e2d86d45fcf440a9a879c791ecfc4cc186ac0b3d7',
                                                                                                                                'matrix_counts_identical_across_snapshots': True},
                                                                                    'scope_qualification': 'Canonical '
                                                                                                           'UniProt/Swiss-Prot '
                                                                                                           'reference '
                                                                                                           'subtraction '
                                                                                                           'flags '
                                                                                                           'non-reference '
                                                                                                           'sequence '
                                                                                                           'windows '
                                                                                                           'across '
                                                                                                           'declared '
                                                                                                           'molecular '
                                                                                                           'species; '
                                                                                                           'it omits '
                                                                                                           'uncataloged '
                                                                                                           'tissue '
                                                                                                           'isoforms, '
                                                                                                           'polymorphic '
                                                                                                           'recipient '
                                                                                                           'allotypes, '
                                                                                                           'post-translational '
                                                                                                           'modifications, '
                                                                                                           'and '
                                                                                                           'proteasome-catalyzed '
                                                                                                           'peptide '
                                                                                                           'splicing. '
                                                                                                           'A human '
                                                                                                           'reference '
                                                                                                           'match does '
                                                                                                           'not '
                                                                                                           'guarantee '
                                                                                                           'peripheral '
                                                                                                           'immune '
                                                                                                           'tolerance '
                                                                                                           'under '
                                                                                                           'ectopic/high-density '
                                                                                                           'expression, '
                                                                                                           'and a '
                                                                                                           'non-match '
                                                                                                           'does not '
                                                                                                           'establish '
                                                                                                           'physical '
                                                                                                           'MHC '
                                                                                                           'presentation '
                                                                                                           'or T-cell '
                                                                                                           'immunogenicity.'},
                                               'mhcflurry_2_3_28_and_v2_3_0_weights_provenance': {'software_package_version': '2.3.28',
                                                                                                  'software_license': 'Apache-2.0 '
                                                                                                                      "(O'Donnell "
                                                                                                                      'et '
                                                                                                                      'al. '
                                                                                                                      '2020 '
                                                                                                                      'PMID:32711842)',
                                                                                                  'weights_bundle': 'models_class1_presentation.20260928 '
                                                                                                                    '(release '
                                                                                                                    'v2.3.0)',
                                                                                                  'training_git_commit': 'ac253f8c859dc687f7fbce9f4840fb55d5acf2c5',
                                                                                                  'pinned_model_file_sha256s': {'DOWNLOAD_INFO.csv': '17c7125cc269d2d7b771898a07e268938d8c3d20d7c01e63c77867c67727b02b',
                                                                                                                                'models/inference_export.json': 'd262b457324fab4a55e32fec7c03fb557f7207428584c1bbece4e00f97bac11b',
                                                                                                                                'models/weights.csv': 'ce91f12e0d6f437ed5477d55fd9df81bef6bdb5a70344be8c6a9f71bd83402fd',
                                                                                                                                'models/percent_ranks.json': '39e53c5ea6ad30d19f59b9822e47832d8b154cd8b28d5a8cab365540fb40e233',
                                                                                                                                'models/affinity_predictor/allele_sequences.csv': '0967249e8d73dc06a675ecfafae71f03f90d13a274bb1c0122140d22d521df8a',
                                                                                                                                'models/affinity_predictor/manifest.csv': '5e749c5b9da19ee2b0467aa2486b447a9e2971b13f7954a803f75f93fc12d56e',
                                                                                                                                'models/affinity_predictor/percent_ranks.json': '9cb4ee611dfce6b7f8c3365bd420546ef4f05e91af3e18ef58abec4dbd30df2b',
                                                                                                                                'models/affinity_predictor/pseudosequences.mhcflurry.39aa.csv': '80bcdf5c250ce9954524b7bffccf80f030add9e9a090dd61bed0380f55652980',
                                                                                                                                'models/processing_predictor_with_flanks/manifest.csv': '57d305002b9924375a9e399684f9e7e6dc08ca6b5af40486d92575e09cc76a7e',
                                                                                                                                'models/processing_predictor_without_flanks/manifest.csv': '93a2ed30e31a905cc30eefdbfea38743fdfa0265857569d5d39d4accb0f4c35f'},
                                                                                                  'excluded_non_open_tools': ['MHCnuggets '
                                                                                                                              '(quarantined '
                                                                                                                              'and '
                                                                                                                              'excluded: '
                                                                                                                              'JHU '
                                                                                                                              'Academic '
                                                                                                                              'Software '
                                                                                                                              'License '
                                                                                                                              'sha256 '
                                                                                                                              '0637b6154f7ad7230deed230346609daaab5ddaade783d22bc165631a7ca27fb)',
                                                                                                                              'NetMHCpan '
                                                                                                                              '/ '
                                                                                                                              'NetMHCIIpan '
                                                                                                                              '(academic-only '
                                                                                                                              'license '
                                                                                                                              'excluded '
                                                                                                                              'under '
                                                                                                                              'Rule '
                                                                                                                              'C3)',
                                                                                                                              'AlphaGenome '
                                                                                                                              '/ '
                                                                                                                              'Boltz '
                                                                                                                              'non-commercial '
                                                                                                                              'outputs '
                                                                                                                              '(excluded '
                                                                                                                              'under '
                                                                                                                              'Rule '
                                                                                                                              'C3)'],
                                                                                                  'methodological_caveats': 'Percentiles '
                                                                                                                            'describe '
                                                                                                                            'empirical '
                                                                                                                            'ranks '
                                                                                                                            'against '
                                                                                                                            'a '
                                                                                                                            'random '
                                                                                                                            'reference-peptide '
                                                                                                                            'score '
                                                                                                                            'distribution '
                                                                                                                            'rather '
                                                                                                                            'than '
                                                                                                                            'physical '
                                                                                                                            'presentation '
                                                                                                                            'probabilities; '
                                                                                                                            'HLA-C*04:01 '
                                                                                                                            '(448.9257 '
                                                                                                                            'nM, '
                                                                                                                            '0.3897% '
                                                                                                                            'presentation '
                                                                                                                            'rank) '
                                                                                                                            'is '
                                                                                                                            'a '
                                                                                                                            'lower-predicted-affinity '
                                                                                                                            'comparator '
                                                                                                                            'rather '
                                                                                                                            'than '
                                                                                                                            'a '
                                                                                                                            'verified '
                                                                                                                            'non-presenter; '
                                                                                                                            'HLA-E*01:01 '
                                                                                                                            'and '
                                                                                                                            'HLA-E*01:03 '
                                                                                                                            'share '
                                                                                                                            'one '
                                                                                                                            '39-aa '
                                                                                                                            'binding-pocket '
                                                                                                                            'pseudosequence '
                                                                                                                            '(1,455.416 '
                                                                                                                            'nM '
                                                                                                                            'for '
                                                                                                                            'SAPTKFLEL); '
                                                                                                                            'and '
                                                                                                                            'free-peptide '
                                                                                                                            'predictors '
                                                                                                                            'can '
                                                                                                                            'diverge '
                                                                                                                            'substantially '
                                                                                                                            'from '
                                                                                                                            'covalent '
                                                                                                                            'SCT '
                                                                                                                            'stability '
                                                                                                                            'and '
                                                                                                                            'presentation '
                                                                                                                            'experiments '
                                                                                                                            '(Finton '
                                                                                                                            'et '
                                                                                                                            'al. '
                                                                                                                            '2023 '
                                                                                                                            'PMID:37207206).'},
                                               'iedb_and_arber_2013_t2a_vs_p2a_reconciliation': {'primary_citation': 'Arber '
                                                                                                                     'et '
                                                                                                                     'al. '
                                                                                                                     '2013 '
                                                                                                                     'Gene '
                                                                                                                     'Ther '
                                                                                                                     'PMID:23698740 '
                                                                                                                     '(PMC3766470)',
                                                                                                 'iedb_license': 'CC-BY-4.0',
                                                                                                 'total_study_iedb_records': 44,
                                                                                                 't2a_spanning_15mer_records_count': 12,
                                                                                                 't2a_records': [{'tcell_id': 1989775,
                                                                                                                  'linear_sequence': 'LFFKTSASRAEGRGS',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989776,
                                                                                                                  'linear_sequence': 'TSASRAEGRGSLLTC',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989777,
                                                                                                                  'linear_sequence': 'RAEGRGSLLTCGDVE',
                                                                                                                  'source_organism_name': 'Thosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus '
                                                                                                                                          '(Setothosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus)',
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Positive'},
                                                                                                                 {'tcell_id': 1989792,
                                                                                                                  'linear_sequence': 'RGSLLTCGDVEENPG',
                                                                                                                  'source_organism_name': 'Thosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus '
                                                                                                                                          '(Setothosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus)',
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989793,
                                                                                                                  'linear_sequence': 'LTCGDVEENPGPMPP',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989794,
                                                                                                                  'linear_sequence': 'DVEENPGPMPPPRLL',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'IFNg '
                                                                                                                                 'release|ELISPOT',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989842,
                                                                                                                  'linear_sequence': 'RAEGRGSLLTCGDVE',
                                                                                                                  'source_organism_name': 'Thosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus '
                                                                                                                                          '(Setothosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus)',
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989845,
                                                                                                                  'linear_sequence': 'LFFKTSASRAEGRGS',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989846,
                                                                                                                  'linear_sequence': 'TSASRAEGRGSLLTC',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989847,
                                                                                                                  'linear_sequence': 'RGSLLTCGDVEENPG',
                                                                                                                  'source_organism_name': 'Thosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus '
                                                                                                                                          '(Setothosea '
                                                                                                                                          'asigna '
                                                                                                                                          'virus)',
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989848,
                                                                                                                  'linear_sequence': 'LTCGDVEENPGPMPP',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'},
                                                                                                                 {'tcell_id': 1989849,
                                                                                                                  'linear_sequence': 'DVEENPGPMPPPRLL',
                                                                                                                  'source_organism_name': None,
                                                                                                                  'assay_names': 'degranulation|biological '
                                                                                                                                 'activity',
                                                                                                                  'qualitative_measure': 'Negative'}],
                                                                                                 'reconciled_interpretation': 'Across '
                                                                                                                              'the '
                                                                                                                              '12 '
                                                                                                                              '2A-TAV '
                                                                                                                              '(T2A)-spanning '
                                                                                                                              '15-mer '
                                                                                                                              'records '
                                                                                                                              'in '
                                                                                                                              'Arber '
                                                                                                                              'et '
                                                                                                                              'al. '
                                                                                                                              '2013 '
                                                                                                                              '(PMID:23698740), '
                                                                                                                              '4 '
                                                                                                                              'internal '
                                                                                                                              'T2A '
                                                                                                                              'records '
                                                                                                                              'carry '
                                                                                                                              'source_organism_name '
                                                                                                                              '= '
                                                                                                                              "'Thosea "
                                                                                                                              'asigna '
                                                                                                                              'virus '
                                                                                                                              '(Setothosea '
                                                                                                                              'asigna '
                                                                                                                              "virus)' "
                                                                                                                              '(1989777 '
                                                                                                                              'RAEGRGSLLTCGDVE '
                                                                                                                              'Positive '
                                                                                                                              'on '
                                                                                                                              'IFNg '
                                                                                                                              'ELISPOT '
                                                                                                                              '[3/16 '
                                                                                                                              'donors '
                                                                                                                              'at '
                                                                                                                              '51.9 '
                                                                                                                              '+/- '
                                                                                                                              '6.9 '
                                                                                                                              'SFCs/10^5 '
                                                                                                                              'cells; '
                                                                                                                              '5/16 '
                                                                                                                              'donors '
                                                                                                                              'T2A-pepmix '
                                                                                                                              'reactive], '
                                                                                                                              '1989792 '
                                                                                                                              'Negative '
                                                                                                                              'on '
                                                                                                                              'IFNg '
                                                                                                                              'ELISPOT, '
                                                                                                                              'and '
                                                                                                                              '1989842 '
                                                                                                                              '/ '
                                                                                                                              '1989847 '
                                                                                                                              'Negative '
                                                                                                                              'on '
                                                                                                                              'CD107a/b '
                                                                                                                              'degranulation), '
                                                                                                                              'while '
                                                                                                                              '8 '
                                                                                                                              'junction-flanking '
                                                                                                                              'synthetic '
                                                                                                                              'fusion '
                                                                                                                              'records '
                                                                                                                              'carry '
                                                                                                                              'source_organism_name '
                                                                                                                              '= '
                                                                                                                              'null '
                                                                                                                              'and '
                                                                                                                              'are '
                                                                                                                              'Negative '
                                                                                                                              'across '
                                                                                                                              'both '
                                                                                                                              'assays '
                                                                                                                              '(6/6 '
                                                                                                                              'CD107a/b '
                                                                                                                              'degranulation '
                                                                                                                              'assays '
                                                                                                                              'Negative; '
                                                                                                                              '0/16 '
                                                                                                                              'donors '
                                                                                                                              'cytotoxic '
                                                                                                                              'and '
                                                                                                                              '0 '
                                                                                                                              'endogenous '
                                                                                                                              'processing '
                                                                                                                              'by '
                                                                                                                              'transduced '
                                                                                                                              'T '
                                                                                                                              'cells; '
                                                                                                                              '0/11 '
                                                                                                                              'donors '
                                                                                                                              'E2A '
                                                                                                                              'reactive). '
                                                                                                                              'Crucially, '
                                                                                                                              'porcine '
                                                                                                                              'teschovirus-1 '
                                                                                                                              'P2A '
                                                                                                                              '(GSGATNFSLLKQAGDVEENPGP, '
                                                                                                                              'encoded '
                                                                                                                              'by '
                                                                                                                              'OpenIslet '
                                                                                                                              'GSG-P2A) '
                                                                                                                              'was '
                                                                                                                              'NOT '
                                                                                                                              'tested '
                                                                                                                              'in '
                                                                                                                              'Arber '
                                                                                                                              'et '
                                                                                                                              'al. '
                                                                                                                              '2013 '
                                                                                                                              '(0 '
                                                                                                                              'hits '
                                                                                                                              'in '
                                                                                                                              'PMC3766470), '
                                                                                                                              'so '
                                                                                                                              'empirical '
                                                                                                                              'recipient '
                                                                                                                              'HLA-DQ2.5/DQ8/DR3/DR4 '
                                                                                                                              'host-APC '
                                                                                                                              'testing '
                                                                                                                              'of '
                                                                                                                              'GSG-P2A '
                                                                                                                              'remains '
                                                                                                                              'mandatory '
                                                                                                                              '(OQ-003 '
                                                                                                                              '/ '
                                                                                                                              'GY-010).'}},
 'legacy_9boundary_partition': {'positional_8_11mer': 326,
                                'unique_8_11mer': 318,
                                'swissprot_reference_unmatched_8_11mer': 285,
                                'swissprot_reference_matched_self_8_11mer': 33,
                                'swissprot_reference_matched_list': ['GGFGDVGA',
                                                                     'GGFGDVGAL',
                                                                     'GGFGDVGALE',
                                                                     'GGFGDVGALES',
                                                                     'GGGGSGGGGSG',
                                                                     'GGGSGGGGSG',
                                                                     'GGSGGFGD',
                                                                     'GGSGGGGSG',
                                                                     'GGSGGGGSGS',
                                                                     'GGSGGGGSI',
                                                                     'GSGGFGDV',
                                                                     'GSGGFGDVG',
                                                                     'GSGGFGDVGA',
                                                                     'GSGGFGDVGAL',
                                                                     'GSGGGGSG',
                                                                     'GSGGGGSGS',
                                                                     'GSGGGGSI',
                                                                     'KYRVVSWFSP',
                                                                     'KYRVVSWFSPN',
                                                                     'LGGGGSGG',
                                                                     'LGGGGSGGG',
                                                                     'LGGGGSGGGG',
                                                                     'LKYRVVSWFSP',
                                                                     'RVVSWFSP',
                                                                     'RVVSWFSPN',
                                                                     'SGGFGDVG',
                                                                     'SGGFGDVGA',
                                                                     'SGGFGDVGAL',
                                                                     'SGGFGDVGALE',
                                                                     'SGGGGSGS',
                                                                     'VVSWFSPN',
                                                                     'YRVVSWFSP',
                                                                     'YRVVSWFSPN'],
                                'positional_15mer': 112,
                                'unique_15mer': 110,
                                'swissprot_reference_unmatched_15mer': 105,
                                'swissprot_reference_matched_self_15mer': 5,
                                'swissprot_reference_matched_15mer_list': ['GGFGDVGALESLRGN',
                                                                           'GSGGFGDVGALESLR',
                                                                           'IIELKYRVVSWFSPN',
                                                                           'SGGFGDVGALESLRG',
                                                                           'TIIELKYRVVSWFSP']},
 'existing_materialized_locus3_comparators_and_native_core_scope': {'donors': {'L3_CANONICAL_4090': {'donor_length_bp': 4090,
                                                                                                     'packaged_aav6_bp_with_2x145_itrs': 4380,
                                                                                                     'donor_sha256': '2fbcf1652f202cd77b7f4739133e6e998226f57bcd9b1635d92bd4b1de4c925c'},
                                                                               'L3_SCARFREE_3799': {'donor_length_bp': 3799,
                                                                                                    'packaged_aav6_bp_with_2x145_itrs': 4089,
                                                                                                    'donor_sha256': '3d6bf68e2f0b70911cfea69255e4733db2862ce3baa2b92ae4206561e284bcf7'},
                                                                               'L3_BFB_BASALFLOOR_4078': {'donor_length_bp': 4078,
                                                                                                          'packaged_aav6_bp_with_2x145_itrs': 4368,
                                                                                                          'donor_sha256': '0a5f714d536cfb427039e50966fbc88cc6f7dbec8252f26bf43f32a359017c7e'}},
                                                                    'pam_shielded_dxl3_3799_sha256': '13cccea841fbb056c1c5f8ab3f083e6729dd35817436c7788d6b294a6e3508c4',
                                                                    'native_protein_core_vs_complete_species_note': 'Canonical '
                                                                                                                    'Locus '
                                                                                                                    '3 '
                                                                                                                    '(4,090 '
                                                                                                                    'bp, '
                                                                                                                    'sha256 '
                                                                                                                    '2fbcf165...) '
                                                                                                                    'produces '
                                                                                                                    'a '
                                                                                                                    '397-aa '
                                                                                                                    'SERPINB9-GSG-P2A '
                                                                                                                    'cistron '
                                                                                                                    'plus '
                                                                                                                    'a '
                                                                                                                    '291-aa '
                                                                                                                    'Pro+PD-L1 '
                                                                                                                    'precursor '
                                                                                                                    '(predicted '
                                                                                                                    'ER '
                                                                                                                    'signal-peptidase '
                                                                                                                    'cleavage '
                                                                                                                    'to '
                                                                                                                    '272-aa '
                                                                                                                    'mature '
                                                                                                                    'PD-L1, '
                                                                                                                    'plus '
                                                                                                                    'unskipped '
                                                                                                                    '688-aa '
                                                                                                                    'readthrough '
                                                                                                                    'species '
                                                                                                                    'gated '
                                                                                                                    'at '
                                                                                                                    '< '
                                                                                                                    '5% '
                                                                                                                    'target), '
                                                                                                                    'whereas '
                                                                                                                    'already-materialized '
                                                                                                                    '2A-free '
                                                                                                                    'L3-BF-B '
                                                                                                                    '(4,078 '
                                                                                                                    'bp, '
                                                                                                                    'sha256 '
                                                                                                                    '0a5f714d...) '
                                                                                                                    'and '
                                                                                                                    'DX-L3 '
                                                                                                                    '(3,799 '
                                                                                                                    'bp '
                                                                                                                    'unshielded '
                                                                                                                    'reference '
                                                                                                                    'sha256 '
                                                                                                                    '3d6bf68e..., '
                                                                                                                    'kept '
                                                                                                                    'distinct '
                                                                                                                    'from '
                                                                                                                    'PAM-shielded '
                                                                                                                    'synthesis '
                                                                                                                    'derivative '
                                                                                                                    'sha256 '
                                                                                                                    '13cccea8...) '
                                                                                                                    'share '
                                                                                                                    'identical '
                                                                                                                    'native '
                                                                                                                    'protein '
                                                                                                                    'cores '
                                                                                                                    '(376-aa '
                                                                                                                    'SERPINB9 '
                                                                                                                    'and '
                                                                                                                    '272-aa '
                                                                                                                    'mature '
                                                                                                                    'PD-L1 '
                                                                                                                    'from '
                                                                                                                    '290-aa '
                                                                                                                    'native '
                                                                                                                    'precursor) '
                                                                                                                    'while '
                                                                                                                    'differing '
                                                                                                                    'in '
                                                                                                                    'complete '
                                                                                                                    'precursor/stub '
                                                                                                                    'species '
                                                                                                                    'and '
                                                                                                                    'transcriptional '
                                                                                                                    'architecture.'},
 'species_catalog_22_molecular_species': {'species_count_reconciliation': 'Catalogs 22 distinct molecular species (the '
                                                                          '21 species in the S3 clean-core union — 11 '
                                                                          'mature/processed chains, 7 ER/post-2A '
                                                                          'precursors, 2 uncleaved 2A readthrough '
                                                                          'fusions [697-aa Arm 1A, 688-aa Locus 3], '
                                                                          'and the 537-aa Embodiment A* unhardened B2M '
                                                                          'Exon-2 cryptic-splice frameshift species — '
                                                                          'plus the corresponding 532-aa Arm 1B '
                                                                          'unhardened B2M Exon-2 cryptic-splice '
                                                                          'frameshift species). In both 537-aa (291 '
                                                                          'pos / 288 unique 8-11; 109 pos / 101 unique '
                                                                          '15) and 532-aa (290 pos / 288 unique 8-11; '
                                                                          '104 pos / 101 unique 15) cryptic-splice '
                                                                          'species, 128 8-11mers and 32 15mers '
                                                                          'actually touch the 32-aa B2M Exon-2 '
                                                                          '+1-frame tail while the remaining windows '
                                                                          'arise from the upstream HLA-E SCT linkers. '
                                                                          'Across the 22-species union there are '
                                                                          'exactly 659 distinct Swiss-Prot-unmatched '
                                                                          '8-11mers, 768 distinct (peptide, 5-aa '
                                                                          'n_flank, 5-aa c_flank) contexts, and 94 '
                                                                          'peptides occurring in multiple flank '
                                                                          'contexts.',
                                          'union_context_preservation_summary': {'distinct_unmatched_peptides_8_11mer': 659,
                                                                                 'distinct_peptide_flank_contexts_8_11mer': 768,
                                                                                 'peptides_occurring_in_multiple_flank_contexts': 94},
                                          'per_species_ledger': {'HLAE_SCT_Arm1A_mature_with_P2A_501aa': {'length_aa': 501,
                                                                                                          'sha256': 'af3a6d11ce66f1d69adc6871ce92618008d854196d713131c989dda6c3b5319b',
                                                                                                          'positional_unmatched_8_11mer': 213,
                                                                                                          'unique_unmatched_8_11mer': 211,
                                                                                                          'distinct_flank_contexts_8_11mer': 213,
                                                                                                          'positional_unmatched_15mer': 79,
                                                                                                          'unique_unmatched_15mer': 76},
                                                                 'HLAE_SCT_Arm1B_15aaL1_mature_480aa': {'length_aa': 480,
                                                                                                        'sha256': '178b1c5377a0ecccda4ad398cc4c4208b1599e8d245177b5e482f14a366e7f79',
                                                                                                        'positional_unmatched_8_11mer': 129,
                                                                                                        'unique_unmatched_8_11mer': 127,
                                                                                                        'distinct_flank_contexts_8_11mer': 129,
                                                                                                        'positional_unmatched_15mer': 58,
                                                                                                        'unique_unmatched_15mer': 55},
                                                                 'HLAE_SCT_EmbodimentAstar_20aaL1_mature_485aa': {'length_aa': 485,
                                                                                                                  'sha256': 'b6f6de69719ae1cefea9d24e0533e04006430f10e2c35b95f191131f31e094a8',
                                                                                                                  'positional_unmatched_8_11mer': 130,
                                                                                                                  'unique_unmatched_8_11mer': 127,
                                                                                                                  'distinct_flank_contexts_8_11mer': 130,
                                                                                                                  'positional_unmatched_15mer': 63,
                                                                                                                  'unique_unmatched_15mer': 55},
                                                                 'CD47_IgV_GPI_WT_Cys15_mature_129aa': {'length_aa': 129,
                                                                                                        'sha256': '8da1592d946815faf4dd12f1845a9bc9cdbc1820d3df60c05d106e0f33670883',
                                                                                                        'positional_unmatched_8_11mer': 25,
                                                                                                        'unique_unmatched_8_11mer': 25,
                                                                                                        'distinct_flank_contexts_8_11mer': 25,
                                                                                                        'positional_unmatched_15mer': 7,
                                                                                                        'unique_unmatched_15mer': 7},
                                                                 'CD47_IgV_GPI_Arm1X_C15G_mature_129aa': {'length_aa': 129,
                                                                                                          'sha256': 'b99e46848d592d325ddd7426806203ac8eb2809b1f2a3c97d9ad19b8396da5a8',
                                                                                                          'positional_unmatched_8_11mer': 63,
                                                                                                          'unique_unmatched_8_11mer': 63,
                                                                                                          'distinct_flank_contexts_8_11mer': 63,
                                                                                                          'positional_unmatched_15mer': 22,
                                                                                                          'unique_unmatched_15mer': 22},
                                                                 'SERPINB9_with_P2A_Locus3_canonical_397aa': {'length_aa': 397,
                                                                                                              'sha256': '2cba54d74a7809015d496bce611ebea1af43f26aafba0b989cfa5bb4af5812fa',
                                                                                                              'positional_unmatched_8_11mer': 84,
                                                                                                              'unique_unmatched_8_11mer': 84,
                                                                                                              'distinct_flank_contexts_8_11mer': 84,
                                                                                                              'positional_unmatched_15mer': 21,
                                                                                                              'unique_unmatched_15mer': 21},
                                                                 'SERPINB9_WT_scarfree_L3BFB_4078bp_376aa': {'length_aa': 376,
                                                                                                             'sha256': '5941182405e96639c6b0faccdeee7b72d773cd2ab67405bb49143592bebc6567',
                                                                                                             'positional_unmatched_8_11mer': 0,
                                                                                                             'unique_unmatched_8_11mer': 0,
                                                                                                             'distinct_flank_contexts_8_11mer': 0,
                                                                                                             'positional_unmatched_15mer': 0,
                                                                                                             'unique_unmatched_15mer': 0},
                                                                 'PDL1_mature_272aa': {'length_aa': 272,
                                                                                       'sha256': 'dd57f4093f48274aba79b402470e8eb3cbedb164d764d59d922f2a89187c93b9',
                                                                                       'positional_unmatched_8_11mer': 0,
                                                                                       'unique_unmatched_8_11mer': 0,
                                                                                       'distinct_flank_contexts_8_11mer': 0,
                                                                                       'positional_unmatched_15mer': 0,
                                                                                       'unique_unmatched_15mer': 0},
                                                                 'iCasp9_cytosolic_monomer_396aa': {'length_aa': 396,
                                                                                                    'sha256': '9c658142531fb4fbad7b80d7c94d412118e2a878122ab6795bbac88035e836de',
                                                                                                    'positional_unmatched_8_11mer': 83,
                                                                                                    'unique_unmatched_8_11mer': 83,
                                                                                                    'distinct_flank_contexts_8_11mer': 83,
                                                                                                    'positional_unmatched_15mer': 32,
                                                                                                    'unique_unmatched_15mer': 32},
                                                                 'TYK2_WT_1187aa': {'length_aa': 1187,
                                                                                    'sha256': '3f6b27ef15f1a0769f6d67bc2e74c379d3b7bd9e36093cb9bb74486a4a241890',
                                                                                    'positional_unmatched_8_11mer': 0,
                                                                                    'unique_unmatched_8_11mer': 0,
                                                                                    'distinct_flank_contexts_8_11mer': 0,
                                                                                    'positional_unmatched_15mer': 0,
                                                                                    'unique_unmatched_15mer': 0},
                                                                 'TYK2_P1104A_c3310CG_1187aa': {'length_aa': 1187,
                                                                                                'sha256': '15b05dca3761952b9d7ca904e17fa2ed3da919588e636873c326604bde6fb087',
                                                                                                'positional_unmatched_8_11mer': 38,
                                                                                                'unique_unmatched_8_11mer': 38,
                                                                                                'distinct_flank_contexts_8_11mer': 38,
                                                                                                'positional_unmatched_15mer': 15,
                                                                                                'unique_unmatched_15mer': 15},
                                                                 'HLAE_SCT_Arm1A_precursor_521aa': {'length_aa': 521,
                                                                                                    'sha256': '40bae37521bec09819ae9ac5395a6344b21e596b8e347ec494c08e604dc4d9eb',
                                                                                                    'positional_unmatched_8_11mer': 246,
                                                                                                    'unique_unmatched_8_11mer': 244,
                                                                                                    'distinct_flank_contexts_8_11mer': 246,
                                                                                                    'positional_unmatched_15mer': 93,
                                                                                                    'unique_unmatched_15mer': 90},
                                                                 'HLAE_SCT_Arm1B_precursor_500aa': {'length_aa': 500,
                                                                                                    'sha256': 'a55d6e121d4528648c606fab355bf63a701581116f04898af5249bbdbefe8177',
                                                                                                    'positional_unmatched_8_11mer': 162,
                                                                                                    'unique_unmatched_8_11mer': 160,
                                                                                                    'distinct_flank_contexts_8_11mer': 162,
                                                                                                    'positional_unmatched_15mer': 72,
                                                                                                    'unique_unmatched_15mer': 69},
                                                                 'HLAE_SCT_EmbodimentAstar_precursor_505aa': {'length_aa': 505,
                                                                                                              'sha256': '56dca2c1a5fc00252920dec9d6d9391976be3993ae4d838ce3885df1a1e71281',
                                                                                                              'positional_unmatched_8_11mer': 163,
                                                                                                              'unique_unmatched_8_11mer': 160,
                                                                                                              'distinct_flank_contexts_8_11mer': 163,
                                                                                                              'positional_unmatched_15mer': 77,
                                                                                                              'unique_unmatched_15mer': 69},
                                                                 'CD47_Arm1A_postP2A_Pro_precursor_176aa': {'length_aa': 176,
                                                                                                            'sha256': 'b9315764d80f1f4b392ad60bf05ab18428352eec56ad60f15643889377a43fbb',
                                                                                                            'positional_unmatched_8_11mer': 30,
                                                                                                            'unique_unmatched_8_11mer': 30,
                                                                                                            'distinct_flank_contexts_8_11mer': 30,
                                                                                                            'positional_unmatched_15mer': 13,
                                                                                                            'unique_unmatched_15mer': 13},
                                                                 'CD47_Arm1B_nativeSP_precursor_175aa': {'length_aa': 175,
                                                                                                         'sha256': '14c634833d8775819193419862c3950d6f54395c0e696d75748a0d06c3f767b3',
                                                                                                         'positional_unmatched_8_11mer': 26,
                                                                                                         'unique_unmatched_8_11mer': 26,
                                                                                                         'distinct_flank_contexts_8_11mer': 26,
                                                                                                         'positional_unmatched_15mer': 12,
                                                                                                         'unique_unmatched_15mer': 12},
                                                                 'PDL1_postP2A_Pro_precursor_291aa': {'length_aa': 291,
                                                                                                      'sha256': 'a682b44b57ac479f67af2e43de88acb5d39de3cf8c32b42996cac2c8b337fb9a',
                                                                                                      'positional_unmatched_8_11mer': 4,
                                                                                                      'unique_unmatched_8_11mer': 4,
                                                                                                      'distinct_flank_contexts_8_11mer': 4,
                                                                                                      'positional_unmatched_15mer': 1,
                                                                                                      'unique_unmatched_15mer': 1},
                                                                 'PDL1_nativeSP_precursor_290aa': {'length_aa': 290,
                                                                                                   'sha256': 'b1b17c7fca3cbab15bc66b90bd4c07f73617cb5a03db105b0a38084fe7bca48b',
                                                                                                   'positional_unmatched_8_11mer': 0,
                                                                                                   'unique_unmatched_8_11mer': 0,
                                                                                                   'distinct_flank_contexts_8_11mer': 0,
                                                                                                   'positional_unmatched_15mer': 0,
                                                                                                   'unique_unmatched_15mer': 0},
                                                                 'Locus1_Arm1A_uncleaved_HLAE_P2A_CD47_697aa': {'length_aa': 697,
                                                                                                                'sha256': '05a098488326e504fd92b0575ef1b4dc3e4a4ef346025f7273000f8d42227cac',
                                                                                                                'positional_unmatched_8_11mer': 310,
                                                                                                                'unique_unmatched_8_11mer': 308,
                                                                                                                'distinct_flank_contexts_8_11mer': 310,
                                                                                                                'positional_unmatched_15mer': 120,
                                                                                                                'unique_unmatched_15mer': 117},
                                                                 'Locus3_canonical_uncleaved_SERPINB9_P2A_PDL1_688aa': {'length_aa': 688,
                                                                                                                        'sha256': 'd4b76ab36859b2f884895ff983bf96fb861de1eebd6ecb4cb574b19c9fbbe34b',
                                                                                                                        'positional_unmatched_8_11mer': 122,
                                                                                                                        'unique_unmatched_8_11mer': 122,
                                                                                                                        'distinct_flank_contexts_8_11mer': 122,
                                                                                                                        'positional_unmatched_15mer': 36,
                                                                                                                        'unique_unmatched_15mer': 36},
                                                                 'Locus1_unhardened_B2M_Exon2_cryptic_splice_537aa': {'length_aa': 537,
                                                                                                                      'sha256': 'a9906c035373b3445147f1d21b20370a94938f60e940342c58f699e90903c3ae',
                                                                                                                      'positional_unmatched_8_11mer': 291,
                                                                                                                      'unique_unmatched_8_11mer': 288,
                                                                                                                      'distinct_flank_contexts_8_11mer': 291,
                                                                                                                      'positional_unmatched_15mer': 109,
                                                                                                                      'unique_unmatched_15mer': 101},
                                                                 'Locus1_unhardened_Arm1B_B2M_Exon2_cryptic_splice_532aa': {'length_aa': 532,
                                                                                                                            'sha256': 'aef6df26d0428bf7ac6a96b0c45cf87e370205b8ca6c54a54debfb75c0ebeb50',
                                                                                                                            'positional_unmatched_8_11mer': 290,
                                                                                                                            'unique_unmatched_8_11mer': 288,
                                                                                                                            'distinct_flank_contexts_8_11mer': 290,
                                                                                                                            'positional_unmatched_15mer': 104,
                                                                                                                            'unique_unmatched_15mer': 101}}},
 'causally_separated_architecture_census': {'design_identity_boundary_note': 'Preserves strict separation across '
                                                                             'Design A (B2M-/- pure MHC-I/II-null), '
                                                                             'scored 6-locus Scenario B '
                                                                             '(unmaterialized TYK2-/- KO '
                                                                             'ISLET1_B1_6LOCUS_TYK2_KO_INS), Design '
                                                                             'B-WT (WT TYK2 1104P retained-HLA-C '
                                                                             'counterfactual ISLET1_B2_5LOCUS_BASE), '
                                                                             'Design B2 (K=5, B=1 TYK2 p.Pro1104Ala '
                                                                             'prime-edited counterfactual '
                                                                             'ISLET1_B2_5LOCUS_TYK2_PE), and Track-2 '
                                                                             "B'-SCT (covalent self-peptide HLA-C SCT "
                                                                             'at CIITA Exon 5 with B2M-/-). '
                                                                             'Mature-only and precursor+readthrough '
                                                                             'inventories are reported side-by-side.',
                                            'architectures': {'DesignA_Arm1A_2xP2A_mature_only': {'included_species': ['HLAE_SCT_Arm1A_mature_with_P2A_501aa',
                                                                                                                       'CD47_IgV_GPI_WT_Cys15_mature_129aa',
                                                                                                                       'SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                       'PDL1_mature_272aa',
                                                                                                                       'iCasp9_cytosolic_monomer_396aa'],
                                                                                                  'positional_unmatched_8_11mer_sum': 405,
                                                                                                  'unique_unmatched_8_11mer_count': 353,
                                                                                                  'distinct_peptide_flank_contexts_8_11mer': 375,
                                                                                                  'positional_unmatched_15mer_sum': 139,
                                                                                                  'unique_unmatched_15mer_count': 129},
                                                              'DesignA_Arm1A_2xP2A_with_precursors_and_readthrough': {'included_species': ['HLAE_SCT_Arm1A_precursor_521aa',
                                                                                                                                           'CD47_Arm1A_postP2A_Pro_precursor_176aa',
                                                                                                                                           'Locus1_Arm1A_uncleaved_HLAE_P2A_CD47_697aa',
                                                                                                                                           'SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                           'PDL1_postP2A_Pro_precursor_291aa',
                                                                                                                                           'Locus3_canonical_uncleaved_SERPINB9_P2A_PDL1_688aa',
                                                                                                                                           'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                      'positional_unmatched_8_11mer_sum': 879,
                                                                                                                      'unique_unmatched_8_11mer_count': 455,
                                                                                                                      'distinct_peptide_flank_contexts_8_11mer': 525,
                                                                                                                      'positional_unmatched_15mer_sum': 316,
                                                                                                                      'unique_unmatched_15mer_count': 176},
                                                              'DesignA_EmbodimentAstar_1xP2A_with_precursors_and_readthrough': {'included_species': ['HLAE_SCT_EmbodimentAstar_precursor_505aa',
                                                                                                                                                     'CD47_Arm1B_nativeSP_precursor_175aa',
                                                                                                                                                     'SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                                     'PDL1_postP2A_Pro_precursor_291aa',
                                                                                                                                                     'Locus3_canonical_uncleaved_SERPINB9_P2A_PDL1_688aa',
                                                                                                                                                     'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                                'positional_unmatched_8_11mer_sum': 482,
                                                                                                                                'unique_unmatched_8_11mer_count': 391,
                                                                                                                                'distinct_peptide_flank_contexts_8_11mer': 418,
                                                                                                                                'positional_unmatched_15mer_sum': 179,
                                                                                                                                'unique_unmatched_15mer_count': 149},
                                                              'DesignA_EmbodimentAstar_plus_existing_L3BFB_4078bp_0xP2A_with_precursors': {'included_species': ['HLAE_SCT_EmbodimentAstar_precursor_505aa',
                                                                                                                                                                'CD47_Arm1B_nativeSP_precursor_175aa',
                                                                                                                                                                'SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                                'PDL1_nativeSP_precursor_290aa',
                                                                                                                                                                'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                                           'positional_unmatched_8_11mer_sum': 272,
                                                                                                                                           'unique_unmatched_8_11mer_count': 269,
                                                                                                                                           'distinct_peptide_flank_contexts_8_11mer': 272,
                                                                                                                                           'positional_unmatched_15mer_sum': 121,
                                                                                                                                           'unique_unmatched_15mer_count': 113},
                                                              'DesignA_Arm1B_15aaL1_plus_existing_L3BFB_4078bp_0xP2A_with_precursors': {'included_species': ['HLAE_SCT_Arm1B_precursor_500aa',
                                                                                                                                                             'CD47_Arm1B_nativeSP_precursor_175aa',
                                                                                                                                                             'SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                             'PDL1_nativeSP_precursor_290aa',
                                                                                                                                                             'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                                        'positional_unmatched_8_11mer_sum': 271,
                                                                                                                                        'unique_unmatched_8_11mer_count': 269,
                                                                                                                                        'distinct_peptide_flank_contexts_8_11mer': 271,
                                                                                                                                        'positional_unmatched_15mer_sum': 116,
                                                                                                                                        'unique_unmatched_15mer_count': 113},
                                                              'DesignB_WT_TYK2_plus_Canonical_P2A_Locus3': {'included_species': ['SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                 'PDL1_postP2A_Pro_precursor_291aa',
                                                                                                                                 'Locus3_canonical_uncleaved_SERPINB9_P2A_PDL1_688aa',
                                                                                                                                 'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                 'TYK2_WT_1187aa'],
                                                                                                            'positional_unmatched_8_11mer_sum': 293,
                                                                                                            'unique_unmatched_8_11mer_count': 205,
                                                                                                            'distinct_peptide_flank_contexts_8_11mer': 229,
                                                                                                            'positional_unmatched_15mer_sum': 90,
                                                                                                            'unique_unmatched_15mer_count': 68,
                                                                                                            'hlac_14allele_panel': {'peptide_allele_pairs_affinity_le_500nM': 38,
                                                                                                                                    'peptide_allele_pairs_affinity_le_100nM': 11,
                                                                                                                                    'peptide_allele_pairs_affinity_le_50nM': 4,
                                                                                                                                    'peptide_allele_pairs_best_context_pres_pct_le_0_5': 8,
                                                                                                                                    'alleles_with_any_binder_le_500nM': '12/14',
                                                                                                                                    'alleles_with_any_binder_le_100nM': '7/14'}},
                                                              'DesignB_WT_TYK2_plus_Existing_ScarFree_L3BFB_4078bp_or_DXL3_3799bp': {'included_species': ['SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                          'PDL1_nativeSP_precursor_290aa',
                                                                                                                                                          'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                                          'TYK2_WT_1187aa'],
                                                                                                                                     'positional_unmatched_8_11mer_sum': 83,
                                                                                                                                     'unique_unmatched_8_11mer_count': 83,
                                                                                                                                     'distinct_peptide_flank_contexts_8_11mer': 83,
                                                                                                                                     'positional_unmatched_15mer_sum': 32,
                                                                                                                                     'unique_unmatched_15mer_count': 32,
                                                                                                                                     'hlac_14allele_panel': {'peptide_allele_pairs_affinity_le_500nM': 5,
                                                                                                                                                             'peptide_allele_pairs_affinity_le_100nM': 0,
                                                                                                                                                             'peptide_allele_pairs_affinity_le_50nM': 0,
                                                                                                                                                             'peptide_allele_pairs_best_context_pres_pct_le_0_5': 0,
                                                                                                                                                             'alleles_with_any_binder_le_500nM': '2/14',
                                                                                                                                                             'alleles_with_any_binder_le_100nM': '0/14'}},
                                                              'DesignB2_TYK2_P1104A_plus_Canonical_P2A_Locus3': {'included_species': ['SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                      'PDL1_postP2A_Pro_precursor_291aa',
                                                                                                                                      'Locus3_canonical_uncleaved_SERPINB9_P2A_PDL1_688aa',
                                                                                                                                      'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                      'TYK2_P1104A_c3310CG_1187aa'],
                                                                                                                 'positional_unmatched_8_11mer_sum': 331,
                                                                                                                 'unique_unmatched_8_11mer_count': 243,
                                                                                                                 'distinct_peptide_flank_contexts_8_11mer': 267,
                                                                                                                 'positional_unmatched_15mer_sum': 105,
                                                                                                                 'unique_unmatched_15mer_count': 83,
                                                                                                                 'hlac_14allele_panel': {'peptide_allele_pairs_affinity_le_500nM': 78,
                                                                                                                                         'peptide_allele_pairs_affinity_le_100nM': 26,
                                                                                                                                         'peptide_allele_pairs_affinity_le_50nM': 12,
                                                                                                                                         'peptide_allele_pairs_best_context_pres_pct_le_0_5': 27,
                                                                                                                                         'alleles_with_any_binder_le_500nM': '14/14',
                                                                                                                                         'alleles_with_any_binder_le_100nM': '13/14'}},
                                                              'DesignB2_TYK2_P1104A_plus_Existing_ScarFree_L3BFB_4078bp_or_DXL3_3799bp': {'included_species': ['SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                               'PDL1_nativeSP_precursor_290aa',
                                                                                                                                                               'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                                               'TYK2_P1104A_c3310CG_1187aa'],
                                                                                                                                          'positional_unmatched_8_11mer_sum': 121,
                                                                                                                                          'unique_unmatched_8_11mer_count': 121,
                                                                                                                                          'distinct_peptide_flank_contexts_8_11mer': 121,
                                                                                                                                          'positional_unmatched_15mer_sum': 47,
                                                                                                                                          'unique_unmatched_15mer_count': 47,
                                                                                                                                          'hlac_14allele_panel': {'peptide_allele_pairs_affinity_le_500nM': 45,
                                                                                                                                                                  'peptide_allele_pairs_affinity_le_100nM': 15,
                                                                                                                                                                  'peptide_allele_pairs_affinity_le_50nM': 8,
                                                                                                                                                                  'peptide_allele_pairs_best_context_pres_pct_le_0_5': 19,
                                                                                                                                                                  'alleles_with_any_binder_le_500nM': '14/14',
                                                                                                                                                                  'alleles_with_any_binder_le_100nM': '12/14'}},
                                                              'DesignA_EmbodimentAstar_1xP2A_mature_only_WT_TYK2': {'included_species': ['HLAE_SCT_EmbodimentAstar_20aaL1_mature_485aa',
                                                                                                                                         'CD47_IgV_GPI_WT_Cys15_mature_129aa',
                                                                                                                                         'SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                         'PDL1_mature_272aa',
                                                                                                                                         'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                    'positional_unmatched_8_11mer_sum': 322,
                                                                                                                    'unique_unmatched_8_11mer_count': 319,
                                                                                                                    'distinct_peptide_flank_contexts_8_11mer': 322,
                                                                                                                    'positional_unmatched_15mer_sum': 123,
                                                                                                                    'unique_unmatched_15mer_count': 115},
                                                              'DesignA_EmbodimentAstar_1xP2A_mature_only_plus_optional_TYK2_P1104A': {'included_species': ['HLAE_SCT_EmbodimentAstar_20aaL1_mature_485aa',
                                                                                                                                                           'CD47_IgV_GPI_WT_Cys15_mature_129aa',
                                                                                                                                                           'SERPINB9_with_P2A_Locus3_canonical_397aa',
                                                                                                                                                           'PDL1_mature_272aa',
                                                                                                                                                           'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                                           'TYK2_P1104A_c3310CG_1187aa'],
                                                                                                                                      'positional_unmatched_8_11mer_sum': 360,
                                                                                                                                      'unique_unmatched_8_11mer_count': 357,
                                                                                                                                      'distinct_peptide_flank_contexts_8_11mer': 360,
                                                                                                                                      'positional_unmatched_15mer_sum': 138,
                                                                                                                                      'unique_unmatched_15mer_count': 130},
                                                              'DesignA_EmbodimentAstar_plus_existing_L3BFB_4078bp_0xP2A_mature_only_WT_TYK2': {'included_species': ['HLAE_SCT_EmbodimentAstar_20aaL1_mature_485aa',
                                                                                                                                                                    'CD47_IgV_GPI_WT_Cys15_mature_129aa',
                                                                                                                                                                    'SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                                    'PDL1_mature_272aa',
                                                                                                                                                                    'iCasp9_cytosolic_monomer_396aa'],
                                                                                                                                               'positional_unmatched_8_11mer_sum': 238,
                                                                                                                                               'unique_unmatched_8_11mer_count': 235,
                                                                                                                                               'distinct_peptide_flank_contexts_8_11mer': 238,
                                                                                                                                               'positional_unmatched_15mer_sum': 102,
                                                                                                                                               'unique_unmatched_15mer_count': 94},
                                                              'DesignA_EmbodimentAstar_plus_existing_L3BFB_4078bp_0xP2A_mature_only_plus_optional_TYK2_P1104A': {'included_species': ['HLAE_SCT_EmbodimentAstar_20aaL1_mature_485aa',
                                                                                                                                                                                      'CD47_IgV_GPI_WT_Cys15_mature_129aa',
                                                                                                                                                                                      'SERPINB9_WT_scarfree_L3BFB_4078bp_376aa',
                                                                                                                                                                                      'PDL1_mature_272aa',
                                                                                                                                                                                      'iCasp9_cytosolic_monomer_396aa',
                                                                                                                                                                                      'TYK2_P1104A_c3310CG_1187aa'],
                                                                                                                                                                 'positional_unmatched_8_11mer_sum': 276,
                                                                                                                                                                 'unique_unmatched_8_11mer_count': 273,
                                                                                                                                                                 'distinct_peptide_flank_contexts_8_11mer': 276,
                                                                                                                                                                 'positional_unmatched_15mer_sum': 117,
                                                                                                                                                                 'unique_unmatched_15mer_count': 109}}},
 'tyk2_p1104a_32row_hlac_and_hlae_presentation_table': {'coding_hgvs': 'NM_003331.5:c.3310C>G (p.Pro1104Ala, '
                                                                       'rs34536443)',
                                                        'genomic_grch38': 'chr19:10352442G>C (minus-strand '
                                                                          'ENST00000525621.6 / UniProt P29597)',
                                                        'wt_nonamer': 'SPPTKFLEL',
                                                        'mutant_p2_ala_nonamer': 'SAPTKFLEL',
                                                        'flanks_5aa': {'n_flank': 'CDSSQ', 'c_flank': 'IGIAQ'},
                                                        'hlac_leader_vs_hlab_dimorphism_note': 'All 14 HLA-C alleles '
                                                                                               'are annotated directly '
                                                                                               'from IPD-IMGT/HLA '
                                                                                               'C_prot.fasta by HLA-C '
                                                                                               'leader peptide class '
                                                                                               '(SP-1C VMAPRTLIL, '
                                                                                               'SP-2C VMAPRTLLL, SP-3C '
                                                                                               'VMAPRALLL; Lin et al. '
                                                                                               '2023 PMID:37264229) '
                                                                                               'and mature alpha1 '
                                                                                               'residues 77/80 KIR2DL '
                                                                                               'group (C1 Ser77/Asn80 '
                                                                                               'vs C2 Asn77/Lys80), '
                                                                                               'kept strictly distinct '
                                                                                               "from HLA-B's -21M/-21T "
                                                                                               'leader dimorphism '
                                                                                               '(Ramsuran et al. 2018 '
                                                                                               'PMID:29302013; '
                                                                                               'GY-005).',
                                                        'rows': [{'allele': 'HLA-C*01:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 42.7524,
                                                                  'affinity_percentile': 0.1031,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.914807,
                                                                  'presentation_percentile': 0.1011},
                                                                 {'allele': 'HLA-C*01:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 12.9153,
                                                                  'affinity_percentile': 0.0004,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.99082,
                                                                  'presentation_percentile': 0.0032},
                                                                 {'allele': 'HLA-C*02:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-2C '
                                                                                                       '(VMAPRTLLL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 993.9797,
                                                                  'affinity_percentile': 3.1146,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.279089,
                                                                  'presentation_percentile': 1.3521},
                                                                 {'allele': 'HLA-C*02:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-2C '
                                                                                                       '(VMAPRTLLL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 31.375,
                                                                  'affinity_percentile': 0.0837,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.976891,
                                                                  'presentation_percentile': 0.0152},
                                                                 {'allele': 'HLA-C*03:04',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 170.2878,
                                                                  'affinity_percentile': 0.9174,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.71386,
                                                                  'presentation_percentile': 0.3953},
                                                                 {'allele': 'HLA-C*03:04',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 20.7529,
                                                                  'affinity_percentile': 0.0369,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.984942,
                                                                  'presentation_percentile': 0.0077},
                                                                 {'allele': 'HLA-C*04:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 341.3328,
                                                                  'affinity_percentile': 0.4255,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.544836,
                                                                  'presentation_percentile': 0.667},
                                                                 {'allele': 'HLA-C*04:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 448.9257,
                                                                  'affinity_percentile': 0.5158,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.717893,
                                                                  'presentation_percentile': 0.3897},
                                                                 {'allele': 'HLA-C*05:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 670.4509,
                                                                  'affinity_percentile': 1.4554,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.369787,
                                                                  'presentation_percentile': 1.045},
                                                                 {'allele': 'HLA-C*05:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 102.4305,
                                                                  'affinity_percentile': 0.4438,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.923762,
                                                                  'presentation_percentile': 0.089},
                                                                 {'allele': 'HLA-C*06:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 1106.8543,
                                                                  'affinity_percentile': 2.2647,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.256817,
                                                                  'presentation_percentile': 1.4505},
                                                                 {'allele': 'HLA-C*06:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 55.8516,
                                                                  'affinity_percentile': 0.0954,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.958318,
                                                                  'presentation_percentile': 0.0395},
                                                                 {'allele': 'HLA-C*07:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-3C '
                                                                                                       '(VMAPRALLL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 988.468,
                                                                  'affinity_percentile': 1.7939,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.280272,
                                                                  'presentation_percentile': 1.3472},
                                                                 {'allele': 'HLA-C*07:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-3C '
                                                                                                       '(VMAPRALLL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 94.8228,
                                                                  'affinity_percentile': 0.3647,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.929307,
                                                                  'presentation_percentile': 0.0809},
                                                                 {'allele': 'HLA-C*07:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-3C '
                                                                                                       '(VMAPRALLL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 351.4344,
                                                                  'affinity_percentile': 1.4397,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.537188,
                                                                  'presentation_percentile': 0.6818},
                                                                 {'allele': 'HLA-C*07:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-3C '
                                                                                                       '(VMAPRALLL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 69.4228,
                                                                  'affinity_percentile': 0.2883,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.948112,
                                                                  'presentation_percentile': 0.0536},
                                                                 {'allele': 'HLA-C*08:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 618.5246,
                                                                  'affinity_percentile': 1.0506,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.389837,
                                                                  'presentation_percentile': 0.9912},
                                                                 {'allele': 'HLA-C*08:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 82.6606,
                                                                  'affinity_percentile': 0.1176,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.938258,
                                                                  'presentation_percentile': 0.0675},
                                                                 {'allele': 'HLA-C*12:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 841.2635,
                                                                  'affinity_percentile': 4.1534,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.31587,
                                                                  'presentation_percentile': 1.2124},
                                                                 {'allele': 'HLA-C*12:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 41.4941,
                                                                  'affinity_percentile': 0.1316,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.969199,
                                                                  'presentation_percentile': 0.0242},
                                                                 {'allele': 'HLA-C*12:03',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 503.9655,
                                                                  'affinity_percentile': 1.8236,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.442338,
                                                                  'presentation_percentile': 0.8666},
                                                                 {'allele': 'HLA-C*12:03',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 26.4341,
                                                                  'affinity_percentile': 0.0487,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.980642,
                                                                  'presentation_percentile': 0.0114},
                                                                 {'allele': 'HLA-C*14:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 201.2999,
                                                                  'affinity_percentile': 0.8975,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.676452,
                                                                  'presentation_percentile': 0.4484},
                                                                 {'allele': 'HLA-C*14:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 57.236,
                                                                  'affinity_percentile': 0.252,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.957272,
                                                                  'presentation_percentile': 0.0412},
                                                                 {'allele': 'HLA-C*15:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-2C '
                                                                                                       '(VMAPRTLLL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 1098.0153,
                                                                  'affinity_percentile': 2.2234,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.258436,
                                                                  'presentation_percentile': 1.443},
                                                                 {'allele': 'HLA-C*15:02',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-2C '
                                                                                                       '(VMAPRTLLL)',
                                                                  'kir_or_receptor_licensing_group': 'C2 (Asn77/Lys80, '
                                                                                                     'KIR2DL1)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 32.8193,
                                                                  'affinity_percentile': 0.051,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.975793,
                                                                  'presentation_percentile': 0.0164},
                                                                 {'allele': 'HLA-C*16:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 195.8777,
                                                                  'affinity_percentile': 1.2558,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.682731,
                                                                  'presentation_percentile': 0.4392},
                                                                 {'allele': 'HLA-C*16:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'SP-1C '
                                                                                                       '(VMAPRTLIL)',
                                                                  'kir_or_receptor_licensing_group': 'C1 (Ser77/Asn80, '
                                                                                                     'KIR2DL2/3)',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 20.9479,
                                                                  'affinity_percentile': 0.023,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.984794,
                                                                  'presentation_percentile': 0.0078},
                                                                 {'allele': 'HLA-E*01:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'Non-classical '
                                                                                                       'HLA-E (leader '
                                                                                                       'receptor)',
                                                                  'kir_or_receptor_licensing_group': 'CD94/NKG2A-NKG2C',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 11679.8533,
                                                                  'affinity_percentile': 0.8357,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.027893,
                                                                  'presentation_percentile': 8.4303},
                                                                 {'allele': 'HLA-E*01:01',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'Non-classical '
                                                                                                       'HLA-E (leader '
                                                                                                       'receptor)',
                                                                  'kir_or_receptor_licensing_group': 'CD94/NKG2A-NKG2C',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 1455.416,
                                                                  'affinity_percentile': 0.0099,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.42357,
                                                                  'presentation_percentile': 0.9087},
                                                                 {'allele': 'HLA-E*01:03',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'Non-classical '
                                                                                                       'HLA-E (leader '
                                                                                                       'receptor)',
                                                                  'kir_or_receptor_licensing_group': 'CD94/NKG2A-NKG2C',
                                                                  'peptide': 'SPPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'WT_TYK2_1104P',
                                                                  'affinity_nM': 11679.8533,
                                                                  'affinity_percentile': 0.8357,
                                                                  'processing_score': 0.52563,
                                                                  'presentation_score': 0.027893,
                                                                  'presentation_percentile': 8.4303},
                                                                 {'allele': 'HLA-E*01:03',
                                                                  'ipd_imgt_hla_signal_peptide_class': 'Non-classical '
                                                                                                       'HLA-E (leader '
                                                                                                       'receptor)',
                                                                  'kir_or_receptor_licensing_group': 'CD94/NKG2A-NKG2C',
                                                                  'peptide': 'SAPTKFLEL',
                                                                  'n_flank_5aa': 'CDSSQ',
                                                                  'c_flank_5aa': 'IGIAQ',
                                                                  'variant': 'TYK2_p.Pro1104Ala_c.3310C>G',
                                                                  'affinity_nM': 1455.416,
                                                                  'affinity_percentile': 0.0099,
                                                                  'processing_score': 0.784848,
                                                                  'presentation_score': 0.42357,
                                                                  'presentation_percentile': 0.9087}]}}




_IIP_0018_OFFLINE_REFERENCE_BUNDLE: Dict[str, Any] = {'comparator_fasta_sha256': '22df54a27ef3f68b646b63dc036b11f5a66a9fcadb50378dfb8057e108c79ffa',
 'chr4_flank_up_300_minus_strand': 'ATCGTAAATCAACCTGTTTCCCTTCTGTCTCAAGCTACTTTCCCAAGGTCTGTCTCTATGCGTGCCCCCCCGCTTTTAAATTCATTTCCTCAAAAAGCACCCTTTGTTTTTTACAATAACCCTAGGATAGCTATGAATCCTTTTCTCACACCATTCTAGATACCATCTTATGATGTTTTCATTCAGGGACTGCTATAAGACGTGAAACTTGTTTTAACACACCACAAATCAGATACCCAAATGAGCAATGTTTTCCCTCAAAATAGTTATGTTGGAGGCTATTTACTTAATCTAATGGTG',
 'chr4_flank_dn_300_minus_strand': 'CTAAAATGAACACTGTGCTAACCTTCTCTGCTGTTCCTCTTTTCCTACAGGAGTACCTCTCTCTAGAACTGTACGCTGTACCTGCATCAGCATTAGTAATCAACCTGTTAATCCAAGGTCTTTAGAAAAACTTGAAATTATTCCTGCAAGCCAATTTTGTCCACGTGTTGAGATCATGTGAGTGAAATCCCATCTGATTATCACTTCCCTGGTTGTAATTATATACTGTATTAAATATGTAATGATAATAAAAAAAGATCAGTAAAGGGTTTGTGATGATTCTAAAACTAATGTACAGCA',
 'ha_l_grch38_chr4_minus': 'chr4:76023468-76024067',
 'ha_r_grch38_chr4_minus': 'chr4:76022868-76023467',
 'seed_audit': {'nt1_v2': {'target_22': 'CACGGTAACGCTAACTACGCTA',
                           'guide_5to3': 'TAGCGTAGTTAGCGTTACCGTG',
                           'passenger_5to3': 'CACGGTAACGCTAACTACGCTC',
                           'il1r1_cdna_guide_seeds': {'6mer_nt2_7': 0, '7mer_m8_nt2_8': 0, '7mer_A1': 0},
                           'fas_cdna_guide_seeds': {'6mer_nt2_7': 0, '7mer_m8_nt2_8': 0, '7mer_A1': 0}},
                'nt2': {'target_22': 'GCCTAGTCTGATTAGTTTCGGA',
                        'guide_5to3': 'TCCGAAACTAATCAGACTAGGC',
                        'passenger_5to3': 'GCCTAGTCTGATTAGTTTCGGC',
                        'il1r1_cdna_guide_seeds': {'6mer_nt2_7': 0, '7mer_m8_nt2_8': 0, '7mer_A1': 0},
                        'fas_cdna_guide_seeds': {'6mer_nt2_7': 0, '7mer_m8_nt2_8': 0, '7mer_A1': 0}},
                'target_dictated_cross_transcript_seed_disclosure': {'il1r1_guide_on_fas_cdna': {'6mer_nt2_7': 4,
                                                                                                 '7mer_m8_nt2_8': 1,
                                                                                                 '7mer_A1': 0},
                                                                     'fas_guide_on_il1r1_cdna': {'6mer_nt2_7': 3,
                                                                                                 '7mer_m8_nt2_8': 2,
                                                                                                 '7mer_A1': 1},
                                                                     'note': 'Target-dictated 7mer-m8 '
                                                                             'occurrences in the reciprocal '
                                                                             "3' UTR align with "
                                                                             'dual-knockdown directionality '
                                                                             'in ARM5/ARM6 and are directly '
                                                                             'isolated by single-hairpin '
                                                                             'controls ARM3 and ARM4.'}},
 'cbe_9_guides_7_variants': [{'gene': 'FAS',
                              'transcript': 'ENST00000652046.1',
                              'exon': '9/9',
                              'protein_change': 'p.Q276Ter',
                              'codon_change': 'CAA->TAA',
                              'grch38_vcf': 'chr10:89014268:C>T',
                              'editor_class': 'SpCas9-CBE_canonical_NGG',
                              'protospacer_5to3': 'AAGTTCAACTGCTTCGTAAT',
                              'pam_3nt': 'TGG',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 6,
                              'five_prime_dinucleotide_context': 'TC',
                              'deaminase_context_note': 'TC motif: compatible with standard APOBEC/TadA CBEs',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [9],
                              'extended_tadcbEd_c9_consequence': 'C9_synonymous_p.Leu277= (CTT->TTT/CTT '
                                                                 'depending on frame; coding c.831C>T '
                                                                 'p.Leu277=)',
                              'residual_adenine_editing_stop_loss_hazard': 'NONE_AT_STOP_CODON_TAA_OR_MINUS_STRAND_TGG '
                                                                           '(requires empirical haplotype '
                                                                           'sequencing for A positions [7, '
                                                                           '8])',
                              'uniprot_domain_and_nmd_context': 'UniProt P25445 death domain (DD) spans aa '
                                                                '230-314; exon 9/9 is the terminal canonical '
                                                                'exon so canonical downstream-EJC NMD escape '
                                                                'is plausible (p.Q311Ter removes only the '
                                                                'final 4 DD residues 311-314; requires '
                                                                'direct surface flow, FADD '
                                                                'recruitment/signaling, isoform coverage, '
                                                                'and validated sFas assay LLOD)'},
                             {'gene': 'FAS',
                              'transcript': 'ENST00000652046.1',
                              'exon': '9/9',
                              'protein_change': 'p.W281Ter',
                              'codon_change': 'TGG->TGA',
                              'grch38_vcf': 'chr10:89014285:G>A',
                              'editor_class': 'SpG-CBE_NGN',
                              'protospacer_5to3': 'GTTGATGCCAATTACGAAGC',
                              'pam_3nt': 'AGT',
                              'protospacer_strand': '-',
                              'target_pos_in_protospacer_1based': 8,
                              'five_prime_dinucleotide_context': 'GC',
                              'deaminase_context_note': 'GC motif: requires GC-compatible deaminase '
                                                        '(evoAPOBEC1 / TadCBEd) rather than rAPOBEC1',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [9],
                              'extended_tadcbEd_c9_consequence': 'C9_alternative_stop_within_p.Trp281Ter_codon '
                                                                 '(TGG->TAG/TGA)',
                              'residual_adenine_editing_stop_loss_hazard': 'NONE_AT_STOP_CODON_TAA_OR_MINUS_STRAND_TGG '
                                                                           '(requires empirical haplotype '
                                                                           'sequencing for A positions [5])',
                              'uniprot_domain_and_nmd_context': 'UniProt P25445 death domain (DD) spans aa '
                                                                '230-314; exon 9/9 is the terminal canonical '
                                                                'exon so canonical downstream-EJC NMD escape '
                                                                'is plausible (p.Q311Ter removes only the '
                                                                'final 4 DD residues 311-314; requires '
                                                                'direct surface flow, FADD '
                                                                'recruitment/signaling, isoform coverage, '
                                                                'and validated sFas assay LLOD)'},
                             {'gene': 'FAS',
                              'transcript': 'ENST00000652046.1',
                              'exon': '9/9',
                              'protein_change': 'p.Q311Ter',
                              'codon_change': 'CAG->TAG',
                              'grch38_vcf': 'chr10:89014373:C>T',
                              'editor_class': 'SpCas9-CBE_canonical_NGG',
                              'protospacer_5to3': 'AATTCAGACTATCATCCTCA',
                              'pam_3nt': 'AGG',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 5,
                              'five_prime_dinucleotide_context': 'TC',
                              'deaminase_context_note': 'TC motif: compatible with standard APOBEC/TadA CBEs',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [9],
                              'extended_tadcbEd_c9_consequence': 'C9_missense_p.Thr312Ile_on_alleles_retaining_Q311 '
                                                                 '(ACT->ATT)',
                              'residual_adenine_editing_stop_loss_hazard': 'PRESENT_CAG_TO_TAG_TO_TGG_TRP_AT_PROTOSPACER_A6 '
                                                                           '(Neugebauer 2023 PMID:36357719; '
                                                                           'Zhang 2024 PMID:38402281)',
                              'uniprot_domain_and_nmd_context': 'UniProt P25445 death domain (DD) spans aa '
                                                                '230-314; exon 9/9 is the terminal canonical '
                                                                'exon so canonical downstream-EJC NMD escape '
                                                                'is plausible (p.Q311Ter removes only the '
                                                                'final 4 DD residues 311-314; requires '
                                                                'direct surface flow, FADD '
                                                                'recruitment/signaling, isoform coverage, '
                                                                'and validated sFas assay LLOD)'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '5/12',
                              'protein_change': 'p.Q130Ter',
                              'codon_change': 'CAG->TAG',
                              'grch38_vcf': 'chr2:102165206:C>T',
                              'editor_class': 'SpCas9-CBE_canonical_NGG',
                              'protospacer_5to3': 'AAGCAGAAACTACCCGTTGC',
                              'pam_3nt': 'AGG',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 4,
                              'five_prime_dinucleotide_context': 'GC',
                              'deaminase_context_note': 'GC motif: requires GC-compatible deaminase '
                                                        '(evoAPOBEC1 / TadCBEd) rather than rAPOBEC1',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Premature-termination NMD receptor knockout hypothesis',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'PRESENT_CAG_TO_TAG_TO_TGG_TRP_AT_PROTOSPACER_A5 '
                                                                           '(Neugebauer 2023 PMID:36357719; '
                                                                           'Zhang 2024 PMID:38402281)',
                              'uniprot_domain_and_nmd_context': 'Internal canonical exon (5/12 or 6/12) '
                                                                'upstream of transmembrane segment (aa '
                                                                '337-356, UniProt P14778); premature '
                                                                'termination is a candidate NMD knockout '
                                                                'requiring empirical mRNA decay, surface '
                                                                'flow, and soluble ectodomain verification'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '6/12',
                              'protein_change': 'p.Q206Ter',
                              'codon_change': 'CAA->TAA',
                              'grch38_vcf': 'chr2:102166242:C>T',
                              'editor_class': 'SpCas9-CBE_canonical_NGG',
                              'protospacer_5to3': 'CAAGCAATATCCTATTACCC',
                              'pam_3nt': 'GGG',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 5,
                              'five_prime_dinucleotide_context': 'GC',
                              'deaminase_context_note': 'GC motif: requires GC-compatible deaminase '
                                                        '(evoAPOBEC1 / TadCBEd) rather than rAPOBEC1',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Premature-termination NMD receptor knockout hypothesis',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'NONE_AT_STOP_CODON_TAA_OR_MINUS_STRAND_TGG '
                                                                           '(requires empirical haplotype '
                                                                           'sequencing for A positions [3, '
                                                                           '6, 7, 9])',
                              'uniprot_domain_and_nmd_context': 'Internal canonical exon (5/12 or 6/12) '
                                                                'upstream of transmembrane segment (aa '
                                                                '337-356, UniProt P14778); premature '
                                                                'termination is a candidate NMD knockout '
                                                                'requiring empirical mRNA decay, surface '
                                                                'flow, and soluble ectodomain verification'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '6/12',
                              'protein_change': 'p.Q206Ter',
                              'codon_change': 'CAA->TAA',
                              'grch38_vcf': 'chr2:102166242:C>T',
                              'editor_class': 'SpCas9-CBE_canonical_NGG',
                              'protospacer_5to3': 'GCAAGCAATATCCTATTACC',
                              'pam_3nt': 'CGG',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 6,
                              'five_prime_dinucleotide_context': 'GC',
                              'deaminase_context_note': 'GC motif: requires GC-compatible deaminase '
                                                        '(evoAPOBEC1 / TadCBEd) rather than rAPOBEC1',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Premature-termination NMD receptor knockout hypothesis',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'NONE_AT_STOP_CODON_TAA_OR_MINUS_STRAND_TGG '
                                                                           '(requires empirical haplotype '
                                                                           'sequencing for A positions [3, '
                                                                           '4, 7, 8])',
                              'uniprot_domain_and_nmd_context': 'Internal canonical exon (5/12 or 6/12) '
                                                                'upstream of transmembrane segment (aa '
                                                                '337-356, UniProt P14778); premature '
                                                                'termination is a candidate NMD knockout '
                                                                'requiring empirical mRNA decay, surface '
                                                                'flow, and soluble ectodomain verification'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '12/12',
                              'protein_change': 'p.Q471Ter',
                              'codon_change': 'CAA->TAA',
                              'grch38_vcf': 'chr2:102176460:C>T',
                              'editor_class': 'SpG-CBE_NGN',
                              'protospacer_5to3': 'GAGCAAATAGCCATGTATAA',
                              'pam_3nt': 'TGC',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 4,
                              'five_prime_dinucleotide_context': 'GC',
                              'deaminase_context_note': 'GC motif: requires GC-compatible deaminase '
                                                        '(evoAPOBEC1 / TadCBEd) rather than rAPOBEC1',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'NONE_AT_STOP_CODON_TAA_OR_MINUS_STRAND_TGG '
                                                                           '(requires empirical haplotype '
                                                                           'sequencing for A positions [5, '
                                                                           '6, 7, 9])',
                              'uniprot_domain_and_nmd_context': 'UniProt P14778 TIR domain spans aa 383-538; '
                                                                'exon 12/12 is the terminal canonical exon '
                                                                'so canonical downstream-EJC NMD escape is '
                                                                'plausible, truncating the intracellular TIR '
                                                                'domain while retaining the ectodomain and '
                                                                'transmembrane segment (requires '
                                                                'surface-decoy vs residual MyD88 signaling '
                                                                'verification)'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '12/12',
                              'protein_change': 'p.Q480Ter',
                              'codon_change': 'CAG->TAG',
                              'grch38_vcf': 'chr2:102176487:C>T',
                              'editor_class': 'SpG-CBE_NGN',
                              'protospacer_5to3': 'GTTCAGGATGGAATTAAAGT',
                              'pam_3nt': 'TGT',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 4,
                              'five_prime_dinucleotide_context': 'TC',
                              'deaminase_context_note': 'TC motif: compatible with standard APOBEC/TadA CBEs',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'PRESENT_CAG_TO_TAG_TO_TGG_TRP_AT_PROTOSPACER_A5 '
                                                                           '(Neugebauer 2023 PMID:36357719; '
                                                                           'Zhang 2024 PMID:38402281)',
                              'uniprot_domain_and_nmd_context': 'UniProt P14778 TIR domain spans aa 383-538; '
                                                                'exon 12/12 is the terminal canonical exon '
                                                                'so canonical downstream-EJC NMD escape is '
                                                                'plausible, truncating the intracellular TIR '
                                                                'domain while retaining the ectodomain and '
                                                                'transmembrane segment (requires '
                                                                'surface-decoy vs residual MyD88 signaling '
                                                                'verification)'},
                             {'gene': 'IL1R1',
                              'transcript': 'ENST00000410023.6',
                              'exon': '12/12',
                              'protein_change': 'p.Q480Ter',
                              'codon_change': 'CAG->TAG',
                              'grch38_vcf': 'chr2:102176487:C>T',
                              'editor_class': 'SpG-CBE_NGN',
                              'protospacer_5to3': 'CTTGTTCAGGATGGAATTAA',
                              'pam_3nt': 'AGT',
                              'protospacer_strand': '+',
                              'target_pos_in_protospacer_1based': 7,
                              'five_prime_dinucleotide_context': 'TC',
                              'deaminase_context_note': 'TC motif: compatible with standard APOBEC/TadA CBEs',
                              'bystander_cytidines_in_4to8': [],
                              'expected_mechanism': 'Terminal-exon truncation hypothesis (requires empirical '
                                                    'NMD-escape, surface flow, and FADD/MyD88 non-signaling '
                                                    'verification)',
                              'ensembl_reconstruction_release': 'Ensembl release 116 (distinct from Layer-2 '
                                                                'baseline Ensembl 112 / GENCODE v46)',
                              'narrow_filter_scope': 'C-only positions [4..8] sequence filter only (NOT '
                                                     'editor-independent biological purity)',
                              'extended_tadcbEd_3to9_bystander_cytidines': [],
                              'extended_tadcbEd_c9_consequence': 'NONE_IN_3TO9',
                              'residual_adenine_editing_stop_loss_hazard': 'PRESENT_CAG_TO_TAG_TO_TGG_TRP_AT_PROTOSPACER_A8 '
                                                                           '(Neugebauer 2023 PMID:36357719; '
                                                                           'Zhang 2024 PMID:38402281)',
                              'uniprot_domain_and_nmd_context': 'UniProt P14778 TIR domain spans aa 383-538; '
                                                                'exon 12/12 is the terminal canonical exon '
                                                                'so canonical downstream-EJC NMD escape is '
                                                                'plausible, truncating the intracellular TIR '
                                                                'domain while retaining the ectodomain and '
                                                                'transmembrane segment (requires '
                                                                'surface-decoy vs residual MyD88 signaling '
                                                                'verification)'}],
 'retracted_or_reclassified_s1_edits': [{'s1_string': 'IFIH1 chr2:162268127:T>A (rs35667974)',
                                         's3_correction': 'chr2:162268127:T>C on current MANE Select '
                                                          'ENST00000649979.2 (NM_022168.4; fixing retired '
                                                          'ENST00000263642 and OAS3 ENST00000680230 typo) '
                                                          'encodes minus-strand c.2767A>G -> p.Ile923Val '
                                                          '(T>A was p.Ile923Phe). Live [4..8] window audit '
                                                          'shows ZERO canonical NGG ABE windows, an E924G '
                                                          'missense bystander on SpG (pos 4 CGT), and a '
                                                          'synonymous V922V bystander on SpRY-ABE8e (pos 7 '
                                                          "TCA, 5'-CATGTAATTGAGAAAATGCA-3').",
                                         'verified_modality': 'Benchmark germline allele requiring PEmax + '
                                                              'epegRNA or PAM-relaxed SpRY-ABE8e (with '
                                                              'synonymous V922V)'},
                                        {'s1_string': 'TYK2 chr19:10352442:G>C (rs34536443, P1104A) labeled '
                                                      'JH2 / base edit',
                                         's3_correction': 'chr19:10352442:G>C (ENST00000525621.8 c.3310C>G '
                                                          '-> p.Pro1104Ala) sits in the JH1 catalytic kinase '
                                                          'domain and is a C>G transversion',
                                         'verified_modality': 'Benchmark germline allele installed via PEmax '
                                                              '+ epegRNA in Layer 5 / CAND-009'},
                                        {'s1_string': 'IL1R1 chr2:102172839:G>A labeled post-TM DeltaTIR '
                                                      'membrane self-decoy',
                                         's3_correction': 'RETRACTED as membrane self-decoy: Exon-9 donor '
                                                          'c.991+1G>A sits upstream of TM (aa 337-356) and '
                                                          'carries V331I exonic bystander',
                                         'verified_modality': 'Replaced by Exon-6/5 canonical NGG CBE NMD KO '
                                                              '(Q206Ter/Q130Ter) and Exon-12 SpG-CBE stop '
                                                              'needles (Q471Ter/Q480Ter)'},
                                        {'s1_string': 'IL1R1 chr2:102176457:G>T (p.Glu470Ter) grouped under '
                                                      'CBE',
                                         's3_correction': 'G>T transversion requires PEmax + epegRNA; '
                                                          'superseded for CBE by zero-bystander C>T Q471Ter '
                                                          '(chr2:102176460:C>T) and Q480Ter '
                                                          '(chr2:102176487:C>T)',
                                         'verified_modality': 'Superseded by SpG-CBE Q471Ter / Q480Ter'}],
 'germline_protective_coding_benchmarks_non_cbe': [{'gene': 'IFIH1',
                                                    'mane_select_transcript': 'ENST00000649979.2 '
                                                                              '(NM_022168.4)',
                                                    'rsid': 'rs35667974',
                                                    'grch38_vcf': 'chr2:162268127:T>C',
                                                    'protein_change': 'p.Ile923Val',
                                                    'domain': 'C-terminal dsRNA-sensing regulatory domain',
                                                    'abe_4to8_window_audit': [{'target_pos_1based': 4,
                                                                               'protospacer_5to3': 'GTAATTGAGAAAATGCATCA',
                                                                               'pam_3nt': 'CGT',
                                                                               'bystander_adenines_in_4to8': [8]},
                                                                              {'target_pos_1based': 5,
                                                                               'protospacer_5to3': 'TGTAATTGAGAAAATGCATC',
                                                                               'pam_3nt': 'ACG',
                                                                               'bystander_adenines_in_4to8': [4]},
                                                                              {'target_pos_1based': 6,
                                                                               'protospacer_5to3': 'ATGTAATTGAGAAAATGCAT',
                                                                               'pam_3nt': 'CAC',
                                                                               'bystander_adenines_in_4to8': [5]},
                                                                              {'target_pos_1based': 7,
                                                                               'protospacer_5to3': 'CATGTAATTGAGAAAATGCA',
                                                                               'pam_3nt': 'TCA',
                                                                               'bystander_adenines_in_4to8': [6]},
                                                                              {'target_pos_1based': 8,
                                                                               'protospacer_5to3': 'CCATGTAATTGAGAAAATGC',
                                                                               'pam_3nt': 'ATC',
                                                                               'bystander_adenines_in_4to8': [7]}],
                                                    'required_modality': 'PEmax + epegRNA (or SpRY-ABE8e pos '
                                                                         '7 TCA PAM with synonymous '
                                                                         'p.Val922= bystander; zero '
                                                                         'canonical NGG windows)',
                                                    'biological_caveat': 'Attenuates MDA5 dsRNA sensing; '
                                                                         'requires Stage-0 '
                                                                         'enterovirus/picornavirus innate '
                                                                         'IFN-beta survival qualification in '
                                                                         'SC-islets.'},
                                                   {'gene': 'TYK2',
                                                    'mane_select_transcript': 'ENST00000525621.8 '
                                                                              '(NM_003331.5)',
                                                    'rsid': 'rs34536443',
                                                    'grch38_vcf': 'chr19:10352442:G>C',
                                                    'protein_change': 'p.Pro1104Ala',
                                                    'domain': 'JH1 catalytic tyrosine kinase domain',
                                                    'required_modality': 'PEmax + epegRNA (specified in '
                                                                         'Layer 5 / CAND-009; no separate '
                                                                         'pegRNA newly designed in CAND-010)',
                                                    'biological_caveat': 'Impairs IL-23-dependent IFN-gamma '
                                                                         'immunity in systemic human '
                                                                         'homozygotes while largely '
                                                                         'preserving primary-leukocyte '
                                                                         'IFN-alpha/IL-12 (Boisson-Dupuis '
                                                                         '2018 PMID:30578352) vs '
                                                                         'dose-dependent partial '
                                                                         'IFN-alpha/IL-12/IL-23 attenuation '
                                                                         '(Dendrou 2016 PMID:27807284); ex '
                                                                         'vivo graft-only editing leaves '
                                                                         'host leukocyte mycobacterial '
                                                                         'immunity intact, while Stage-0 '
                                                                         'SC-islet differentiation (Chandra '
                                                                         '2022 PMID:36289205) and Rule S8 '
                                                                         'CXCL10 licensing (GY-001) remain '
                                                                         'mandatory gates.'}],
 'opentargets_receipt': {'retrieved_utc': '2026-11-15T14:11:32Z',
                         'disease_efo_id': 'MONDO_0005147',
                         'total_associated_targets_in_opentargets': 6069,
                         'queried_top_n': 200,
                         'partition_counts': {'germline_associated_t1d_loci_gt_0p05': 112,
                                              'mody_neonatal_confounders': 1,
                                              'drug_or_metformin_label_confounders': 76,
                                              'exocrine_acinar_confounders': 2,
                                              't2d_metabolic_confounders': 6,
                                              'subthreshold_somatic_or_literature_tail': 3},
                         'rows_200': [{'rank': 1,
                                       'symbol': 'INS',
                                       'ensembl_id': 'ENSG00000254647',
                                       'overall_score': 0.7333,
                                       'genetic_association': 0.8065,
                                       'gwas_credible_sets': 0.9419,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 2,
                                       'symbol': 'HNF1A',
                                       'ensembl_id': 'ENSG00000135100',
                                       'overall_score': 0.6931,
                                       'genetic_association': 0.754,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'mody_neonatal_confounders'},
                                      {'rank': 3,
                                       'symbol': 'IL2RA',
                                       'ensembl_id': 'ENSG00000134460',
                                       'overall_score': 0.6342,
                                       'genetic_association': 0.8116,
                                       'gwas_credible_sets': 0.8116,
                                       'clinical_or_drug_score': 0.6095,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 4,
                                       'symbol': 'PTPN22',
                                       'ensembl_id': 'ENSG00000134242',
                                       'overall_score': 0.6322,
                                       'genetic_association': 0.7884,
                                       'gwas_credible_sets': 0.9247,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 5,
                                       'symbol': 'INSR',
                                       'ensembl_id': 'ENSG00000171105',
                                       'overall_score': 0.6303,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.9879,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 6,
                                       'symbol': 'SH2B3',
                                       'ensembl_id': 'ENSG00000111252',
                                       'overall_score': 0.629,
                                       'genetic_association': 0.9502,
                                       'gwas_credible_sets': 0.9502,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 7,
                                       'symbol': 'SLC5A2',
                                       'ensembl_id': 'ENSG00000140675',
                                       'overall_score': 0.606,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.9439,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 8,
                                       'symbol': 'CTLA4',
                                       'ensembl_id': 'ENSG00000163599',
                                       'overall_score': 0.5972,
                                       'genetic_association': 0.9355,
                                       'gwas_credible_sets': 0.9355,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 9,
                                       'symbol': 'TYK2',
                                       'ensembl_id': 'ENSG00000105397',
                                       'overall_score': 0.5835,
                                       'genetic_association': 0.9187,
                                       'gwas_credible_sets': 0.9187,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 10,
                                       'symbol': 'CD3E',
                                       'ensembl_id': 'ENSG00000198851',
                                       'overall_score': 0.5643,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.9239,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 11,
                                       'symbol': 'CTRB1',
                                       'ensembl_id': 'ENSG00000168925',
                                       'overall_score': 0.5599,
                                       'genetic_association': 0.9013,
                                       'gwas_credible_sets': 0.9013,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'exocrine_acinar_confounders'},
                                      {'rank': 12,
                                       'symbol': 'CTSH',
                                       'ensembl_id': 'ENSG00000103811',
                                       'overall_score': 0.5581,
                                       'genetic_association': 0.8895,
                                       'gwas_credible_sets': 0.8895,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 13,
                                       'symbol': 'IL10',
                                       'ensembl_id': 'ENSG00000136634',
                                       'overall_score': 0.5567,
                                       'genetic_association': 0.8737,
                                       'gwas_credible_sets': 0.8737,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 14,
                                       'symbol': 'TCF7L2',
                                       'ensembl_id': 'ENSG00000148737',
                                       'overall_score': 0.5541,
                                       'genetic_association': 0.8717,
                                       'gwas_credible_sets': 0.8717,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 15,
                                       'symbol': 'GCGR',
                                       'ensembl_id': 'ENSG00000215644',
                                       'overall_score': 0.5531,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.8593,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 16,
                                       'symbol': 'BACH2',
                                       'ensembl_id': 'ENSG00000112182',
                                       'overall_score': 0.5516,
                                       'genetic_association': 0.8825,
                                       'gwas_credible_sets': 0.8825,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 17,
                                       'symbol': 'CD226',
                                       'ensembl_id': 'ENSG00000150637',
                                       'overall_score': 0.5494,
                                       'genetic_association': 0.8599,
                                       'gwas_credible_sets': 0.8599,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 18,
                                       'symbol': 'CTRB2',
                                       'ensembl_id': 'ENSG00000168928',
                                       'overall_score': 0.5475,
                                       'genetic_association': 0.8916,
                                       'gwas_credible_sets': 0.8916,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'exocrine_acinar_confounders'},
                                      {'rank': 19,
                                       'symbol': 'FOXP3',
                                       'ensembl_id': 'ENSG00000049768',
                                       'overall_score': 0.5473,
                                       'genetic_association': 0.4863,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 20,
                                       'symbol': 'SIRPG',
                                       'ensembl_id': 'ENSG00000089012',
                                       'overall_score': 0.5464,
                                       'genetic_association': 0.8654,
                                       'gwas_credible_sets': 0.8654,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 21,
                                       'symbol': 'FUT2',
                                       'ensembl_id': 'ENSG00000176920',
                                       'overall_score': 0.5231,
                                       'genetic_association': 0.8402,
                                       'gwas_credible_sets': 0.8402,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 22,
                                       'symbol': 'GLP1R',
                                       'ensembl_id': 'ENSG00000112164',
                                       'overall_score': 0.5208,
                                       'genetic_association': 0.6114,
                                       'gwas_credible_sets': 0.6114,
                                       'clinical_or_drug_score': 0.6848,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 23,
                                       'symbol': 'SUOX',
                                       'ensembl_id': 'ENSG00000139531',
                                       'overall_score': 0.5147,
                                       'genetic_association': 0.8392,
                                       'gwas_credible_sets': 0.8392,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 24,
                                       'symbol': 'PTPN2',
                                       'ensembl_id': 'ENSG00000175354',
                                       'overall_score': 0.5105,
                                       'genetic_association': 0.8129,
                                       'gwas_credible_sets': 0.8129,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 25,
                                       'symbol': 'SLC5A1',
                                       'ensembl_id': 'ENSG00000100170',
                                       'overall_score': 0.5094,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.8258,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 26,
                                       'symbol': 'ITPR3',
                                       'ensembl_id': 'ENSG00000096433',
                                       'overall_score': 0.4957,
                                       'genetic_association': 0.6483,
                                       'gwas_credible_sets': 0.7618,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 27,
                                       'symbol': 'APOBR',
                                       'ensembl_id': 'ENSG00000184730',
                                       'overall_score': 0.4777,
                                       'genetic_association': 0.7823,
                                       'gwas_credible_sets': 0.7823,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 28,
                                       'symbol': 'ZFP36L1',
                                       'ensembl_id': 'ENSG00000185650',
                                       'overall_score': 0.477,
                                       'genetic_association': 0.7847,
                                       'gwas_credible_sets': 0.7847,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 29,
                                       'symbol': 'IFIH1',
                                       'ensembl_id': 'ENSG00000115267',
                                       'overall_score': 0.4759,
                                       'genetic_association': 0.7363,
                                       'gwas_credible_sets': 0.7363,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 30,
                                       'symbol': 'GLIS3',
                                       'ensembl_id': 'ENSG00000107249',
                                       'overall_score': 0.4752,
                                       'genetic_association': 0.7523,
                                       'gwas_credible_sets': 0.7523,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 31,
                                       'symbol': 'UBASH3A',
                                       'ensembl_id': 'ENSG00000160185',
                                       'overall_score': 0.4742,
                                       'genetic_association': 0.7382,
                                       'gwas_credible_sets': 0.7382,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 32,
                                       'symbol': 'ANG',
                                       'ensembl_id': 'ENSG00000214274',
                                       'overall_score': 0.4733,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'subthreshold_somatic_or_literature_tail'},
                                      {'rank': 33,
                                       'symbol': 'FTO',
                                       'ensembl_id': 'ENSG00000140718',
                                       'overall_score': 0.4627,
                                       'genetic_association': 0.7514,
                                       'gwas_credible_sets': 0.7514,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 34,
                                       'symbol': 'ICOS',
                                       'ensembl_id': 'ENSG00000163600',
                                       'overall_score': 0.4624,
                                       'genetic_association': 0.7431,
                                       'gwas_credible_sets': 0.7431,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 35,
                                       'symbol': 'COXFA4',
                                       'ensembl_id': 'ENSG00000189043',
                                       'overall_score': 0.4565,
                                       'genetic_association': 0.4077,
                                       'gwas_credible_sets': 0.4077,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 36,
                                       'symbol': 'ERBB3',
                                       'ensembl_id': 'ENSG00000065361',
                                       'overall_score': 0.4565,
                                       'genetic_association': 0.7273,
                                       'gwas_credible_sets': 0.7273,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 37,
                                       'symbol': 'CD6',
                                       'ensembl_id': 'ENSG00000013725',
                                       'overall_score': 0.4552,
                                       'genetic_association': 0.6402,
                                       'gwas_credible_sets': 0.6402,
                                       'clinical_or_drug_score': 0.4256,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 38,
                                       'symbol': 'KCNQ1',
                                       'ensembl_id': 'ENSG00000053918',
                                       'overall_score': 0.4524,
                                       'genetic_association': 0.7296,
                                       'gwas_credible_sets': 0.7296,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 39,
                                       'symbol': 'CDKAL1',
                                       'ensembl_id': 'ENSG00000145996',
                                       'overall_score': 0.4516,
                                       'genetic_association': 0.7369,
                                       'gwas_credible_sets': 0.7369,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 40,
                                       'symbol': 'C1QTNF6',
                                       'ensembl_id': 'ENSG00000133466',
                                       'overall_score': 0.4488,
                                       'genetic_association': 0.7093,
                                       'gwas_credible_sets': 0.7093,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 41,
                                       'symbol': 'PGM1',
                                       'ensembl_id': 'ENSG00000079739',
                                       'overall_score': 0.4431,
                                       'genetic_association': 0.7178,
                                       'gwas_credible_sets': 0.7178,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 42,
                                       'symbol': 'IL7R',
                                       'ensembl_id': 'ENSG00000168685',
                                       'overall_score': 0.4408,
                                       'genetic_association': 0.6816,
                                       'gwas_credible_sets': 0.6816,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 43,
                                       'symbol': 'CLEC16A',
                                       'ensembl_id': 'ENSG00000038532',
                                       'overall_score': 0.4384,
                                       'genetic_association': 0.6403,
                                       'gwas_credible_sets': 0.6403,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 44,
                                       'symbol': 'GATA3',
                                       'ensembl_id': 'ENSG00000107485',
                                       'overall_score': 0.4381,
                                       'genetic_association': 0.7086,
                                       'gwas_credible_sets': 0.7086,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 45,
                                       'symbol': 'AFF3',
                                       'ensembl_id': 'ENSG00000144218',
                                       'overall_score': 0.4246,
                                       'genetic_association': 0.6928,
                                       'gwas_credible_sets': 0.6928,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 46,
                                       'symbol': 'PCLO',
                                       'ensembl_id': 'ENSG00000186472',
                                       'overall_score': 0.4215,
                                       'genetic_association': 0.6927,
                                       'gwas_credible_sets': 0.6927,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 47,
                                       'symbol': 'RGS1',
                                       'ensembl_id': 'ENSG00000090104',
                                       'overall_score': 0.4208,
                                       'genetic_association': 0.6789,
                                       'gwas_credible_sets': 0.6789,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 48,
                                       'symbol': 'RPS26',
                                       'ensembl_id': 'ENSG00000197728',
                                       'overall_score': 0.4207,
                                       'genetic_association': 0.653,
                                       'gwas_credible_sets': 0.653,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 49,
                                       'symbol': 'IRF4',
                                       'ensembl_id': 'ENSG00000137265',
                                       'overall_score': 0.4165,
                                       'genetic_association': 0.6605,
                                       'gwas_credible_sets': 0.6605,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 50,
                                       'symbol': 'DPP4',
                                       'ensembl_id': 'ENSG00000197635',
                                       'overall_score': 0.4142,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6306,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 51,
                                       'symbol': 'PRKD2',
                                       'ensembl_id': 'ENSG00000105287',
                                       'overall_score': 0.4081,
                                       'genetic_association': 0.6655,
                                       'gwas_credible_sets': 0.6655,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 52,
                                       'symbol': 'VDR',
                                       'ensembl_id': 'ENSG00000111424',
                                       'overall_score': 0.4062,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6235,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 53,
                                       'symbol': 'NDUFS3',
                                       'ensembl_id': 'ENSG00000213619',
                                       'overall_score': 0.4027,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 54,
                                       'symbol': 'NDUFS5',
                                       'ensembl_id': 'ENSG00000168653',
                                       'overall_score': 0.4005,
                                       'genetic_association': 0.0413,
                                       'gwas_credible_sets': 0.0413,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'subthreshold_somatic_or_literature_tail'},
                                      {'rank': 55,
                                       'symbol': 'FKBP1A',
                                       'ensembl_id': 'ENSG00000088832',
                                       'overall_score': 0.3998,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6568,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 56,
                                       'symbol': 'NDUFS8',
                                       'ensembl_id': 'ENSG00000110717',
                                       'overall_score': 0.3991,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 57,
                                       'symbol': 'MT-ND2',
                                       'ensembl_id': 'ENSG00000198763',
                                       'overall_score': 0.3985,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 58,
                                       'symbol': 'NDUFAF3',
                                       'ensembl_id': 'ENSG00000178057',
                                       'overall_score': 0.3973,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 59,
                                       'symbol': 'HHEX',
                                       'ensembl_id': 'ENSG00000152804',
                                       'overall_score': 0.3973,
                                       'genetic_association': 0.6391,
                                       'gwas_credible_sets': 0.6391,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 60,
                                       'symbol': 'GPD2',
                                       'ensembl_id': 'ENSG00000115159',
                                       'overall_score': 0.3965,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 61,
                                       'symbol': 'NDUFB10',
                                       'ensembl_id': 'ENSG00000140990',
                                       'overall_score': 0.3964,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 62,
                                       'symbol': 'MT-ND5',
                                       'ensembl_id': 'ENSG00000198786',
                                       'overall_score': 0.3962,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 63,
                                       'symbol': 'MT-ND3',
                                       'ensembl_id': 'ENSG00000198840',
                                       'overall_score': 0.3962,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 64,
                                       'symbol': 'MT-ND1',
                                       'ensembl_id': 'ENSG00000198888',
                                       'overall_score': 0.3957,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 65,
                                       'symbol': 'NDUFA3',
                                       'ensembl_id': 'ENSG00000170906',
                                       'overall_score': 0.3957,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 66,
                                       'symbol': 'NDUFV3',
                                       'ensembl_id': 'ENSG00000160194',
                                       'overall_score': 0.3951,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 67,
                                       'symbol': 'NDUFA2',
                                       'ensembl_id': 'ENSG00000131495',
                                       'overall_score': 0.395,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 68,
                                       'symbol': 'NDUFAB1',
                                       'ensembl_id': 'ENSG00000004779',
                                       'overall_score': 0.395,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 69,
                                       'symbol': 'NDUFB4',
                                       'ensembl_id': 'ENSG00000065518',
                                       'overall_score': 0.3949,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 70,
                                       'symbol': 'NDUFS1',
                                       'ensembl_id': 'ENSG00000023228',
                                       'overall_score': 0.3948,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 71,
                                       'symbol': 'NDUFA7',
                                       'ensembl_id': 'ENSG00000267855',
                                       'overall_score': 0.3948,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 72,
                                       'symbol': 'NDUFB9',
                                       'ensembl_id': 'ENSG00000147684',
                                       'overall_score': 0.3948,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 73,
                                       'symbol': 'NDUFB6',
                                       'ensembl_id': 'ENSG00000165264',
                                       'overall_score': 0.3946,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 74,
                                       'symbol': 'MT-ND6',
                                       'ensembl_id': 'ENSG00000198695',
                                       'overall_score': 0.3944,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 75,
                                       'symbol': 'MT-ND4',
                                       'ensembl_id': 'ENSG00000198886',
                                       'overall_score': 0.3944,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 76,
                                       'symbol': 'MT-ND4L',
                                       'ensembl_id': 'ENSG00000212907',
                                       'overall_score': 0.3944,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 77,
                                       'symbol': 'NDUFB7',
                                       'ensembl_id': 'ENSG00000099795',
                                       'overall_score': 0.3943,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 78,
                                       'symbol': 'NDUFB1',
                                       'ensembl_id': 'ENSG00000183648',
                                       'overall_score': 0.3942,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 79,
                                       'symbol': 'LIPJ',
                                       'ensembl_id': 'ENSG00000204022',
                                       'overall_score': 0.3941,
                                       'genetic_association': 0.6467,
                                       'gwas_credible_sets': 0.6467,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 80,
                                       'symbol': 'NDUFA12',
                                       'ensembl_id': 'ENSG00000184752',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 81,
                                       'symbol': 'NDUFS6',
                                       'ensembl_id': 'ENSG00000145494',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 82,
                                       'symbol': 'NDUFB3',
                                       'ensembl_id': 'ENSG00000119013',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 83,
                                       'symbol': 'NDUFS4',
                                       'ensembl_id': 'ENSG00000164258',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 84,
                                       'symbol': 'NDUFA9',
                                       'ensembl_id': 'ENSG00000139180',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 85,
                                       'symbol': 'NDUFB8',
                                       'ensembl_id': 'ENSG00000166136',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 86,
                                       'symbol': 'NDUFAF1',
                                       'ensembl_id': 'ENSG00000137806',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 87,
                                       'symbol': 'NDUFA5',
                                       'ensembl_id': 'ENSG00000128609',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 88,
                                       'symbol': 'NDUFA1',
                                       'ensembl_id': 'ENSG00000125356',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 89,
                                       'symbol': 'NDUFC1',
                                       'ensembl_id': 'ENSG00000109390',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 90,
                                       'symbol': 'NDUFA8',
                                       'ensembl_id': 'ENSG00000119421',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 91,
                                       'symbol': 'NDUFA11',
                                       'ensembl_id': 'ENSG00000174886',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 92,
                                       'symbol': 'NDUFB11',
                                       'ensembl_id': 'ENSG00000147123',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 93,
                                       'symbol': 'NDUFC2',
                                       'ensembl_id': 'ENSG00000151366',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 94,
                                       'symbol': 'NDUFS2',
                                       'ensembl_id': 'ENSG00000158864',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 95,
                                       'symbol': 'NDUFV2',
                                       'ensembl_id': 'ENSG00000178127',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 96,
                                       'symbol': 'NDUFA6',
                                       'ensembl_id': 'ENSG00000184983',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 97,
                                       'symbol': 'COXFA4L2',
                                       'ensembl_id': 'ENSG00000185633',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 98,
                                       'symbol': 'NDUFB5',
                                       'ensembl_id': 'ENSG00000136521',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 99,
                                       'symbol': 'NDUFA10',
                                       'ensembl_id': 'ENSG00000130414',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 100,
                                       'symbol': 'NDUFS7',
                                       'ensembl_id': 'ENSG00000115286',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 101,
                                       'symbol': 'NDUFAF4',
                                       'ensembl_id': 'ENSG00000123545',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 102,
                                       'symbol': 'NDUFV1',
                                       'ensembl_id': 'ENSG00000167792',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 103,
                                       'symbol': 'NDUFAF2',
                                       'ensembl_id': 'ENSG00000164182',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 104,
                                       'symbol': 'NDUFB2',
                                       'ensembl_id': 'ENSG00000090266',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 105,
                                       'symbol': 'NDUFA13',
                                       'ensembl_id': 'ENSG00000186010',
                                       'overall_score': 0.3938,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6479,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 106,
                                       'symbol': 'CD69',
                                       'ensembl_id': 'ENSG00000110848',
                                       'overall_score': 0.3927,
                                       'genetic_association': 0.6333,
                                       'gwas_credible_sets': 0.6333,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 107,
                                       'symbol': 'SKAP2',
                                       'ensembl_id': 'ENSG00000005020',
                                       'overall_score': 0.3926,
                                       'genetic_association': 0.62,
                                       'gwas_credible_sets': 0.62,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 108,
                                       'symbol': 'IGF2BP2',
                                       'ensembl_id': 'ENSG00000073792',
                                       'overall_score': 0.3915,
                                       'genetic_association': 0.6302,
                                       'gwas_credible_sets': 0.6302,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 109,
                                       'symbol': 'RAMP2',
                                       'ensembl_id': 'ENSG00000131477',
                                       'overall_score': 0.3903,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6411,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 110,
                                       'symbol': 'CENPW',
                                       'ensembl_id': 'ENSG00000203760',
                                       'overall_score': 0.3902,
                                       'genetic_association': 0.6375,
                                       'gwas_credible_sets': 0.6375,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 111,
                                       'symbol': 'RAMP1',
                                       'ensembl_id': 'ENSG00000132329',
                                       'overall_score': 0.3901,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6411,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 112,
                                       'symbol': 'RAMP3',
                                       'ensembl_id': 'ENSG00000122679',
                                       'overall_score': 0.3897,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6411,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 113,
                                       'symbol': 'CALCR',
                                       'ensembl_id': 'ENSG00000004948',
                                       'overall_score': 0.3897,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6411,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 114,
                                       'symbol': 'GP2',
                                       'ensembl_id': 'ENSG00000169347',
                                       'overall_score': 0.3894,
                                       'genetic_association': 0.6349,
                                       'gwas_credible_sets': 0.6349,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 115,
                                       'symbol': 'IRS1',
                                       'ensembl_id': 'ENSG00000169047',
                                       'overall_score': 0.3848,
                                       'genetic_association': 0.5974,
                                       'gwas_credible_sets': 0.5974,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 116,
                                       'symbol': 'IL2RG',
                                       'ensembl_id': 'ENSG00000147168',
                                       'overall_score': 0.3842,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6095,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 117,
                                       'symbol': 'GRB10',
                                       'ensembl_id': 'ENSG00000106070',
                                       'overall_score': 0.383,
                                       'genetic_association': 0.6268,
                                       'gwas_credible_sets': 0.6268,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 118,
                                       'symbol': 'CARMIL1',
                                       'ensembl_id': 'ENSG00000079691',
                                       'overall_score': 0.3809,
                                       'genetic_association': 0.6266,
                                       'gwas_credible_sets': 0.6266,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 119,
                                       'symbol': 'GIPR',
                                       'ensembl_id': 'ENSG00000010310',
                                       'overall_score': 0.3804,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6065,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 120,
                                       'symbol': 'PPARG',
                                       'ensembl_id': 'ENSG00000132170',
                                       'overall_score': 0.3789,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6099,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 121,
                                       'symbol': 'PAM',
                                       'ensembl_id': 'ENSG00000145730',
                                       'overall_score': 0.3786,
                                       'genetic_association': 0.6212,
                                       'gwas_credible_sets': 0.6212,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 122,
                                       'symbol': 'IL2RB',
                                       'ensembl_id': 'ENSG00000100385',
                                       'overall_score': 0.3779,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.6095,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 123,
                                       'symbol': 'ANKRD55',
                                       'ensembl_id': 'ENSG00000164512',
                                       'overall_score': 0.3773,
                                       'genetic_association': 0.6187,
                                       'gwas_credible_sets': 0.6187,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 124,
                                       'symbol': 'TRPS1',
                                       'ensembl_id': 'ENSG00000104447',
                                       'overall_score': 0.3768,
                                       'genetic_association': 0.6198,
                                       'gwas_credible_sets': 0.6198,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 125,
                                       'symbol': 'PRF1',
                                       'ensembl_id': 'ENSG00000180644',
                                       'overall_score': 0.3741,
                                       'genetic_association': 0.6003,
                                       'gwas_credible_sets': 0.6003,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 126,
                                       'symbol': 'SMPD4',
                                       'ensembl_id': 'ENSG00000136699',
                                       'overall_score': 0.3721,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'subthreshold_somatic_or_literature_tail'},
                                      {'rank': 127,
                                       'symbol': 'HBP1',
                                       'ensembl_id': 'ENSG00000105856',
                                       'overall_score': 0.3696,
                                       'genetic_association': 0.5971,
                                       'gwas_credible_sets': 0.5971,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 128,
                                       'symbol': 'RPH3A',
                                       'ensembl_id': 'ENSG00000089169',
                                       'overall_score': 0.3634,
                                       'genetic_association': 0.5978,
                                       'gwas_credible_sets': 0.5978,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 129,
                                       'symbol': 'ATM',
                                       'ensembl_id': 'ENSG00000149311',
                                       'overall_score': 0.3591,
                                       'genetic_association': 0.5866,
                                       'gwas_credible_sets': 0.5866,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 130,
                                       'symbol': 'STAT4',
                                       'ensembl_id': 'ENSG00000138378',
                                       'overall_score': 0.3589,
                                       'genetic_association': 0.5513,
                                       'gwas_credible_sets': 0.5513,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 131,
                                       'symbol': 'TNRC18',
                                       'ensembl_id': 'ENSG00000182095',
                                       'overall_score': 0.3577,
                                       'genetic_association': 0.5863,
                                       'gwas_credible_sets': 0.5863,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 132,
                                       'symbol': 'ATP4A',
                                       'ensembl_id': 'ENSG00000105675',
                                       'overall_score': 0.3551,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.5579,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 133,
                                       'symbol': 'SLC30A8',
                                       'ensembl_id': 'ENSG00000164756',
                                       'overall_score': 0.3546,
                                       'genetic_association': 0.528,
                                       'gwas_credible_sets': 0.528,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 't2d_metabolic_confounders'},
                                      {'rank': 134,
                                       'symbol': 'TRIB2',
                                       'ensembl_id': 'ENSG00000071575',
                                       'overall_score': 0.3519,
                                       'genetic_association': 0.5788,
                                       'gwas_credible_sets': 0.5788,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 135,
                                       'symbol': 'ATP4B',
                                       'ensembl_id': 'ENSG00000186009',
                                       'overall_score': 0.351,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.5579,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 136,
                                       'symbol': 'TNFAIP3',
                                       'ensembl_id': 'ENSG00000118503',
                                       'overall_score': 0.3498,
                                       'genetic_association': 0.5637,
                                       'gwas_credible_sets': 0.5637,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 137,
                                       'symbol': 'ANXA1',
                                       'ensembl_id': 'ENSG00000135046',
                                       'overall_score': 0.3461,
                                       'genetic_association': 0.5371,
                                       'gwas_credible_sets': 0.5371,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 138,
                                       'symbol': 'TLL1',
                                       'ensembl_id': 'ENSG00000038295',
                                       'overall_score': 0.3446,
                                       'genetic_association': 0.5635,
                                       'gwas_credible_sets': 0.5635,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 139,
                                       'symbol': 'AGO1',
                                       'ensembl_id': 'ENSG00000092847',
                                       'overall_score': 0.3441,
                                       'genetic_association': 0.5645,
                                       'gwas_credible_sets': 0.5645,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 140,
                                       'symbol': 'CD52',
                                       'ensembl_id': 'ENSG00000169442',
                                       'overall_score': 0.344,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.5641,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 141,
                                       'symbol': 'PPIA',
                                       'ensembl_id': 'ENSG00000196262',
                                       'overall_score': 0.3436,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.5567,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 142,
                                       'symbol': 'CLNK',
                                       'ensembl_id': 'ENSG00000109684',
                                       'overall_score': 0.3428,
                                       'genetic_association': 0.5492,
                                       'gwas_credible_sets': 0.5492,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 143,
                                       'symbol': 'SLC16A11',
                                       'ensembl_id': 'ENSG00000174326',
                                       'overall_score': 0.3418,
                                       'genetic_association': 0.5595,
                                       'gwas_credible_sets': 0.5595,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 144,
                                       'symbol': 'ARHGAP12',
                                       'ensembl_id': 'ENSG00000165322',
                                       'overall_score': 0.3417,
                                       'genetic_association': 0.562,
                                       'gwas_credible_sets': 0.562,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 145,
                                       'symbol': 'AIRE',
                                       'ensembl_id': 'ENSG00000160224',
                                       'overall_score': 0.3416,
                                       'genetic_association': 0.5466,
                                       'gwas_credible_sets': 0.5466,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 146,
                                       'symbol': 'FLI1',
                                       'ensembl_id': 'ENSG00000151702',
                                       'overall_score': 0.341,
                                       'genetic_association': 0.561,
                                       'gwas_credible_sets': 0.561,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 147,
                                       'symbol': 'APCDD1',
                                       'ensembl_id': 'ENSG00000154856',
                                       'overall_score': 0.3409,
                                       'genetic_association': 0.5608,
                                       'gwas_credible_sets': 0.5608,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 148,
                                       'symbol': 'RNLS',
                                       'ensembl_id': 'ENSG00000184719',
                                       'overall_score': 0.3399,
                                       'genetic_association': 0.5468,
                                       'gwas_credible_sets': 0.5468,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 149,
                                       'symbol': 'CCR5',
                                       'ensembl_id': 'ENSG00000160791',
                                       'overall_score': 0.3393,
                                       'genetic_association': 0.5168,
                                       'gwas_credible_sets': 0.5168,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 150,
                                       'symbol': 'DCLRE1B',
                                       'ensembl_id': 'ENSG00000118655',
                                       'overall_score': 0.3388,
                                       'genetic_association': 0.551,
                                       'gwas_credible_sets': 0.551,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 151,
                                       'symbol': 'DRD2',
                                       'ensembl_id': 'ENSG00000149295',
                                       'overall_score': 0.3376,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.553,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 152,
                                       'symbol': 'PLXNA4',
                                       'ensembl_id': 'ENSG00000221866',
                                       'overall_score': 0.3368,
                                       'genetic_association': 0.5539,
                                       'gwas_credible_sets': 0.5539,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 153,
                                       'symbol': 'ARHGAP20',
                                       'ensembl_id': 'ENSG00000137727',
                                       'overall_score': 0.3367,
                                       'genetic_association': 0.5539,
                                       'gwas_credible_sets': 0.5539,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 154,
                                       'symbol': 'SOX4',
                                       'ensembl_id': 'ENSG00000124766',
                                       'overall_score': 0.3355,
                                       'genetic_association': 0.528,
                                       'gwas_credible_sets': 0.528,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 155,
                                       'symbol': 'DGKB',
                                       'ensembl_id': 'ENSG00000136267',
                                       'overall_score': 0.3347,
                                       'genetic_association': 0.5493,
                                       'gwas_credible_sets': 0.5493,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 156,
                                       'symbol': 'KEAP1',
                                       'ensembl_id': 'ENSG00000079999',
                                       'overall_score': 0.3337,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.5151,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 157,
                                       'symbol': 'WFS1',
                                       'ensembl_id': 'ENSG00000109501',
                                       'overall_score': 0.3333,
                                       'genetic_association': 0.5367,
                                       'gwas_credible_sets': 0.5367,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 158,
                                       'symbol': 'MYL2',
                                       'ensembl_id': 'ENSG00000111245',
                                       'overall_score': 0.3329,
                                       'genetic_association': 0.5463,
                                       'gwas_credible_sets': 0.5463,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 159,
                                       'symbol': 'PFKFB3',
                                       'ensembl_id': 'ENSG00000170525',
                                       'overall_score': 0.332,
                                       'genetic_association': 0.5272,
                                       'gwas_credible_sets': 0.5272,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 160,
                                       'symbol': 'AKAP11',
                                       'ensembl_id': 'ENSG00000023516',
                                       'overall_score': 0.3318,
                                       'genetic_association': 0.5459,
                                       'gwas_credible_sets': 0.5459,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 161,
                                       'symbol': 'SCN1A',
                                       'ensembl_id': 'ENSG00000144285',
                                       'overall_score': 0.3307,
                                       'genetic_association': 0.2308,
                                       'gwas_credible_sets': 0.2308,
                                       'clinical_or_drug_score': 0.4863,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 162,
                                       'symbol': 'SHC4',
                                       'ensembl_id': 'ENSG00000185634',
                                       'overall_score': 0.3305,
                                       'genetic_association': 0.5437,
                                       'gwas_credible_sets': 0.5437,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 163,
                                       'symbol': 'TNF',
                                       'ensembl_id': 'ENSG00000232810',
                                       'overall_score': 0.3302,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.4967,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 164,
                                       'symbol': 'LINGO1',
                                       'ensembl_id': 'ENSG00000169783',
                                       'overall_score': 0.3294,
                                       'genetic_association': 0.5418,
                                       'gwas_credible_sets': 0.5418,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 165,
                                       'symbol': 'PTGER4',
                                       'ensembl_id': 'ENSG00000171522',
                                       'overall_score': 0.3294,
                                       'genetic_association': 0.5323,
                                       'gwas_credible_sets': 0.5323,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 166,
                                       'symbol': 'IL2',
                                       'ensembl_id': 'ENSG00000109471',
                                       'overall_score': 0.3293,
                                       'genetic_association': 0.4944,
                                       'gwas_credible_sets': 0.4944,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 167,
                                       'symbol': 'JAZF1',
                                       'ensembl_id': 'ENSG00000153814',
                                       'overall_score': 0.3287,
                                       'genetic_association': 0.5247,
                                       'gwas_credible_sets': 0.5247,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 168,
                                       'symbol': 'CAMK4',
                                       'ensembl_id': 'ENSG00000152495',
                                       'overall_score': 0.3274,
                                       'genetic_association': 0.5363,
                                       'gwas_credible_sets': 0.5363,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 169,
                                       'symbol': 'PTPRC',
                                       'ensembl_id': 'ENSG00000081237',
                                       'overall_score': 0.3265,
                                       'genetic_association': 0.5178,
                                       'gwas_credible_sets': 0.5178,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 170,
                                       'symbol': 'CYTL1',
                                       'ensembl_id': 'ENSG00000170891',
                                       'overall_score': 0.3258,
                                       'genetic_association': 0.5271,
                                       'gwas_credible_sets': 0.5271,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 171,
                                       'symbol': 'TNFSF15',
                                       'ensembl_id': 'ENSG00000181634',
                                       'overall_score': 0.325,
                                       'genetic_association': 0.5323,
                                       'gwas_credible_sets': 0.5323,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 172,
                                       'symbol': 'IDUA',
                                       'ensembl_id': 'ENSG00000127415',
                                       'overall_score': 0.3247,
                                       'genetic_association': 0.5331,
                                       'gwas_credible_sets': 0.5331,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 173,
                                       'symbol': 'CTSB',
                                       'ensembl_id': 'ENSG00000164733',
                                       'overall_score': 0.3244,
                                       'genetic_association': 0.5114,
                                       'gwas_credible_sets': 0.5114,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 174,
                                       'symbol': 'MKI67',
                                       'ensembl_id': 'ENSG00000148773',
                                       'overall_score': 0.3241,
                                       'genetic_association': 0.5085,
                                       'gwas_credible_sets': 0.5085,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 175,
                                       'symbol': 'PTPRR',
                                       'ensembl_id': 'ENSG00000153233',
                                       'overall_score': 0.3232,
                                       'genetic_association': 0.5317,
                                       'gwas_credible_sets': 0.5317,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 176,
                                       'symbol': 'TYR',
                                       'ensembl_id': 'ENSG00000077498',
                                       'overall_score': 0.323,
                                       'genetic_association': 0.5262,
                                       'gwas_credible_sets': 0.5262,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 177,
                                       'symbol': 'ITGB1',
                                       'ensembl_id': 'ENSG00000150093',
                                       'overall_score': 0.3226,
                                       'genetic_association': 0.5248,
                                       'gwas_credible_sets': 0.5248,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 178,
                                       'symbol': 'C2',
                                       'ensembl_id': 'ENSG00000166278',
                                       'overall_score': 0.3197,
                                       'genetic_association': 0.5217,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 179,
                                       'symbol': 'GSDMB',
                                       'ensembl_id': 'ENSG00000073605',
                                       'overall_score': 0.3193,
                                       'genetic_association': 0.5125,
                                       'gwas_credible_sets': 0.5125,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 180,
                                       'symbol': 'KLRG1',
                                       'ensembl_id': 'ENSG00000139187',
                                       'overall_score': 0.3187,
                                       'genetic_association': 0.4925,
                                       'gwas_credible_sets': 0.4925,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 181,
                                       'symbol': 'RASGRP1',
                                       'ensembl_id': 'ENSG00000172575',
                                       'overall_score': 0.3185,
                                       'genetic_association': 0.5028,
                                       'gwas_credible_sets': 0.5028,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 182,
                                       'symbol': 'CUX2',
                                       'ensembl_id': 'ENSG00000111249',
                                       'overall_score': 0.3172,
                                       'genetic_association': 0.5192,
                                       'gwas_credible_sets': 0.5192,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 183,
                                       'symbol': 'SCN4A',
                                       'ensembl_id': 'ENSG00000007314',
                                       'overall_score': 0.316,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.4863,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 184,
                                       'symbol': 'GADD45G',
                                       'ensembl_id': 'ENSG00000130222',
                                       'overall_score': 0.3156,
                                       'genetic_association': 0.5191,
                                       'gwas_credible_sets': 0.5191,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 185,
                                       'symbol': 'CLINT1',
                                       'ensembl_id': 'ENSG00000113282',
                                       'overall_score': 0.3152,
                                       'genetic_association': 0.5185,
                                       'gwas_credible_sets': 0.5185,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 186,
                                       'symbol': 'CAPSL',
                                       'ensembl_id': 'ENSG00000152611',
                                       'overall_score': 0.3149,
                                       'genetic_association': 0.5135,
                                       'gwas_credible_sets': 0.5135,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 187,
                                       'symbol': 'ADCYAP1',
                                       'ensembl_id': 'ENSG00000141433',
                                       'overall_score': 0.3143,
                                       'genetic_association': 0.5143,
                                       'gwas_credible_sets': 0.5143,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 188,
                                       'symbol': 'PMFBP1',
                                       'ensembl_id': 'ENSG00000118557',
                                       'overall_score': 0.3141,
                                       'genetic_association': 0.5166,
                                       'gwas_credible_sets': 0.5166,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 189,
                                       'symbol': 'CBLN2',
                                       'ensembl_id': 'ENSG00000141668',
                                       'overall_score': 0.313,
                                       'genetic_association': 0.5148,
                                       'gwas_credible_sets': 0.5148,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 190,
                                       'symbol': 'SLC25A37',
                                       'ensembl_id': 'ENSG00000147454',
                                       'overall_score': 0.3125,
                                       'genetic_association': 0.5098,
                                       'gwas_credible_sets': 0.5098,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 191,
                                       'symbol': 'FOXN3',
                                       'ensembl_id': 'ENSG00000053254',
                                       'overall_score': 0.3113,
                                       'genetic_association': 0.512,
                                       'gwas_credible_sets': 0.512,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 192,
                                       'symbol': 'LMX1A',
                                       'ensembl_id': 'ENSG00000162761',
                                       'overall_score': 0.309,
                                       'genetic_association': 0.507,
                                       'gwas_credible_sets': 0.507,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 193,
                                       'symbol': 'CACNA1D',
                                       'ensembl_id': 'ENSG00000157388',
                                       'overall_score': 0.3089,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.4839,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 194,
                                       'symbol': 'IGFBP7',
                                       'ensembl_id': 'ENSG00000163453',
                                       'overall_score': 0.3078,
                                       'genetic_association': 0.4976,
                                       'gwas_credible_sets': 0.4976,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 195,
                                       'symbol': 'PTPN1',
                                       'ensembl_id': 'ENSG00000196396',
                                       'overall_score': 0.3073,
                                       'genetic_association': 0.4697,
                                       'gwas_credible_sets': 0.4697,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 196,
                                       'symbol': 'DIPK1A',
                                       'ensembl_id': 'ENSG00000154511',
                                       'overall_score': 0.3066,
                                       'genetic_association': 0.5044,
                                       'gwas_credible_sets': 0.5044,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 197,
                                       'symbol': 'SCN8A',
                                       'ensembl_id': 'ENSG00000196876',
                                       'overall_score': 0.3064,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.4863,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 198,
                                       'symbol': 'CXCR1',
                                       'ensembl_id': 'ENSG00000163464',
                                       'overall_score': 0.3064,
                                       'genetic_association': 0.0,
                                       'gwas_credible_sets': 0.0,
                                       'clinical_or_drug_score': 0.4836,
                                       'partition': 'drug_or_metformin_label_confounders'},
                                      {'rank': 199,
                                       'symbol': 'RAD51B',
                                       'ensembl_id': 'ENSG00000182185',
                                       'overall_score': 0.3062,
                                       'genetic_association': 0.5001,
                                       'gwas_credible_sets': 0.5001,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'},
                                      {'rank': 200,
                                       'symbol': 'ADCY8',
                                       'ensembl_id': 'ENSG00000155897',
                                       'overall_score': 0.306,
                                       'genetic_association': 0.5019,
                                       'gwas_credible_sets': 0.5019,
                                       'clinical_or_drug_score': 0.0,
                                       'partition': 'germline_associated_t1d_loci_gt_0p05'}]},
 'bcrank_t1d_heuristic_rubric': {'governance_framing': 'Transparent heuristic Stage-0 target-prioritization '
                                                       'rubric (NOT a calibrated clinical or causal '
                                                       'probability estimator).',
                                 'monte_carlo_500_weight_perturbations_plus_minus_25pct': {'il1r1_and_fas_both_in_top8_pct': 100.0,
                                                                                           'top_6_retention_rates_pct': {'FAS': 100.0,
                                                                                                                         'IL1R1': 100.0,
                                                                                                                         'CXCL10': 100.0,
                                                                                                                         'TYK2': 100.0,
                                                                                                                         'SERPINB9_C341S': 100.0,
                                                                                                                         'B2M': 100.0,
                                                                                                                         'IFIH1': 0.0,
                                                                                                                         'CIITA': 0.0}},
                                 'cc_by_4_clean_ranked_34': [{'gene_or_intervention': 'FAS',
                                                              'cascade_layer': 'U4_Execution_Receptor',
                                                              'causal_classification': 'AMPLIFIER_KNOCKDOWN_OR_DOMINANT_NEGATIVE',
                                                              'bcrank_t1d_score_0_to_100': 94.85,
                                                              'unpenalized_subscore_0_to_100': 94.85,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.0,
                                                                            'amplifier_potency_25': 24.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 19.2,
                                                                            'cascade_nonredundancy_15': 14.25,
                                                                            'human_sc_islet_gsis_safety_15': 14.4},
                                                              'gnomad_v4': {'pLI': 0.9999,
                                                                            'oe_lof': 0.1504,
                                                                            'loeuf': 0.3162,
                                                                            'oe_mis': 0.8782},
                                                              'gtex_v10_pancreas_tpm': 0.446,
                                                              'gtex_v10_whole_blood_tpm': 2.881,
                                                              'recommended_modality': 'K=4,B=0 Pol II '
                                                                                      'Multi-miR (ARM5/ARM6) '
                                                                                      'OR B=1 Exon-9 '
                                                                                      'Q276Ter/Q311Ter '
                                                                                      'canonical-NGG CBE '
                                                                                      'needle',
                                                              'mechanistic_evidence_and_pmids': 'Death '
                                                                                                'receptor '
                                                                                                'for '
                                                                                                'membrane-bound '
                                                                                                'mFasL on '
                                                                                                'infiltrating '
                                                                                                'T/macrophage '
                                                                                                'effectors '
                                                                                                '(native '
                                                                                                'human '
                                                                                                'islets: '
                                                                                                'Loweth 1998 '
                                                                                                'PMID:9588443; '
                                                                                                'NOD mouse '
                                                                                                'perforin '
                                                                                                'dominance '
                                                                                                'with '
                                                                                                'soluble '
                                                                                                'sFasL '
                                                                                                'dispensable '
                                                                                                'when mFasL '
                                                                                                'intact: '
                                                                                                'Trivedi '
                                                                                                '2019/2020 '
                                                                                                'PMID:31552143) '
                                                                                                'AND acute '
                                                                                                'Rule S8b '
                                                                                                'SA-FasL '
                                                                                                'microgel '
                                                                                                'fratricide '
                                                                                                '(Headen '
                                                                                                '2018 '
                                                                                                'PMID:29867165), '
                                                                                                'keeping '
                                                                                                'Caspase-8 '
                                                                                                'intact to '
                                                                                                'prevent '
                                                                                                'RIPK3 '
                                                                                                'necroptosis '
                                                                                                '(Kaiser '
                                                                                                '2011 '
                                                                                                'PMID:21368762).',
                                                              'rank': 1},
                                                             {'gene_or_intervention': 'IL1R1',
                                                              'cascade_layer': 'U4_Execution_Receptor',
                                                              'causal_classification': 'AMPLIFIER_KNOCKDOWN_OR_SELFDECOY',
                                                              'bcrank_t1d_score_0_to_100': 93.65,
                                                              'unpenalized_subscore_0_to_100': 93.65,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 22.5,
                                                                            'amplifier_potency_25': 24.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 19.2,
                                                                            'cascade_nonredundancy_15': 14.25,
                                                                            'human_sc_islet_gsis_safety_15': 13.2},
                                                              'gnomad_v4': {'pLI': 0.07,
                                                                            'oe_lof': 0.4381,
                                                                            'loeuf': 0.6256,
                                                                            'oe_mis': 0.7527},
                                                              'gtex_v10_pancreas_tpm': 12.365,
                                                              'gtex_v10_whole_blood_tpm': 14.267,
                                                              'recommended_modality': 'K=4,B=0 Pol II '
                                                                                      'Multi-miR (ARM5/ARM6) '
                                                                                      'OR B=1 Exon-6 Q206Ter '
                                                                                      '(NGG) / Exon-12 '
                                                                                      'Q471Ter,Q480Ter (SpG) '
                                                                                      'CBE needle',
                                                              'mechanistic_evidence_and_pmids': 'Primary '
                                                                                                'signaling '
                                                                                                'receptor '
                                                                                                'for M1 '
                                                                                                'macrophage '
                                                                                                'IL-1beta -> '
                                                                                                'NF-kB/JNK/iNOS '
                                                                                                'toxicity '
                                                                                                '(4DEP '
                                                                                                'PMID:22426547; '
                                                                                                '3O4O '
                                                                                                'PMID:20802483; '
                                                                                                'bulk '
                                                                                                'pancreas '
                                                                                                '12.37 vs '
                                                                                                '0.73 TPM '
                                                                                                'IL1R2 with '
                                                                                                'mixed-tissue '
                                                                                                'caveat '
                                                                                                'disclosed); '
                                                                                                'requires '
                                                                                                'postprandial '
                                                                                                'physiological '
                                                                                                'IL-1beta '
                                                                                                'GSIS '
                                                                                                'perifusion '
                                                                                                'check (Dror '
                                                                                                '2017 '
                                                                                                'PMID:28092375; '
                                                                                                'distinct '
                                                                                                'from neural '
                                                                                                'cephalic '
                                                                                                'pathway in '
                                                                                                'Wiedemann '
                                                                                                '2022 '
                                                                                                'PMID:35750050).',
                                                              'rank': 2},
                                                             {'gene_or_intervention': 'CXCL10',
                                                              'cascade_layer': 'U2_Chemokine_Beacon',
                                                              'causal_classification': 'AMPLIFIER_ALREADY_ABLATED_AT_LOCUS3',
                                                              'bcrank_t1d_score_0_to_100': 92.3,
                                                              'unpenalized_subscore_0_to_100': 92.3,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.5,
                                                                            'amplifier_potency_25': 22.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 18.4,
                                                                            'cascade_nonredundancy_15': 13.2,
                                                                            'human_sc_islet_gsis_safety_15': 14.7},
                                                              'gnomad_v4': {'pLI': 0.0631,
                                                                            'oe_lof': 0.5541,
                                                                            'loeuf': 1.0935,
                                                                            'oe_mis': 0.9975},
                                                              'gtex_v10_pancreas_tpm': 0.266,
                                                              'gtex_v10_whole_blood_tpm': 0.274,
                                                              'recommended_modality': 'Already ablated via '
                                                                                      'biallelic Locus 3 HDR '
                                                                                      'knock-in in Islet-1',
                                                              'mechanistic_evidence_and_pmids': 'Validated '
                                                                                                'by human '
                                                                                                'SC-islet '
                                                                                                'genome-wide '
                                                                                                'CRISPR '
                                                                                                'screen '
                                                                                                '(Sintov '
                                                                                                '2022 '
                                                                                                'PMID:36055241): '
                                                                                                'primary '
                                                                                                'CXCR3+ T/NK '
                                                                                                'recruiting '
                                                                                                'chemokine; '
                                                                                                'already '
                                                                                                'disrupted '
                                                                                                'at Locus 3 '
                                                                                                'to drive '
                                                                                                'inducible '
                                                                                                'SERPINB9 + '
                                                                                                'PD-L1.',
                                                              'rank': 3},
                                                             {'gene_or_intervention': 'TYK2',
                                                              'cascade_layer': 'U3_Signal_Hub',
                                                              'causal_classification': 'ALLOSTERIC_MUTEIN_P1104A_PREFERRED',
                                                              'bcrank_t1d_score_0_to_100': 91.8,
                                                              'unpenalized_subscore_0_to_100': 91.8,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 24.5,
                                                                            'amplifier_potency_25': 22.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 18.0,
                                                                            'cascade_nonredundancy_15': 13.5,
                                                                            'human_sc_islet_gsis_safety_15': 13.8},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.4966,
                                                                            'loeuf': 0.6105,
                                                                            'oe_mis': 0.8555},
                                                              'gtex_v10_pancreas_tpm': 19.284,
                                                              'gtex_v10_whole_blood_tpm': 92.688,
                                                              'recommended_modality': 'B=1 P1104A JH1 kinase '
                                                                                      'mutein via PEmax + '
                                                                                      'epegRNA (Layer 5 / '
                                                                                      'CAND-009); full KO '
                                                                                      'penalized',
                                                              'mechanistic_evidence_and_pmids': 'Human '
                                                                                                'germline '
                                                                                                'P1104A '
                                                                                                '(rs34536443, '
                                                                                                'JH1 '
                                                                                                'catalytic '
                                                                                                'domain) '
                                                                                                'protects '
                                                                                                'against T1D '
                                                                                                '(Dendrou '
                                                                                                '2016 '
                                                                                                'PMID:27807284) '
                                                                                                'with '
                                                                                                'selective '
                                                                                                'IL-23 '
                                                                                                'impairment '
                                                                                                'and largely '
                                                                                                'preserved '
                                                                                                'primary-leukocyte '
                                                                                                'IFN-alpha/IL-12 '
                                                                                                '(Boisson-Dupuis '
                                                                                                '2018 '
                                                                                                'PMID:30578352); '
                                                                                                'Stage-0 '
                                                                                                'SC-islet '
                                                                                                'differentiation '
                                                                                                '(Chandra '
                                                                                                '2022 '
                                                                                                'PMID:36289205) '
                                                                                                'and Rule S8 '
                                                                                                'CXCL10 '
                                                                                                'licensing '
                                                                                                '(GY-001) '
                                                                                                'remain '
                                                                                                'mandatory '
                                                                                                'empirical '
                                                                                                'gates.',
                                                              'rank': 4},
                                                             {'gene_or_intervention': 'SERPINB9_C341S',
                                                              'cascade_layer': 'U4_Cytosolic_Armor',
                                                              'causal_classification': 'REDOX_HARDENED_GAIN_OF_RESILIENCE',
                                                              'bcrank_t1d_score_0_to_100': 89.9,
                                                              'unpenalized_subscore_0_to_100': 89.9,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 21.5,
                                                                            'amplifier_potency_25': 22.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 18.0,
                                                                            'cascade_nonredundancy_15': 13.2,
                                                                            'human_sc_islet_gsis_safety_15': 14.7},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.7358,
                                                                            'loeuf': 1.0692,
                                                                            'oe_mis': 1.0346},
                                                              'gtex_v10_pancreas_tpm': 1.396,
                                                              'gtex_v10_whole_blood_tpm': 19.248,
                                                              'recommended_modality': '0-bp TGC->TCA codon '
                                                                                      'swap at Locus 3 Unit '
                                                                                      '1 (ARM6 exploratory '
                                                                                      'redox sub-arm; '
                                                                                      'pre-registered in '
                                                                                      'Layer 2)',
                                                              'mechanistic_evidence_and_pmids': 'Targets '
                                                                                                'Cys341-Cys342 '
                                                                                                'vicinal-disulfide '
                                                                                                'RCL redox '
                                                                                                'inactivation '
                                                                                                '(Mangan '
                                                                                                '2016 '
                                                                                                'PMID:26670609; '
                                                                                                'GzmB '
                                                                                                'catalytic '
                                                                                                'cleft '
                                                                                                'PDB:1IAU '
                                                                                                'PMID:11325591); '
                                                                                                'creates +38 '
                                                                                                '8-11mers / '
                                                                                                '+15 15mers '
                                                                                                'vs WT '
                                                                                                'parent '
                                                                                                'requiring '
                                                                                                'host '
                                                                                                'HLA-DQ2/DQ8 '
                                                                                                'indirect '
                                                                                                'APC '
                                                                                                'screening '
                                                                                                '(GY-010) '
                                                                                                'and '
                                                                                                'retained '
                                                                                                'HLA-C check '
                                                                                                'on Design B '
                                                                                                '(GY-005).',
                                                              'rank': 5},
                                                             {'gene_or_intervention': 'B2M',
                                                              'cascade_layer': 'U1_Antigen_Presentation',
                                                              'causal_classification': 'AMPLIFIER_ALREADY_ABLATED_AT_LOCUS1',
                                                              'bcrank_t1d_score_0_to_100': 88.65,
                                                              'unpenalized_subscore_0_to_100': 88.65,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 24.0,
                                                                            'amplifier_potency_25': 21.25,
                                                                            'iaa_plus_gada_endotype_breadth_20': 17.0,
                                                                            'cascade_nonredundancy_15': 12.0,
                                                                            'human_sc_islet_gsis_safety_15': 14.4},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Already ablated at '
                                                                                      'Locus 1 (replaced by '
                                                                                      'HLA-E or SP-1C HLA-C)',
                                                              'mechanistic_evidence_and_pmids': 'Eliminates '
                                                                                                'direct CD8+ '
                                                                                                'TCR '
                                                                                                'recognition '
                                                                                                'of '
                                                                                                'PPI/IGRP/ZnT8/GAD '
                                                                                                'peptides '
                                                                                                '(Gate 2A), '
                                                                                                'leaving the '
                                                                                                'indirect '
                                                                                                'GY-010 '
                                                                                                'CD4/macrophage '
                                                                                                'bystander '
                                                                                                'loop that '
                                                                                                'EXP-010 '
                                                                                                'solves.',
                                                              'rank': 6},
                                                             {'gene_or_intervention': 'IFIH1',
                                                              'cascade_layer': 'U1_Sensor_dsRNA',
                                                              'causal_classification': 'AMPLIFIER_KNOCKDOWN_OR_I923V_NEEDLE',
                                                              'bcrank_t1d_score_0_to_100': 87.25,
                                                              'unpenalized_subscore_0_to_100': 87.25,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 24.5,
                                                                            'amplifier_potency_25': 19.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 16.4,
                                                                            'cascade_nonredundancy_15': 12.6,
                                                                            'human_sc_islet_gsis_safety_15': 14.25},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 1.1635,
                                                                            'loeuf': 1.3498,
                                                                            'oe_mis': 1.0983},
                                                              'gtex_v10_pancreas_tpm': 4.237,
                                                              'gtex_v10_whole_blood_tpm': 3.095,
                                                              'recommended_modality': 'B=1 I923V '
                                                                                      '(rs35667974) / rare '
                                                                                      'LoF needle OR U1+U4 '
                                                                                      'Multi-miR arm',
                                                              'mechanistic_evidence_and_pmids': 'Gold-standard '
                                                                                                'human T1D '
                                                                                                'causal '
                                                                                                'protective '
                                                                                                'direction: '
                                                                                                'rare human '
                                                                                                'LoF & I923V '
                                                                                                '(rs35667974) '
                                                                                                'protect '
                                                                                                'against T1D '
                                                                                                '(OR=0.51, '
                                                                                                'Nejentsev '
                                                                                                '2009 '
                                                                                                'PMID:19264985; '
                                                                                                'Downes 2010 '
                                                                                                'PMID:20844740; '
                                                                                                'gnomAD v4 '
                                                                                                'LOEUF=1.350, '
                                                                                                'LoF-tolerant). '
                                                                                                'Blunts '
                                                                                                'intracrine '
                                                                                                'dsRNA/Alu '
                                                                                                '-> IFN-beta '
                                                                                                'amplification '
                                                                                                '(especially '
                                                                                                'T1DE2), but '
                                                                                                'CANNOT '
                                                                                                'block '
                                                                                                'exogenous '
                                                                                                'macrophage '
                                                                                                'IL-1beta or '
                                                                                                'Th1 mFasL '
                                                                                                'once host '
                                                                                                'GY-010 APCs '
                                                                                                'are primed '
                                                                                                '— hence '
                                                                                                'lower '
                                                                                                'standalone '
                                                                                                'Hurdle-3 '
                                                                                                'execution '
                                                                                                'coverage '
                                                                                                'than [IL1R1 '
                                                                                                '+ FAS].',
                                                              'rank': 7},
                                                             {'gene_or_intervention': 'CIITA',
                                                              'cascade_layer': 'U1_Antigen_Presentation',
                                                              'causal_classification': 'AMPLIFIER_ALREADY_ABLATED_AT_LOCUS2',
                                                              'bcrank_t1d_score_0_to_100': 86.6,
                                                              'unpenalized_subscore_0_to_100': 86.6,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.5,
                                                                            'amplifier_potency_25': 20.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 17.0,
                                                                            'cascade_nonredundancy_15': 11.7,
                                                                            'human_sc_islet_gsis_safety_15': 14.4},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Already ablated at '
                                                                                      'Locus 2',
                                                              'mechanistic_evidence_and_pmids': 'Prevents '
                                                                                                'IFN-gamma-induced '
                                                                                                'ectopic '
                                                                                                'HLA-DR/DQ '
                                                                                                'expression '
                                                                                                'on '
                                                                                                'SC-islets.',
                                                              'rank': 8},
                                                             {'gene_or_intervention': 'TNFRSF10B',
                                                              'cascade_layer': 'U4_Execution_Receptor',
                                                              'causal_classification': 'SECONDARY_AMPLIFIER_DR5_TRAIL',
                                                              'bcrank_t1d_score_0_to_100': 78.8,
                                                              'unpenalized_subscore_0_to_100': 78.8,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 18.0,
                                                                            'amplifier_potency_25': 19.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 16.0,
                                                                            'cascade_nonredundancy_15': 12.3,
                                                                            'human_sc_islet_gsis_safety_15': 13.5},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.846,
                                                                            'loeuf': 1.1216,
                                                                            'oe_mis': 1.0567},
                                                              'gtex_v10_pancreas_tpm': 24.446,
                                                              'gtex_v10_whole_blood_tpm': 15.106,
                                                              'recommended_modality': '3rd-hairpin candidate '
                                                                                      'only in inducible '
                                                                                      'L3-SF (exceeds '
                                                                                      'L3-BF-B 4,700 bp cap)',
                                                              'mechanistic_evidence_and_pmids': 'TRAIL-R2 '
                                                                                                '(DR5; '
                                                                                                'Pancreas '
                                                                                                '24.45 TPM) '
                                                                                                'mediates '
                                                                                                'secondary '
                                                                                                'TRAIL '
                                                                                                'bystander '
                                                                                                'apoptosis; '
                                                                                                'valid '
                                                                                                'secondary '
                                                                                                'target but '
                                                                                                'adding a '
                                                                                                '3rd hairpin '
                                                                                                'overflows '
                                                                                                'Basal-Floor '
                                                                                                'L3-BF-B '
                                                                                                'single-AAV6 '
                                                                                                'cap by +114 '
                                                                                                'bp (4,814 > '
                                                                                                '4,700 bp).',
                                                              'rank': 9},
                                                             {'gene_or_intervention': 'CXCL9',
                                                              'cascade_layer': 'U2_Chemokine_Beacon',
                                                              'causal_classification': 'SECONDARY_CHEMOKINE_AMPLIFIER',
                                                              'bcrank_t1d_score_0_to_100': 73.2,
                                                              'unpenalized_subscore_0_to_100': 73.2,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 17.5,
                                                                            'amplifier_potency_25': 16.25,
                                                                            'iaa_plus_gada_endotype_breadth_20': 15.0,
                                                                            'cascade_nonredundancy_15': 10.2,
                                                                            'human_sc_islet_gsis_safety_15': 14.25},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Redundant with CXCL10 '
                                                                                      'ablation (Pancreas '
                                                                                      'basal 0.12 TPM)',
                                                              'mechanistic_evidence_and_pmids': 'Secondary '
                                                                                                'CXCR3 '
                                                                                                'ligand '
                                                                                                'co-induced '
                                                                                                'with CXCL10 '
                                                                                                '(Sintov '
                                                                                                '2022 '
                                                                                                'PMID:36055241); '
                                                                                                'quantitatively '
                                                                                                'minor vs '
                                                                                                'CXCL10 in '
                                                                                                'human beta '
                                                                                                'cells.',
                                                              'rank': 10},
                                                             {'gene_or_intervention': 'CCL5',
                                                              'cascade_layer': 'U2_Chemokine_Beacon',
                                                              'causal_classification': 'SECONDARY_CHEMOKINE_AMPLIFIER',
                                                              'bcrank_t1d_score_0_to_100': 72.0,
                                                              'unpenalized_subscore_0_to_100': 72.0,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 16.5,
                                                                            'amplifier_potency_25': 16.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 15.2,
                                                                            'cascade_nonredundancy_15': 10.2,
                                                                            'human_sc_islet_gsis_safety_15': 14.1},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Optional secondary '
                                                                                      'CCR5 chemokine target',
                                                              'mechanistic_evidence_and_pmids': 'Recruits '
                                                                                                'CCR5+ '
                                                                                                'macrophages '
                                                                                                'and Th1 '
                                                                                                'cells under '
                                                                                                'STAT1/NF-kB '
                                                                                                'stimulation; '
                                                                                                'downstream '
                                                                                                'execution '
                                                                                                'already '
                                                                                                'intercepted '
                                                                                                'by [IL1R1 + '
                                                                                                'FAS].',
                                                              'rank': 11},
                                                             {'gene_or_intervention': 'CXCL11',
                                                              'cascade_layer': 'U2_Chemokine_Beacon',
                                                              'causal_classification': 'SECONDARY_CHEMOKINE_AMPLIFIER',
                                                              'bcrank_t1d_score_0_to_100': 71.45,
                                                              'unpenalized_subscore_0_to_100': 71.45,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 17.0,
                                                                            'amplifier_potency_25': 15.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 14.8,
                                                                            'cascade_nonredundancy_15': 9.9,
                                                                            'human_sc_islet_gsis_safety_15': 14.25},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Redundant with CXCL10 '
                                                                                      'ablation',
                                                              'mechanistic_evidence_and_pmids': 'Tertiary '
                                                                                                'CXCR3 '
                                                                                                'ligand; far '
                                                                                                'lower '
                                                                                                'transcript '
                                                                                                'abundance '
                                                                                                'than CXCL10 '
                                                                                                'in '
                                                                                                'cytokine-stimulated '
                                                                                                'human '
                                                                                                'islets.',
                                                              'rank': 12},
                                                             {'gene_or_intervention': 'NOS2',
                                                              'cascade_layer': 'U4_Cytosolic_Effector',
                                                              'causal_classification': 'DOWNSTREAM_ENZYME_REDUNDANT_WITH_IL1R1',
                                                              'bcrank_t1d_score_0_to_100': 70.45,
                                                              'unpenalized_subscore_0_to_100': 70.45,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 16.25,
                                                                            'amplifier_potency_25': 17.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 14.4,
                                                                            'cascade_nonredundancy_15': 9.0,
                                                                            'human_sc_islet_gsis_safety_15': 13.8},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Suboptimal vs '
                                                                                      'upstream IL1R1 '
                                                                                      'knockdown',
                                                              'mechanistic_evidence_and_pmids': 'Inducible '
                                                                                                'iNOS '
                                                                                                'generates '
                                                                                                'NO/peroxynitrite '
                                                                                                'downstream '
                                                                                                'of IL-1beta '
                                                                                                '+ '
                                                                                                'IFN-gamma; '
                                                                                                'knocking '
                                                                                                'down IL1R1 '
                                                                                                'blocks BOTH '
                                                                                                'iNOS '
                                                                                                'induction '
                                                                                                'AND '
                                                                                                'JNK/CHOP ER '
                                                                                                'stress '
                                                                                                'upstream.',
                                                              'rank': 13},
                                                             {'gene_or_intervention': 'DEXI',
                                                              'cascade_layer': 'U1_Chromatin_Amplifier',
                                                              'causal_classification': 'AMPLIFIER_WITH_PARTIAL_STAT1_CAUTION',
                                                              'bcrank_t1d_score_0_to_100': 64.86,
                                                              'unpenalized_subscore_0_to_100': 79.1,
                                                              'safety_gate_multiplier': 1.0,
                                                              'islet1_epistasis_multiplier': 0.82,
                                                              'subscores': {'human_evidence_25': 21.0,
                                                                            'amplifier_potency_25': 18.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 15.2,
                                                                            'cascade_nonredundancy_15': 11.7,
                                                                            'human_sc_islet_gsis_safety_15': 13.2},
                                                              'gnomad_v4': {'pLI': 0.1083,
                                                                            'oe_lof': 0.81,
                                                                            'loeuf': 2.5498,
                                                                            'oe_mis': 0.829},
                                                              'gtex_v10_pancreas_tpm': 0.861,
                                                              'gtex_v10_whole_blood_tpm': 0.866,
                                                              'recommended_modality': '16p13.13 unresolved '
                                                                                      'candidate alongside '
                                                                                      'CLEC16A '
                                                                                      '(context-dependent '
                                                                                      'hypothesis only)',
                                                              'mechanistic_evidence_and_pmids': '16p13.13 '
                                                                                                'candidate '
                                                                                                'alongside '
                                                                                                'CLEC16A: '
                                                                                                'human '
                                                                                                'EndoC-betaH1 '
                                                                                                'STAT1/chemokine '
                                                                                                'knockdown '
                                                                                                'evidence '
                                                                                                '(Dos Santos '
                                                                                                '2019 '
                                                                                                'PMID:30478640), '
                                                                                                'balanced '
                                                                                                'against '
                                                                                                'negative '
                                                                                                'NOD mouse '
                                                                                                'Dexi-KO '
                                                                                                'evidence '
                                                                                                '(Nieves-Bonilla '
                                                                                                '2020 '
                                                                                                'PMID:31435002; '
                                                                                                'commentary '
                                                                                                'Gingerich '
                                                                                                '2020 '
                                                                                                'PMID:31570815).',
                                                              'rank': 14},
                                                             {'gene_or_intervention': 'RNLS',
                                                              'cascade_layer': 'U3_ER_Stress_Modifier',
                                                              'causal_classification': 'SPECIES_DIVERGENT_HUMAN_OCR_PENALTY',
                                                              'bcrank_t1d_score_0_to_100': 30.96,
                                                              'unpenalized_subscore_0_to_100': 68.8,
                                                              'safety_gate_multiplier': 0.45,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 19.5,
                                                                            'amplifier_potency_25': 17.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 15.0,
                                                                            'cascade_nonredundancy_15': 10.8,
                                                                            'human_sc_islet_gsis_safety_15': 6.0},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.9811,
                                                                            'loeuf': 1.2815,
                                                                            'oe_mis': 0.9921},
                                                              'gtex_v10_pancreas_tpm': 1.485,
                                                              'gtex_v10_whole_blood_tpm': 0.408,
                                                              'recommended_modality': 'Quarantined by GY-004 '
                                                                                      '(human SC-islet '
                                                                                      'OCR/GSIS maturation '
                                                                                      'trade-off)',
                                                              'mechanistic_evidence_and_pmids': 'Top hit in '
                                                                                                'mouse NIT-1 '
                                                                                                'in vivo '
                                                                                                'CRISPR '
                                                                                                'screen (Cai '
                                                                                                '2020 '
                                                                                                'PMID:32719542), '
                                                                                                'but human '
                                                                                                'Stage-6 '
                                                                                                'SC-islet '
                                                                                                'follow-up '
                                                                                                '(MacDonald '
                                                                                                '2025 '
                                                                                                'PMID:39988068; '
                                                                                                'GY-004) '
                                                                                                'showed full '
                                                                                                'RNLS loss '
                                                                                                'alters '
                                                                                                'glycolytic/oxidative '
                                                                                                'metabolism '
                                                                                                'and GSIS.',
                                                              'rank': 15},
                                                             {'gene_or_intervention': 'GAD2',
                                                              'cascade_layer': 'U1_GADA_Autoantigen',
                                                              'causal_classification': 'NEUROENDOCRINE_GABA_CAUTION_GY007',
                                                              'bcrank_t1d_score_0_to_100': 18.11,
                                                              'unpenalized_subscore_0_to_100': 51.75,
                                                              'safety_gate_multiplier': 0.35,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 20.0,
                                                                            'amplifier_potency_25': 8.75,
                                                                            'iaa_plus_gada_endotype_breadth_20': 8.0,
                                                                            'cascade_nonredundancy_15': 6.75,
                                                                            'human_sc_islet_gsis_safety_15': 8.25},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'Endotype-narrow '
                                                                                      '(GADA-first only; 0% '
                                                                                      'protection in '
                                                                                      'IAA-first) + '
                                                                                      'paracrine GABA role',
                                                              'mechanistic_evidence_and_pmids': 'Encodes '
                                                                                                'GAD65 '
                                                                                                'autoantigen '
                                                                                                '(T1DE2), '
                                                                                                'but '
                                                                                                'deleting '
                                                                                                'GAD2 gives '
                                                                                                'zero '
                                                                                                'protection '
                                                                                                'against '
                                                                                                'IAA-first/PPI/IGRP/HIP '
                                                                                                'bystander '
                                                                                                'responses '
                                                                                                'and '
                                                                                                'perturbs '
                                                                                                'intra-islet '
                                                                                                'alpha-cell '
                                                                                                'glucagon '
                                                                                                'paracrine '
                                                                                                'GABA '
                                                                                                'inhibition.',
                                                              'rank': 16},
                                                             {'gene_or_intervention': 'TNFRSF1A',
                                                              'cascade_layer': 'U4_Dual_Signaling_Receptor',
                                                              'causal_classification': 'EPISTASIS_PENALIZED_NFKB_BYPASS_LOSS',
                                                              'bcrank_t1d_score_0_to_100': 17.12,
                                                              'unpenalized_subscore_0_to_100': 85.6,
                                                              'safety_gate_multiplier': 0.8,
                                                              'islet1_epistasis_multiplier': 0.25,
                                                              'subscores': {'human_evidence_25': 22.0,
                                                                            'amplifier_potency_25': 20.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 17.6,
                                                                            'cascade_nonredundancy_15': 12.75,
                                                                            'human_sc_islet_gsis_safety_15': 12.75},
                                                              'gnomad_v4': {'pLI': 0.9999,
                                                                            'oe_lof': 0.2163,
                                                                            'loeuf': 0.3775,
                                                                            'oe_mis': 0.7828},
                                                              'gtex_v10_pancreas_tpm': 22.048,
                                                              'gtex_v10_whole_blood_tpm': 159.402,
                                                              'recommended_modality': 'AVOID ON ISLET-1 '
                                                                                      '(cripples GY-001 '
                                                                                      'TNF-alpha -> NF-kB '
                                                                                      'bypass on Locus 3!)',
                                                              'mechanistic_evidence_and_pmids': 'Although '
                                                                                                'systemic '
                                                                                                'anti-TNFa '
                                                                                                '(golimumab '
                                                                                                'PMID:33207093) '
                                                                                                'slows '
                                                                                                'new-onset '
                                                                                                'T1D, '
                                                                                                'knocking '
                                                                                                'down TNFR1 '
                                                                                                'on Islet-1 '
                                                                                                'PLUS IL1R1 '
                                                                                                'eliminates '
                                                                                                'BOTH NF-kB '
                                                                                                'inputs to '
                                                                                                'Locus 3 '
                                                                                                'CXCL10, '
                                                                                                'crippling '
                                                                                                'the '
                                                                                                'mandatory '
                                                                                                'GY-001 '
                                                                                                'NF-kB '
                                                                                                'rescue '
                                                                                                'bypass for '
                                                                                                'SERPINB9 & '
                                                                                                'PD-L1!',
                                                              'rank': 17},
                                                             {'gene_or_intervention': 'ERBB3',
                                                              'cascade_layer': 'U4_Trophic_Receptor',
                                                              'causal_classification': 'UNRESOLVED_12Q13_MULTIGENE_PLEIOTROPIC_LOCUS',
                                                              'bcrank_t1d_score_0_to_100': 15.4,
                                                              'unpenalized_subscore_0_to_100': 44.0,
                                                              'safety_gate_multiplier': 0.35,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 14.0,
                                                                            'amplifier_potency_25': 8.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 10.0,
                                                                            'cascade_nonredundancy_15': 6.0,
                                                                            'human_sc_islet_gsis_safety_15': 6.0},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.6125,
                                                                            'loeuf': 0.7258,
                                                                            'oe_mis': 0.8225},
                                                              'gtex_v10_pancreas_tpm': 20.889,
                                                              'gtex_v10_whole_blood_tpm': 0.083,
                                                              'recommended_modality': 'Hold / unresolved '
                                                                                      '12q13.2 multi-gene '
                                                                                      'locus '
                                                                                      '(IKZF4/RPS26/ERBB3)',
                                                              'mechanistic_evidence_and_pmids': '12q13.2 T1D '
                                                                                                'locus '
                                                                                                '(rs2292239): '
                                                                                                'Kaur et al. '
                                                                                                '2016 '
                                                                                                '(PMID:26450151) '
                                                                                                'reported '
                                                                                                'ERBB3 '
                                                                                                'downregulation '
                                                                                                'by '
                                                                                                'cytokines '
                                                                                                'in human '
                                                                                                'islets and '
                                                                                                'decreased '
                                                                                                'cytokine-induced '
                                                                                                'apoptosis '
                                                                                                'upon Erbb3 '
                                                                                                'knockdown '
                                                                                                'in rat '
                                                                                                'INS-1E '
                                                                                                'cells, but '
                                                                                                'human '
                                                                                                '12q13.2 '
                                                                                                'gene '
                                                                                                'attribution '
                                                                                                '(IKZF4/RPS26/ERBB3) '
                                                                                                'and '
                                                                                                'pan-endocrine '
                                                                                                'RTK '
                                                                                                'developmental '
                                                                                                'pleiotropy '
                                                                                                'remain '
                                                                                                'unresolved.',
                                                              'rank': 18},
                                                             {'gene_or_intervention': 'NLRC5',
                                                              'cascade_layer': 'U1_MHC_I_Transactivator',
                                                              'causal_classification': 'REDUNDANT_WITH_B2M_KO',
                                                              'bcrank_t1d_score_0_to_100': 7.16,
                                                              'unpenalized_subscore_0_to_100': 50.25,
                                                              'safety_gate_multiplier': 0.95,
                                                              'islet1_epistasis_multiplier': 0.15,
                                                              'subscores': {'human_evidence_25': 18.0,
                                                                            'amplifier_potency_25': 5.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 10.0,
                                                                            'cascade_nonredundancy_15': 3.0,
                                                                            'human_sc_islet_gsis_safety_15': 14.25},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.551,
                                                                            'loeuf': 0.6438,
                                                                            'oe_mis': 0.8709},
                                                              'gtex_v10_pancreas_tpm': 1.682,
                                                              'gtex_v10_whole_blood_tpm': 41.731,
                                                              'recommended_modality': 'Redundant with Locus '
                                                                                      '1 B2M KO (risks '
                                                                                      'blunting HLA-E / '
                                                                                      'SP-1C transcription)',
                                                              'mechanistic_evidence_and_pmids': 'MHC-I '
                                                                                                'transactivator; '
                                                                                                'already '
                                                                                                'superseded '
                                                                                                'by B2M '
                                                                                                'replacement '
                                                                                                'and risks '
                                                                                                'downregulating '
                                                                                                'endogenous-promoter '
                                                                                                'HLA-E/HLA-C.',
                                                              'rank': 19},
                                                             {'gene_or_intervention': 'JAK1',
                                                              'cascade_layer': 'U3_Kinase_Hub',
                                                              'causal_classification': 'HARD_BLOCKED_GY001_DEADLOCK',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 86.1,
                                                              'safety_gate_multiplier': 0.5,
                                                              'islet1_epistasis_multiplier': 0.0,
                                                              'subscores': {'human_evidence_25': 22.5,
                                                                            'amplifier_potency_25': 21.25,
                                                                            'iaa_plus_gada_endotype_breadth_20': 17.6,
                                                                            'cascade_nonredundancy_15': 13.5,
                                                                            'human_sc_islet_gsis_safety_15': 11.25},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'FORBIDDEN KO (GY-001 '
                                                                                      'IFN-gamma blindness + '
                                                                                      'pLI=0.99)',
                                                              'mechanistic_evidence_and_pmids': 'Systemic '
                                                                                                'baricitinib '
                                                                                                'works '
                                                                                                'transiently '
                                                                                                'by '
                                                                                                'suppressing '
                                                                                                'host T '
                                                                                                'cells '
                                                                                                '(PMID:38055252), '
                                                                                                'but graft '
                                                                                                'JAK1 KO '
                                                                                                'blinds '
                                                                                                'Locus 3 '
                                                                                                'ISRE '
                                                                                                'promoters '
                                                                                                'so PD-L1 '
                                                                                                'and '
                                                                                                'SERPINB9 '
                                                                                                'stay dark '
                                                                                                'during '
                                                                                                'attack '
                                                                                                '(GY-001).',
                                                              'rank': 20},
                                                             {'gene_or_intervention': 'STAT1',
                                                              'cascade_layer': 'U3_Master_TF',
                                                              'causal_classification': 'HARD_BLOCKED_GY001_DEADLOCK',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 84.5,
                                                              'safety_gate_multiplier': 0.7,
                                                              'islet1_epistasis_multiplier': 0.0,
                                                              'subscores': {'human_evidence_25': 21.25,
                                                                            'amplifier_potency_25': 20.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 17.0,
                                                                            'cascade_nonredundancy_15': 13.5,
                                                                            'human_sc_islet_gsis_safety_15': 12.75},
                                                              'gnomad_v4': {'pLI': 1.0,
                                                                            'oe_lof': 0.2148,
                                                                            'loeuf': 0.3021,
                                                                            'oe_mis': 0.3849},
                                                              'gtex_v10_pancreas_tpm': 8.238,
                                                              'gtex_v10_whole_blood_tpm': 25.041,
                                                              'recommended_modality': 'FORBIDDEN KO (GY-001 '
                                                                                      'promoter deadlock)',
                                                              'mechanistic_evidence_and_pmids': 'Sintov 2022 '
                                                                                                '(PMID:36055241) '
                                                                                                'showed '
                                                                                                'STAT1 KO '
                                                                                                'reduces '
                                                                                                'CXCL10 in '
                                                                                                'unengineered '
                                                                                                'SC-islets, '
                                                                                                'but in '
                                                                                                'Islet-1 '
                                                                                                'STAT1 is '
                                                                                                'REQUIRED to '
                                                                                                'license '
                                                                                                'CXCL10/ISRE '
                                                                                                'promoters '
                                                                                                'driving '
                                                                                                'PD-L1 & '
                                                                                                'SERPINB9 '
                                                                                                '(GY-001).',
                                                              'rank': 21},
                                                             {'gene_or_intervention': 'IFNGR1',
                                                              'cascade_layer': 'U4_Licensing_Receptor',
                                                              'causal_classification': 'HARD_BLOCKED_GY001_DEADLOCK',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 79.75,
                                                              'safety_gate_multiplier': 0.85,
                                                              'islet1_epistasis_multiplier': 0.0,
                                                              'subscores': {'human_evidence_25': 18.75,
                                                                            'amplifier_potency_25': 18.75,
                                                                            'iaa_plus_gada_endotype_breadth_20': 16.0,
                                                                            'cascade_nonredundancy_15': 12.75,
                                                                            'human_sc_islet_gsis_safety_15': 13.5},
                                                              'gnomad_v4': {},
                                                              'gtex_v10_pancreas_tpm': None,
                                                              'gtex_v10_whole_blood_tpm': None,
                                                              'recommended_modality': 'FORBIDDEN KO (GY-001 '
                                                                                      'IFN-gamma sensor for '
                                                                                      'Locus 3)',
                                                              'mechanistic_evidence_and_pmids': 'Required to '
                                                                                                'sense T/NK '
                                                                                                'IFN-gamma '
                                                                                                'and '
                                                                                                'upregulate '
                                                                                                'Locus 3 '
                                                                                                'PD-L1 & '
                                                                                                'SERPINB9.',
                                                              'rank': 22},
                                                             {'gene_or_intervention': 'IRF1',
                                                              'cascade_layer': 'U3_Licensing_TF',
                                                              'causal_classification': 'HARD_BLOCKED_GY001_ISRE_DRIVER',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 77.75,
                                                              'safety_gate_multiplier': 0.8,
                                                              'islet1_epistasis_multiplier': 0.0,
                                                              'subscores': {'human_evidence_25': 19.5,
                                                                            'amplifier_potency_25': 17.5,
                                                                            'iaa_plus_gada_endotype_breadth_20': 16.0,
                                                                            'cascade_nonredundancy_15': 12.0,
                                                                            'human_sc_islet_gsis_safety_15': 12.75},
                                                              'gnomad_v4': {'pLI': 0.9946,
                                                                            'oe_lof': 0.2973,
                                                                            'loeuf': 0.4726,
                                                                            'oe_mis': 0.5771},
                                                              'gtex_v10_pancreas_tpm': 2.779,
                                                              'gtex_v10_whole_blood_tpm': 82.413,
                                                              'recommended_modality': 'FORBIDDEN KO (drives '
                                                                                      'ISRE licensing + '
                                                                                      'antiproliferative '
                                                                                      'restraint)',
                                                              'mechanistic_evidence_and_pmids': 'Essential '
                                                                                                'IFN-gamma '
                                                                                                '-> ISRE '
                                                                                                'feed-forward '
                                                                                                'transcription '
                                                                                                'factor for '
                                                                                                'Locus 3.',
                                                              'rank': 23},
                                                             {'gene_or_intervention': 'TNFAIP3',
                                                              'cascade_layer': 'U3_Survival_Brake',
                                                              'causal_classification': 'PROTECTIVE_BRAKE_DO_NOT_KO_PLUS_EPISTASIS',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 27.5,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 0.2,
                                                              'subscores': {'human_evidence_25': 23.0,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 4.5},
                                                              'gnomad_v4': {'pLI': 1.0,
                                                                            'oe_lof': 0.1243,
                                                                            'loeuf': 0.2169,
                                                                            'oe_mis': 0.8177},
                                                              'gtex_v10_pancreas_tpm': 7.444,
                                                              'gtex_v10_whole_blood_tpm': 39.886,
                                                              'recommended_modality': 'PROTECTIVE BRAKE '
                                                                                      '(gnomAD v4 pLI=1.00, '
                                                                                      'LOEUF=0.217): KO '
                                                                                      'kills beta cells; '
                                                                                      'constitutive OE '
                                                                                      'blunts CXCL10 NF-kB '
                                                                                      '(PMID:10523611)',
                                                              'mechanistic_evidence_and_pmids': 'A20 is an '
                                                                                                'essential '
                                                                                                'survival '
                                                                                                'brake (KO '
                                                                                                'sensitizes '
                                                                                                'islets to '
                                                                                                'death), '
                                                                                                'while '
                                                                                                'constitutive '
                                                                                                'A20 '
                                                                                                'overexpression '
                                                                                                'blocks '
                                                                                                'NF-kB '
                                                                                                'licensing '
                                                                                                'of Locus 3 '
                                                                                                '(and '
                                                                                                'VCTX211 '
                                                                                                'NCT05565248 '
                                                                                                'terminated).',
                                                              'rank': 24},
                                                             {'gene_or_intervention': 'PTPN2',
                                                              'cascade_layer': 'U3_Survival_Brake',
                                                              'causal_classification': 'PROTECTIVE_BRAKE_SIGN_TRAP_DO_NOT_KO',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 26.5,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 3.0},
                                                              'gnomad_v4': {'pLI': 0.9905,
                                                                            'oe_lof': 0.3314,
                                                                            'loeuf': 0.4862,
                                                                            'oe_mis': 0.7144},
                                                              'gtex_v10_pancreas_tpm': 5.636,
                                                              'gtex_v10_whole_blood_tpm': 6.526,
                                                              'recommended_modality': 'PROTECTIVE BRAKE '
                                                                                      '(gnomAD v4 pLI=0.991, '
                                                                                      'LOEUF=0.486) — DO NOT '
                                                                                      'KNOCK OUT!',
                                                              'mechanistic_evidence_and_pmids': 'PTPN2 '
                                                                                                'dephosphorylates '
                                                                                                'STAT1 and '
                                                                                                'restrains '
                                                                                                'BIM-mediated '
                                                                                                'mitochondrial '
                                                                                                'apoptosis '
                                                                                                'in human '
                                                                                                'beta cells '
                                                                                                '(Santin & '
                                                                                                'Eizirik '
                                                                                                'PMID:24003923); '
                                                                                                'T1D risk '
                                                                                                'allele '
                                                                                                'lowers '
                                                                                                'PTPN2 -> KO '
                                                                                                'accelerates '
                                                                                                'cytokine '
                                                                                                'death!',
                                                              'rank': 25},
                                                             {'gene_or_intervention': 'SOCS1',
                                                              'cascade_layer': 'U3_Survival_Brake',
                                                              'causal_classification': 'PROTECTIVE_JAK_BRAKE_PLUS_EPISTASIS',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 26.5,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 0.0,
                                                              'subscores': {'human_evidence_25': 20.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 6.0},
                                                              'gnomad_v4': {'pLI': 0.6129,
                                                                            'oe_lof': 0.3094,
                                                                            'loeuf': 0.7998,
                                                                            'oe_mis': 1.1332},
                                                              'gtex_v10_pancreas_tpm': 1.037,
                                                              'gtex_v10_whole_blood_tpm': 5.965,
                                                              'recommended_modality': 'PROTECTIVE BRAKE — KO '
                                                                                      'hyperactivates STAT1 '
                                                                                      'death; constitutive '
                                                                                      'OE blinds GY-001!',
                                                              'mechanistic_evidence_and_pmids': 'Same '
                                                                                                'bidirectional '
                                                                                                'trap as '
                                                                                                'A20: '
                                                                                                'endogenous '
                                                                                                'SOCS1 '
                                                                                                'protects '
                                                                                                'beta cells '
                                                                                                'from '
                                                                                                'runaway IFN '
                                                                                                'toxicity, '
                                                                                                'whereas '
                                                                                                'transgenic '
                                                                                                'SOCS1 '
                                                                                                'overexpression '
                                                                                                'blocks '
                                                                                                'IFN-gamma '
                                                                                                '-> CXCL10 '
                                                                                                'licensing '
                                                                                                '(GY-001).',
                                                              'rank': 26},
                                                             {'gene_or_intervention': 'CTSH',
                                                              'cascade_layer': 'U3_Survival_Brake',
                                                              'causal_classification': 'PROTECTIVE_BRAKE_SIGN_TRAP_DO_NOT_KO',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 26.25,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 22.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 3.75},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.9234,
                                                                            'loeuf': 1.1634,
                                                                            'oe_mis': 0.9564},
                                                              'gtex_v10_pancreas_tpm': 7.616,
                                                              'gtex_v10_whole_blood_tpm': 21.591,
                                                              'recommended_modality': 'PROTECTIVE BRAKE — DO '
                                                                                      'NOT KNOCK OUT!',
                                                              'mechanistic_evidence_and_pmids': 'Floyel et '
                                                                                                'al. 2014 '
                                                                                                'Diabetes '
                                                                                                '(PMID:24982147): '
                                                                                                'Cathepsin H '
                                                                                                'overexpression '
                                                                                                'protects '
                                                                                                'beta cells '
                                                                                                'against '
                                                                                                'cytokine '
                                                                                                'apoptosis '
                                                                                                'via '
                                                                                                'Rac2/JNK '
                                                                                                'inhibition '
                                                                                                'and '
                                                                                                'preserves '
                                                                                                'C-peptide '
                                                                                                'in T1D; '
                                                                                                'knocking '
                                                                                                'CTSH down '
                                                                                                'WORSENS '
                                                                                                'beta-cell '
                                                                                                'death!',
                                                              'rank': 27},
                                                             {'gene_or_intervention': 'BACH2',
                                                              'cascade_layer': 'U3_Survival_Brake',
                                                              'causal_classification': 'PROTECTIVE_BRAKE_SIGN_TRAP_DO_NOT_KO',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 26.0,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.75,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 2.25},
                                                              'gnomad_v4': {'pLI': 1.0,
                                                                            'oe_lof': 0.0809,
                                                                            'loeuf': 0.17,
                                                                            'oe_mis': 0.7552},
                                                              'gtex_v10_pancreas_tpm': 0.761,
                                                              'gtex_v10_whole_blood_tpm': 1.028,
                                                              'recommended_modality': 'PROTECTIVE BRAKE '
                                                                                      '(gnomAD v4 pLI=1.00, '
                                                                                      'LOEUF=0.170) — DO NOT '
                                                                                      'KNOCK OUT!',
                                                              'mechanistic_evidence_and_pmids': 'Intronic '
                                                                                                'T1D risk '
                                                                                                'SNP '
                                                                                                'rs72928038 '
                                                                                                'downregulates '
                                                                                                'BACH2 in '
                                                                                                'CD4+ T '
                                                                                                'cells, AND '
                                                                                                'Marroqui et '
                                                                                                'al. 2014 '
                                                                                                '(PMID:24608439) '
                                                                                                'proves '
                                                                                                'BACH2 '
                                                                                                'silencing '
                                                                                                'in human '
                                                                                                'beta cells '
                                                                                                'hyperactivates '
                                                                                                'MKK7/JNK1/BIM '
                                                                                                'apoptosis!',
                                                              'rank': 28},
                                                             {'gene_or_intervention': 'INS',
                                                              'cascade_layer': 'U1_Primary_Autoantigen',
                                                              'causal_classification': 'ESSENTIAL_THERAPEUTIC_PRODUCT_CANNOT_KO',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 25.0,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 25.0,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 0.0},
                                                              'gnomad_v4': {'pLI': 0.0539,
                                                                            'oe_lof': 0.5708,
                                                                            'loeuf': 1.1266,
                                                                            'oe_mis': 0.7867},
                                                              'gtex_v10_pancreas_tpm': 2898.83,
                                                              'gtex_v10_whole_blood_tpm': 0.0,
                                                              'recommended_modality': 'ESSENTIAL HORMONE '
                                                                                      'PRODUCT — protect via '
                                                                                      'Hurdle-4 normoxia & '
                                                                                      'ER homeostasis, NEVER '
                                                                                      'KO!',
                                                              'mechanistic_evidence_and_pmids': 'Primary '
                                                                                                'IAA-first '
                                                                                                'autoantigen '
                                                                                                '(rs689; '
                                                                                                'Leete 2020 '
                                                                                                'PMID:32172310), '
                                                                                                'but insulin '
                                                                                                'secretion '
                                                                                                'IS the '
                                                                                                "graft's "
                                                                                                'raison '
                                                                                                "d'etre; "
                                                                                                'mitigate '
                                                                                                'proinsulin '
                                                                                                'misfolding '
                                                                                                'by '
                                                                                                'preventing '
                                                                                                'Hurdle-4 '
                                                                                                'hypoxia '
                                                                                                '(<15 mmHg) '
                                                                                                'and '
                                                                                                'IL-1beta ER '
                                                                                                'stress!',
                                                              'rank': 29},
                                                             {'gene_or_intervention': 'CLEC16A',
                                                              'cascade_layer': 'U1_Mitophagy_Protector',
                                                              'causal_classification': 'NEAREST_GENE_TRAP_ESSENTIAL_MITOPHAGY_BRAKE',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 24.25,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 0.75},
                                                              'gnomad_v4': {'pLI': 0.0002,
                                                                            'oe_lof': 0.4659,
                                                                            'loeuf': 0.5883,
                                                                            'oe_mis': 0.9605},
                                                              'gtex_v10_pancreas_tpm': 3.271,
                                                              'gtex_v10_whole_blood_tpm': 4.896,
                                                              'recommended_modality': 'ESSENTIAL MITOPHAGY '
                                                                                      'PROTECTOR (gnomAD v4 '
                                                                                      'LOEUF=0.588) — DO NOT '
                                                                                      'KNOCK OUT!',
                                                              'mechanistic_evidence_and_pmids': '16p13.13 '
                                                                                                'mitophagy '
                                                                                                'regulator '
                                                                                                'required '
                                                                                                'for '
                                                                                                'Nrdp1/Parkin '
                                                                                                'mitophagy '
                                                                                                'and GSIS '
                                                                                                '(Soleimanpour '
                                                                                                '2014 '
                                                                                                'PMID:24949970) '
                                                                                                '— DO NOT '
                                                                                                'KNOCK OUT; '
                                                                                                'neighboring '
                                                                                                'DEXI '
                                                                                                'causality '
                                                                                                'remains '
                                                                                                'unresolved '
                                                                                                '(PMID:31435002; '
                                                                                                'commentary '
                                                                                                'PMID:31570815).',
                                                              'rank': 30},
                                                             {'gene_or_intervention': 'GLIS3',
                                                              'cascade_layer': 'U1_Lineage_Survival_TF',
                                                              'causal_classification': 'PROTECTIVE_LINEAGE_TF_DO_NOT_KO',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 23.0,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 23.0,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 0.0},
                                                              'gnomad_v4': {'pLI': 0.0,
                                                                            'oe_lof': 0.6743,
                                                                            'loeuf': 0.8477,
                                                                            'oe_mis': 1.3833},
                                                              'gtex_v10_pancreas_tpm': 3.006,
                                                              'gtex_v10_whole_blood_tpm': 0.037,
                                                              'recommended_modality': 'ESSENTIAL BETA-CELL '
                                                                                      'TF (gnomAD v4 '
                                                                                      'LOEUF=0.848; '
                                                                                      'recessive neonatal '
                                                                                      'diabetes) — DO NOT '
                                                                                      'KNOCK OUT!',
                                                              'mechanistic_evidence_and_pmids': 'Required '
                                                                                                'for INS '
                                                                                                'transcription '
                                                                                                'and '
                                                                                                'suppression '
                                                                                                'of SRp55 '
                                                                                                'splicing '
                                                                                                'stress / '
                                                                                                'BIM '
                                                                                                'apoptosis; '
                                                                                                'LoF causes '
                                                                                                'neonatal '
                                                                                                'diabetes '
                                                                                                'and '
                                                                                                'sensitizes '
                                                                                                'human beta '
                                                                                                'cells to '
                                                                                                'cytokines '
                                                                                                '(PMID:27899417).',
                                                              'rank': 31},
                                                             {'gene_or_intervention': 'DLK1',
                                                              'cascade_layer': 'U1_Beta_Lineage_Factor',
                                                              'causal_classification': 'PROTECTIVE_BETA_CELL_IDENTITY_FACTOR',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 22.5,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 19.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 3.0},
                                                              'gnomad_v4': {'pLI': 0.9971,
                                                                            'oe_lof': 0.2559,
                                                                            'loeuf': 0.4465,
                                                                            'oe_mis': 0.9877},
                                                              'gtex_v10_pancreas_tpm': 3.721,
                                                              'gtex_v10_whole_blood_tpm': 0.052,
                                                              'recommended_modality': 'Imprinted 14q32 '
                                                                                      'beta-cell highly '
                                                                                      'expressed notch-like '
                                                                                      'factor — DO NOT KO',
                                                              'mechanistic_evidence_and_pmids': 'Highly '
                                                                                                'enriched in '
                                                                                                'human beta '
                                                                                                'cells; loss '
                                                                                                'impairs '
                                                                                                'islet '
                                                                                                'secretory '
                                                                                                'identity.',
                                                              'rank': 32},
                                                             {'gene_or_intervention': 'CASP8',
                                                              'cascade_layer': 'U4_Apoptosis_Switch',
                                                              'causal_classification': 'HARD_BLOCKED_RIPK3_NECROPTOSIS_TRAP',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 20.5,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 17.5,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 3.0},
                                                              'gnomad_v4': {'pLI': 0.0009,
                                                                            'oe_lof': 0.5183,
                                                                            'loeuf': 0.7288,
                                                                            'oe_mis': 0.8229},
                                                              'gtex_v10_pancreas_tpm': 2.234,
                                                              'gtex_v10_whole_blood_tpm': 30.317,
                                                              'recommended_modality': 'FORBIDDEN KO/KD '
                                                                                      '(triggers lytic '
                                                                                      'RIPK1->RIPK3->MLKL '
                                                                                      'necroptosis!)',
                                                              'mechanistic_evidence_and_pmids': 'Kaiser et '
                                                                                                'al. 2011 '
                                                                                                'Nature '
                                                                                                '(PMID:21368762): '
                                                                                                'loss of '
                                                                                                'Caspase-8 '
                                                                                                'catalytic '
                                                                                                'restraint '
                                                                                                'on RIPK1 '
                                                                                                'under '
                                                                                                'TNF-alpha '
                                                                                                'converts '
                                                                                                'clean '
                                                                                                'apoptosis '
                                                                                                'blockade '
                                                                                                'into '
                                                                                                'explosive '
                                                                                                'DAMP-releasing '
                                                                                                'necroptosis, '
                                                                                                'supercharging '
                                                                                                'GY-010!',
                                                              'rank': 33},
                                                             {'gene_or_intervention': 'FADD',
                                                              'cascade_layer': 'U4_Death_Adaptor',
                                                              'causal_classification': 'HARD_BLOCKED_RIPK3_NECROPTOSIS_TRAP',
                                                              'bcrank_t1d_score_0_to_100': 0.0,
                                                              'unpenalized_subscore_0_to_100': 20.0,
                                                              'safety_gate_multiplier': 0.0,
                                                              'islet1_epistasis_multiplier': 1.0,
                                                              'subscores': {'human_evidence_25': 17.0,
                                                                            'amplifier_potency_25': 0.0,
                                                                            'iaa_plus_gada_endotype_breadth_20': 0.0,
                                                                            'cascade_nonredundancy_15': 0.0,
                                                                            'human_sc_islet_gsis_safety_15': 3.0},
                                                              'gnomad_v4': {'pLI': 0.1713,
                                                                            'oe_lof': 0.5182,
                                                                            'loeuf': 1.3392,
                                                                            'oe_mis': 0.8685},
                                                              'gtex_v10_pancreas_tpm': 3.696,
                                                              'gtex_v10_whole_blood_tpm': 18.203,
                                                              'recommended_modality': 'FORBIDDEN KO/KD '
                                                                                      '(triggers lytic RIPK3 '
                                                                                      'necroptosis!)',
                                                              'mechanistic_evidence_and_pmids': 'Same fatal '
                                                                                                'necroptosis '
                                                                                                'switch as '
                                                                                                'CASP8 under '
                                                                                                'TNF-alpha '
                                                                                                'exposure '
                                                                                                '(PMID:21368762); '
                                                                                                'block FAS '
                                                                                                'at the '
                                                                                                'plasma '
                                                                                                'membrane '
                                                                                                'instead!',
                                                              'rank': 34}]},
 'portfolio_2pow12_withdrawal_proof': {'symmetric_p05_true_same_design_survivor_states': '721/4096',
                                       'symmetric_p05_naive_product_of_hurdle_unions_states': '2401/4096',
                                       'symmetric_p05_true_same_design_survivor_prob': 0.176025,
                                       'symmetric_p05_naive_product_of_hurdle_unions_prob': 0.586182,
                                       'cross_design_chimera_inflation_factor': 3.33,
                                       'formal_action': 'WITHDRAWN: S1/Phase-3 numeric portfolio waterfall '
                                                        '(37.43% -> 62.80%) is permanently retired from '
                                                        'CAND-010.'}}




def _build_extracellular_biomaterial_census_iip_0020() -> Dict[str, Any]:
    """Deterministic extracellular pouch/cuff biomaterial foreign-peptide census against pinned 20,429-protein Swiss-Prot (IIP-0020; DEC-099)."""
    return {
        "contribution_id": "IIP-0020",
        "decision_id": "DEC-099",
        "pinned_human_swissprot_protein_count": 20429,
        "pinned_human_swissprot_gzip_sha256": "40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0",
        "license": "CC-BY-4.0",
        "reference_scope_and_isoform_qualification": (
            "Positional 8-11mer and 15mer non-matches are counted against the canonical 20,429-entry UniProtKB/Swiss-Prot human reference "
            "(matching IIP-0017). Absence from canonical Swiss-Prot is a reference-sequence classification rather than proof of recipient "
            "immunogenicity: for example, FHL-1 (UniProt P08603-2) carries a genuine human alternative-splice C-terminal SFTL tetrapeptide "
            "absent from canonical CFH (P08603-1), whereas canonical CFH[19-448] has 0/1,686 and 0/416 canonical non-matches. Conversely, "
            "MHCflurry 2.3.28 scans cover Layer 2's 14 retained HLA-C alleles for Design B cross-presentation screening and do not replace "
            "recipient HLA-A/B, HLA-DP/DQ/DR, B-cell antibody, or host-cell impurity testing."
        ),
        "gate_p05_catalase_species_lock": {
            "required_uniprot_accession": "P04040",
            "disqualified_xeno_accessions": ["P00432", "P55303"],
            "rationale": (
                "Gate P05 activity retention (>=70% Day-7, >=73,800 IU retained across 333.33 cm^2) does not enforce enzyme species or bound "
                "shed inactive protein mass; bovine P00432 (1,049/2,074 [50.58%] 8-11mers) and fungal P55303 (2,884/2,886 [99.93%] 8-11mers) "
                "are disqualified fail-closed in favor of sequence-verified recombinant human CAT P04040 (0/2,074 [527 aa] and 0/2,070 [526-aa Met-cleaved])."
            ),
        },
        "audited_extracellular_chains": {'Human_CAT_P04040': {'length_aa': 527, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '0/2074', 'foreign_8_11mer_pct': 0.0, 'unique_foreign_8_11mers': 0, 'positional_foreign_15mers': '0/513', 'foreign_15mer_pct': 0.0, 'unique_foreign_15mers': 0, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'Bovine_CAT_P00432': {'length_aa': 527, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '1049/2074', 'foreign_8_11mer_pct': 50.58, 'unique_foreign_8_11mers': 1049, 'positional_foreign_15mers': '321/513', 'foreign_15mer_pct': 62.57, 'unique_foreign_15mers': 321, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'Aspergillus_CAT_P55303': {'length_aa': 730, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '2884/2886', 'foreign_8_11mer_pct': 99.93, 'unique_foreign_8_11mers': 2884, 'positional_foreign_15mers': '716/716', 'foreign_15mer_pct': 100.0, 'unique_foreign_15mers': 716, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'SA_P22629_1based_37_163': {'length_aa': 127, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '474/474', 'foreign_8_11mer_pct': 100.0, 'unique_foreign_8_11mers': 474, 'positional_foreign_15mers': '113/113', 'foreign_15mer_pct': 100.0, 'unique_foreign_15mers': 113, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 132, 'pairs_8_11mer_x_14_hlac_le_100nM': 31, 'pairs_9mer_x_14_hlac_le_500nM': 84, 'pairs_9mer_x_14_hlac_le_100nM': 23, 'strongest_HLA_C0304_hit': [40.92, 'ATDGSGTAL']}}, 'SA_mature_P22629_25_183': {'length_aa': 159, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '602/602', 'foreign_8_11mer_pct': 100.0, 'unique_foreign_8_11mers': 602, 'positional_foreign_15mers': '145/145', 'foreign_15mer_pct': 100.0, 'unique_foreign_15mers': 145, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'CFH_19_448': {'length_aa': 430, 'sequence_sha256': None, 'sequence': '', 'positional_foreign_8_11mers': '0/1686', 'foreign_8_11mer_pct': 0.0, 'unique_foreign_8_11mers': 0, 'positional_foreign_15mers': '0/416', 'foreign_15mer_pct': 0.0, 'unique_foreign_15mers': 0, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'THBD_363_497_Cys': {'length_aa': 136, 'sequence_sha256': None, 'sequence': '', 'positional_foreign_8_11mers': '4/510', 'foreign_8_11mer_pct': 0.78, 'unique_foreign_8_11mers': 4, 'positional_foreign_15mers': '1/122', 'foreign_15mer_pct': 0.82, 'unique_foreign_15mers': 1, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 0, 'pairs_8_11mer_x_14_hlac_le_100nM': 0, 'pairs_9mer_x_14_hlac_le_500nM': 0, 'pairs_9mer_x_14_hlac_le_100nM': 0, 'strongest_HLA_C0304_hit': [8694.97, 'SGSGEPPPC']}}, 'H1a_tagless_ADIPOQ_FasL_232aa': {'length_aa': 232, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '34/894', 'foreign_8_11mer_pct': 3.8, 'unique_foreign_8_11mers': 34, 'positional_foreign_15mers': '14/218', 'foreign_15mer_pct': 6.42, 'unique_foreign_15mers': 14, 'mhcflurry_2p3p28_14_hlac_summary': None}, 'H1a_CysGGS_ADIPOQ_FasL_236aa': {'length_aa': 236, 'sequence_sha256': None, 'sequence': '', 'positional_foreign_8_11mers': '50/910', 'foreign_8_11mer_pct': 5.49, 'unique_foreign_8_11mers': 50, 'positional_foreign_15mers': '18/222', 'foreign_15mer_pct': 8.11, 'unique_foreign_15mers': 18, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 0, 'pairs_8_11mer_x_14_hlac_le_100nM': 0, 'pairs_9mer_x_14_hlac_le_500nM': 0, 'pairs_9mer_x_14_hlac_le_100nM': 0, 'strongest_HLA_C0304_hit': [9273.96, 'GEPGEGEKKEL']}}, 'T0_CysGGS_TNC_FasL_177aa': {'length_aa': 177, 'sequence_sha256': None, 'sequence': '', 'positional_foreign_8_11mers': '49/674', 'foreign_8_11mer_pct': 7.27, 'unique_foreign_8_11mers': 49, 'positional_foreign_15mers': '18/163', 'foreign_15mer_pct': 11.04, 'unique_foreign_15mers': 18, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 3, 'pairs_8_11mer_x_14_hlac_le_100nM': 0, 'pairs_9mer_x_14_hlac_le_500nM': 3, 'pairs_9mer_x_14_hlac_le_100nM': 0, 'strongest_HLA_C0304_hit': [3749.52, 'SLREQEKKEL']}}, 'IgG1Fc_LALAPG_direct_FasL_368aa': {'length_aa': 368, 'sequence_sha256': None, 'sequence': '', 'positional_foreign_8_11mers': '106/1438', 'foreign_8_11mer_pct': 7.37, 'unique_foreign_8_11mers': 106, 'positional_foreign_15mers': '42/354', 'foreign_15mer_pct': 11.86, 'unique_foreign_15mers': 42, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 65, 'pairs_8_11mer_x_14_hlac_le_100nM': 25, 'pairs_9mer_x_14_hlac_le_500nM': 38, 'pairs_9mer_x_14_hlac_le_100nM': 20, 'strongest_HLA_C0304_hit': [27.61, 'AAGGPSVFL']}}, 'Human_CAT_P04040_MetCleaved_2_527': {'length_aa': 526, 'sequence_sha256': None, 'sequence': None, 'positional_foreign_8_11mers': '0/2070', 'foreign_8_11mer_pct': 0.0, 'unique_foreign_8_11mers': 0, 'positional_foreign_15mers': '0/512', 'foreign_15mer_pct': 0.0, 'unique_foreign_15mers': 0, 'mhcflurry_2p3p28_14_hlac_summary': {'pairs_8_11mer_x_14_hlac_le_500nM': 0, 'pairs_8_11mer_x_14_hlac_le_100nM': 0}}},
    }


def _build_locus3_multimir_and_cbe_needle_manifest_iip_0018(
    iip_0015_manifest: Dict[str, Any],
) -> Dict[str, Any]:
    """Build deterministic Locus-3 Multi-miR Mode-B & CBE needle qualification manifest (IIP-0018; DEC-096)."""
    l3_fasta_path = REPO_ROOT / "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta"
    if not l3_fasta_path.is_file():
        raise FileNotFoundError(f"Missing required Locus-3 comparator FASTA: {l3_fasta_path}")

    def _req_0018(cond: bool, msg: str) -> None:
        if not cond:
            raise ValueError(msg)

    raw_fasta = l3_fasta_path.read_text(encoding="utf-8")
    fasta_sha256 = hashlib.sha256(l3_fasta_path.read_bytes()).hexdigest()
    _req_0018(
        fasta_sha256 == _IIP_0018_OFFLINE_REFERENCE_BUNDLE["comparator_fasta_sha256"],
        f"Locus-3 comparator FASTA SHA-256 mismatch: {fasta_sha256}",
    )

    l3_pam_list = iip_0015_manifest["pam_seed_shielded_synthesis_ready_manifest"][
        "locus3_cxcl10_ha_r_nt17_g_to_c_pam_shielded"
    ]
    wt_parent_seq = next(
        x["pam_shielded_donor_sequence"]
        for x in l3_pam_list
        if x["construct_id"] == "L3_BFB_PDL1_SYN4_PAM_SHIELDED_4078"
    ).upper()

    flank_up = _IIP_0018_OFFLINE_REFERENCE_BUNDLE["chr4_flank_up_300_minus_strand"]
    flank_dn = _IIP_0018_OFFLINE_REFERENCE_BUNDLE["chr4_flank_dn_300_minus_strand"]
    _req_0018(len(flank_up) == 300 and len(flank_dn) == 300, "Invalid Locus-3 flank length")

    codon_table = {
        "TTT": "F", "TTC": "F", "TTA": "L", "TTG": "L",
        "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L",
        "ATT": "I", "ATC": "I", "ATA": "I", "ATG": "M",
        "GTT": "V", "GTC": "V", "GTA": "V", "GTG": "V",
        "TCT": "S", "TCC": "S", "TCA": "S", "TCG": "S",
        "CCT": "P", "CCC": "P", "CCA": "P", "CCG": "P",
        "ACT": "T", "ACC": "T", "ACA": "T", "ACG": "T",
        "GCT": "A", "GCC": "A", "GCA": "A", "GCG": "A",
        "TAT": "Y", "TAC": "Y", "TAA": "*", "TAG": "*",
        "CAT": "H", "CAC": "H", "CAA": "Q", "CAG": "Q",
        "AAT": "N", "AAC": "N", "AAA": "K", "AAG": "K",
        "GAT": "D", "GAC": "D", "GAA": "E", "GAG": "E",
        "TGT": "C", "TGC": "C", "TGA": "*", "TGG": "W",
        "CGT": "R", "CGC": "R", "CGA": "R", "CGG": "R",
        "AGT": "S", "AGC": "S", "AGA": "R", "AGG": "R",
        "GGT": "G", "GGC": "G", "GGA": "G", "GGG": "G",
    }

    def _translate_orf(dna_seq: str) -> str:
        _req_0018(len(dna_seq) % 3 == 0, "ORF length must be divisible by 3")
        aas = [codon_table[dna_seq[i : i + 3]] for i in range(0, len(dna_seq), 3)]
        _req_0018(aas[-1] == "*" and "*" not in aas[:-1], "ORF stop codon invariant failed")
        return "".join(aas[:-1])

    def _kmers(prot_seq: str, lengths: Tuple[int, ...]) -> set[str]:
        out_set: set[str] = set()
        for k_len in lengths:
            for idx in range(0, len(prot_seq) - k_len + 1):
                out_set.add(prot_seq[idx : idx + k_len])
        return out_set

    sb9_wt_prot = _translate_orf(wt_parent_seq[888:2019])
    pdl1_wt_start = wt_parent_seq.index("ATGAGAATCTTCGCC")
    pdl1_wt_prot = _translate_orf(wt_parent_seq[pdl1_wt_start : pdl1_wt_start + 873])
    wt_c1 = _kmers(sb9_wt_prot, (8, 9, 10, 11)) | _kmers(pdl1_wt_prot, (8, 9, 10, 11))
    wt_c2 = _kmers(sb9_wt_prot, (15,)) | _kmers(pdl1_wt_prot, (15,))

    parsed_records = []
    for block in raw_fasta.strip().split(">")[1:]:
        lines = block.splitlines()
        hdr = lines[0].strip()
        cid = hdr.split()[0]
        seq = "".join(lines[1:]).strip().upper()
        seq_sha = hashlib.sha256(seq.encode("utf-8")).hexdigest()
        _req_0018(f"sha256={seq_sha}" in hdr, f"Header SHA mismatch on {cid}")

        is_parent = cid == "ARM1_L3_WT_PARENT_4078"
        if is_parent:
            _req_0018(seq == wt_parent_seq and len(seq) == 4078, f"Parent donor mismatch on {cid}")
            c_end = 3478
            exon1_9nt = None
            intron_317bp = None
            spliced_5utr = seq[873:888]
            unspliced_ins = ""
            sb9_dna = seq[888:2019]
        else:
            _req_0018(len(seq) == 4398, f"Expected 4398 bp donor on {cid}")
            c_end = 3798
            unspliced_ins = seq[879:1199]
            _req_0018(len(unspliced_ins) == 320 and unspliced_ins[:3] == "CAG", f"Invalid insert header on {cid}")
            intron_317bp = unspliced_ins[3:]
            _req_0018(
                intron_317bp.startswith("GTAAGT") and intron_317bp.endswith("TCTCTTCCAG"),
                f"Invalid synthetic intron splice termini on {cid}",
            )
            exon1_9nt = seq[873:882]
            _req_0018(exon1_9nt == "CAGAGACAG", f"Unexpected exon-1 9-nt leader on {cid}")
            spliced_5utr = exon1_9nt + seq[1199:1208]
            _req_0018(spliced_5utr == "CAGAGACAGGCCGCCACC", f"Unexpected mature spliced 5'-UTR on {cid}")
            sb9_dna = seq[1208:2339]

        _req_0018("ATG" not in spliced_5utr and "ATG" not in unspliced_ins, f"Upstream ATG detected on {cid}")
        pdl1_pos = seq.index("ATGAGAATCTTCGCC")
        sb9_prot = _translate_orf(sb9_dna)
        pdl1_prot = _translate_orf(seq[pdl1_pos : pdl1_pos + 873])
        _req_0018(pdl1_prot == pdl1_wt_prot, f"PD-L1 ORF mismatch on {cid}")

        novel_c1 = sorted((_kmers(sb9_prot, (8, 9, 10, 11)) | _kmers(pdl1_prot, (8, 9, 10, 11))) - wt_c1)
        novel_c2 = sorted((_kmers(sb9_prot, (15,)) | _kmers(pdl1_prot, (15,))) - wt_c2)
        if cid == "ARM6_L3_V2_INTRON_DUPLEX_IL1R1_FAS_C341S_TCA_4398":
            _req_0018(len(novel_c1) == 38 and len(novel_c2) == 15, f"Unexpected C341S neo-peptide count on {cid}")
        else:
            _req_0018(len(novel_c1) == 0 and len(novel_c2) == 0, f"Unexpected novel k-mer on {cid}")

        gram_donor = scan_donors_and_acceptors_both_strands(seq, cargo_bounds_1based=(601, c_end))
        cargo_counts = {
            "+don": sum(1 for d in gram_donor["donors"] if d["in_cargo"] and d["strand_relative_to_input"] == "+"),
            "-don": sum(1 for d in gram_donor["donors"] if d["in_cargo"] and d["strand_relative_to_input"] == "-"),
            "+acc": sum(1 for a in gram_donor["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "+"),
            "-acc": sum(1 for a in gram_donor["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "-"),
        }
        integrated_seq = flank_up + seq + flank_dn
        gram_int = scan_donors_and_acceptors_both_strands(
            integrated_seq,
            cargo_bounds_1based=(300 + 601, 300 + c_end),
        )
        int_cargo_counts = {
            "+don": sum(1 for d in gram_int["donors"] if d["in_cargo"] and d["strand_relative_to_input"] == "+"),
            "-don": sum(1 for d in gram_int["donors"] if d["in_cargo"] and d["strand_relative_to_input"] == "-"),
            "+acc": sum(1 for a in gram_int["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "+"),
            "-acc": sum(1 for a in gram_int["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "-"),
        }
        _req_0018(cargo_counts == int_cargo_counts, f"Integrated cargo splice-motif mismatch on {cid}")
        if is_parent:
            _req_0018(
                cargo_counts == {"+don": 10, "-don": 12, "+acc": 21, "-acc": 58},
                f"Unexpected parent cargo motif counts on {cid}",
            )
            _req_0018(
                len(gram_donor["donors"]) == 30 and len(gram_int["donors"]) == 38,
                f"Unexpected parent total donor counts on {cid}",
            )
        else:
            _req_0018(
                cargo_counts == {"+don": 11, "-don": 12, "+acc": 22, "-acc": 58},
                f"Unexpected Mode-B cargo motif counts on {cid}",
            )
            _req_0018(
                len(gram_donor["donors"]) == 31 and len(gram_int["donors"]) == 39,
                f"Unexpected Mode-B total donor counts on {cid}",
            )

        parsed_records.append({
            "construct_id": cid,
            "donor_length_bp": len(seq),
            "packaged_aav6_length_bp": len(seq) + 290,
            "packaged_aav6_headroom_bp": 4700 - (len(seq) + 290),
            "donor_sha256": seq_sha,
            "exon1_9nt": exon1_9nt,
            "excised_intron_length_bp": 0 if intron_317bp is None else len(intron_317bp),
            "mature_spliced_5utr": spliced_5utr,
            "spliced_5utr_length_nt": len(spliced_5utr),
            "unspliced_insert_atg_count": unspliced_ins.count("ATG"),
            "spliced_5utr_atg_count": spliced_5utr.count("ATG"),
            "isolated_donor_total_donors_both_strands": len(gram_donor["donors"]),
            "integrated_chr4_plus_2x300bp_total_donors_both_strands": len(gram_int["donors"]),
            "cargo_two_strand_motif_counts": cargo_counts,
            "novel_8_to_11mers_vs_arm1": len(novel_c1),
            "novel_15mers_vs_arm1": len(novel_c2),
            "promotion_status": (
                "BASELINE_CONTROL"
                if is_parent
                else (
                    "HELD_MODE_B_PRIMARY_CHALLENGER_PENDING_2X2_AND_STAGE0_QUALIFICATION"
                    if cid == "ARM5_L3_V2_INTRON_DUPLEX_IL1R1_FAS_WT_SB9_4398"
                    else "HELD_MODE_B_FACTORIAL_OR_EXPLORATORY_COMPARATOR"
                )
            ),
        })

    _req_0018(len(parsed_records) == 6, "Expected 6 Locus-3 comparator records")
    umi_bound_3689 = round(100.0 * (1.0 - (0.025 ** (1.0 / 3689.0))), 8)
    cbe_bound_50k = round(100.0 * (1.0 - (0.05 ** (1.0 / 50000.0))), 6)

    return {
        "proposal_id": "IIP-0018",
        "decision_id": "DEC-096",
        "evidence_class": "pre_registered_mode_b_locus3_multimir_challenger_suite_and_standalone_cbe_comparator_ledger",
        "canonical_fasta_and_ranking_invariance": {
            "canonical_scenario_a_fasta": "data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta",
            "canonical_scenario_a_fasta_untouched": True,
            "layer1_stack_rankings_untouched": True,
            "illustrative_hurdle3_vs_biological_gate3_distinction": (
                "Illustrative Hurdle 3 (autoimmune bystander survival) is distinct from biological Gate 3 (innate NK, macrophage, and complement protection); "
                "neither computational pre-registration nor a single Stage-0 assay recalibrates the blueprint's subjective hurdle percentages."
            ),
            "product_background_separation": (
                "K = 4, B = 0 applies strictly to replacing the Locus-3 donor within the four-locus Design A background. "
                "Design B retains endogenous/engineered HLA-C under GY-005 with a distinct edit ledger and presentation profile; "
                "Design A/X and Design B backgrounds require separately identified qualification runs (especially for ARM6 C341S +38 8-11mers)."
            ),
        },
        "mode_b_comparator_fasta": {
            "relative_path": "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta",
            "construct_count": 6,
            "sha256": fasta_sha256,
            "ha_l_grch38_chr4_minus": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["ha_l_grch38_chr4_minus"],
            "ha_r_grch38_chr4_minus": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["ha_r_grch38_chr4_minus"],
            "outer_chromosomal_flank_verification_bp": 300,
        },
        "cassette_anatomy_and_scanner_scope": {
            "inserted_cassette_bp": 320,
            "retained_exon1_anchor_bp": 3,
            "excised_synthetic_intron_bp": 317,
            "exon1_sequence_9nt": "CAGAGACAG",
            "exon2_kozak_leader_9nt": "GCCGCCACC",
            "mature_spliced_5utr_18nt": "CAGAGACAGGCCGCCACC",
            "hairpin_1_mir_e_v2_target_22nt": {"IL1R1": "CACTTTAGTGGAGTCAAAGATA", "NT1_v2": "CACGGTAACGCTAACTACGCTA"},
            "hairpin_2_mir_16_2_v2_target_22nt": {"FAS": "AACTCCAAGGGATTGGAATTGA", "NT2": "GCCTAGTCTGATTAGTTTCGGA"},
            "seed_audit_summary": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["seed_audit"],
            "motif_scanner_scope_limitation": (
                "The Layer-2 two-strand splice scanner uses positional consensus/log-odds for 5' donors and a 23-mer polypyrimidine heuristic for 3' acceptors—not "
                "the dependency-aware MaxEnt model of Yeo & Burge 2004 (PMID:15285897)—and does not model non-GT introns, shifted U1 register, branchpoint competition, "
                "or exonic/intronic splicing enhancers/silencers. Furthermore, avoiding IL1R1/FAS seed matches in NT1_v2/NT2 does not screen the rest of the beta-cell "
                "transcriptome, passenger strands, or 5'-isomiRs (Fellmann 2013 PMID:24332856; Schirle 2014 PMID:25359968; Amen 2022 PMID:35880017). "
                "Quantitative spliced-fraction (>=85% spliced / <=15% intron retention), recovery-calibrated two-strand UMI chimeras (>=3,689 effective molecules -> "
                f"{umi_bound_3689}% two-sided 95% upper bound; Kivioja 2011 PMID:22101854), transcriptome-wide RNA-seq, absolute AGO-RIP small-RNA-seq "
                "(Poy 2004 PMID:15538371; Grimm 2006 PMID:16724069), and resting/low-IFN SERPINB9+PD-L1 retention (GY-001) are mandatory."
            ),
        },
        "pre_synthesis_2x2_transient_falsifier_and_human_gsis_tradeoff": {
            "design": (
                "Blocked 2x2 transient IL1R1-knockdown x FAS-knockdown human SC-islet experiment within matched independent differentiations prior to integrated "
                "6-arm AAV6 donor synthesis, comparing double-control, single IL1R1 KD, single FAS KD, and dual KD with an independent targeting reagent pair or "
                "RNAi-resistant rescue across IL-1beta, membrane mFasL vs SA-FasL (Trivedi 2019 PMID:31552143; Headen 2018 PMID:29867165), and a TNF-alpha + IFN-gamma + TRAIL bypass condition."
            ),
            "unresolved_human_islet_secretory_tradeoffs": (
                "Must test matched absolute insulin/C-peptide output (>=85% of ARM1), low-glucose shut-off, and post-cytokine recovery alongside SI >= 2.5 because "
                "human islet literature shows conflicting effects: Loweth 1998 (PMID:9588443) vs Loweth 2000 (PMID:11220355) on Fas-expression sufficiency, "
                "Schumann 2007 (PMID:17299038) reporting impaired human-islet fuel-stimulated secretion under Fas blockade, Hajmrle 2016 (PMID:27699257) and "
                "Dror 2017 (PMID:28092375) showing acute/postprandial IL-1beta insulinotropic compensation, and Wiedemann 2022 (PMID:35750050) addressing microglial/vagal "
                "cephalic IL-1beta signaling that isolated graft perifusion does not model."
            ),
            "inherited_stricter_stage0_gates": (
                "Inherits existing clonogenic AP1903 escape bounds and recovery controls, >=62,958 independent duplex-UMI molecules for TP53/PPM1D/BCOR somatic sweeps "
                f"(50,000 target molecules gives only 87.53% probability of >=3 mutants at VAF 1e-4 and {cbe_bound_50k}% one-sided 95% 0-event bound), "
                "CAST-Seq chromosomal-rearrangement scope (Turchiano 2021 PMID:33626327), Rule S8b SA-FasL microgel drop rule, and Arm-2 post-adjunct-depletion rechallenge."
            ),
        },
        "verified_6_arm_constructs": parsed_records,
        "standalone_cbe_comparator_registry_ensembl_116": {
            "annotation_release_note": (
                "Reconstructed against Ensembl release 116 canonical transcripts FAS ENST00000652046.1 and IL1R1 ENST00000410023.6, "
                "explicitly distinguished from Layer-2's pinned baseline Ensembl release 112 / GENCODE v46 cache. "
                "Zero-bystander status applies ONLY to the narrow C-only [4..8] sequence filter: all 3 FAS guides carry an additional C9 inside TadCBEd's [3..9] window "
                "(Neugebauer 2023 PMID:36357719), and all 4 CAG->TAG guides carry an adjacent in-codon adenine where residual CBE adenine deamination can convert "
                "CAG->TAG->TGG (Trp) and undo stop installation (Zhang 2024 PMID:38402281; GC-context deaminase scope per Thuronyi 2019 PMID:31332326)."
            ),
            "candidate_guides_9_across_7_variants": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["cbe_9_guides_7_variants"],
            "retracted_or_reclassified_s1_edits": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["retracted_or_reclassified_s1_edits"],
            "germline_protective_coding_benchmarks_non_cbe": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["germline_protective_coding_benchmarks_non_cbe"],
        },
        "opentargets_mondo_0005147_top200_timestamped_receipt": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["opentargets_receipt"],
        "bcrank_t1d_heuristic_stage0_rubric": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["bcrank_t1d_heuristic_rubric"],
        "portfolio_2pow12_same_design_withdrawal_proof": _IIP_0018_OFFLINE_REFERENCE_BUNDLE["portfolio_2pow12_withdrawal_proof"],
    }



def _build_design_y_wildcard_manifest_iip_0023() -> Dict[str, Any]:
    """
    Sequence, promoter-CGI, TadCBEd haplotype, CIITA isoform, and source-flux adenosine reaction-diffusion
    audit for Stage-0 Design Y wildcard comparators strictly inside the <= 20% wildcard firewall (IIP-0023; DEC-102).
    """
    dy_fasta = REPO_ROOT / "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta"
    raw_bytes = dy_fasta.read_bytes()
    file_sha = hashlib.sha256(raw_bytes).hexdigest()
    expected_file_sha = "c7f54b824a73cf9d40247d4fd251cb5c28a8eca4a1530b9661284200bb4cbabc"
    if file_sha != expected_file_sha:
        raise ValueError(f"Design Y wildcard FASTA SHA-256 {file_sha} != {expected_file_sha}")

    records: List[Dict[str, Any]] = []
    cur_hdr = None
    cur_seq: List[str] = []
    for ln in raw_bytes.decode("utf-8").splitlines():
        s = ln.strip()
        if not s:
            continue
        if s.startswith(">"):
            if cur_hdr is not None:
                seq_str = "".join(cur_seq).upper()
                records.append({
                    "header": cur_hdr,
                    "construct_id": cur_hdr.split()[0],
                    "length_bp": len(seq_str),
                    "sha256": hashlib.sha256(seq_str.encode("utf-8")).hexdigest(),
                    "gc_fraction": round((seq_str.count("G") + seq_str.count("C")) / len(seq_str), 6),
                    "gsg_p2a_motif_occurrences": seq_str.count("GGAAGCGGAGCTACTAACTTCAGCCTGCTGAAGCAGGCTGGAGACGTGGAGGAGAACCCTGGACCT"),
                    "kanr_or_colE1_ori_motif_occurrences": seq_str.count("ATGAGCCATATTCAACGGGAAACG") + seq_str.count("TTGAGATCCTTTTTTTCTGCGCGTAATCTG"),
                })
            cur_hdr = s[1:]
            cur_seq = []
        else:
            cur_seq.append(s)
    if cur_hdr is not None:
        seq_str = "".join(cur_seq).upper()
        records.append({
            "header": cur_hdr,
            "construct_id": cur_hdr.split()[0],
            "length_bp": len(seq_str),
            "sha256": hashlib.sha256(seq_str.encode("utf-8")).hexdigest(),
            "gc_fraction": round((seq_str.count("G") + seq_str.count("C")) / len(seq_str), 6),
            "gsg_p2a_motif_occurrences": seq_str.count("GGAAGCGGAGCTACTAACTTCAGCCTGCTGAAGCAGGCTGGAGACGTGGAGGAGAACCCTGGACCT"),
            "kanr_or_colE1_ori_motif_occurrences": seq_str.count("ATGAGCCATATTCAACGGGAAACG") + seq_str.count("TTGAGATCCTTTTTTTCTGCGCGTAATCTG"),
        })

    if [r["length_bp"] for r in records] != [11066, 11859, 12555]:
        raise ValueError(f"Unexpected Design Y comparator lengths: {[r['length_bp'] for r in records]}")

    # Explicit steady-state peri-islet source-flux adenosine reaction-diffusion balance:
    # C_surf(z=0) = J_ADO / sqrt(D_eff * k_clear) * exp(-gap / lambda_ADO), lambda_ADO = sqrt(D_eff / k_clear)
    ado_models: List[Dict[str, Any]] = []
    for label, j_pmol_cm2_s, d_cm2_s, k_s_inv, gap_um in (
        ("IEC_CD39_CD73_ModerateClearance_5umGap", 0.18, 4.5e-6, 0.15, 5.0),
        ("IEC_CD39_CD73_SlowClearance_5umGap", 0.25, 7.0e-6, 0.05, 5.0),
        ("PanLineage_CD39_CD73_ModerateClearance_0um", 0.45, 4.5e-6, 0.15, 0.0),
    ):
        lam_cm = math.sqrt(d_cm2_s / k_s_inv)
        lam_um = lam_cm * 1e4
        # J in mol/(cm^2*s) = j_pmol_cm2_s * 1e-12; C in mol/cm^3 -> * 1e12 for nM
        c0_nM = (j_pmol_cm2_s * 1e-12 / math.sqrt(d_cm2_s * k_s_inv)) * 1e12
        c_gap_nM = c0_nM * math.exp(-(gap_um * 1e-4) / lam_cm)
        ado_models.append({
            "scenario": label,
            "ectonucleotidase_flux_pmol_cm2_s": j_pmol_cm2_s,
            "d_eff_cm2_s": d_cm2_s,
            "ada1_ent1_clearance_k_s_inv": k_s_inv,
            "decay_length_lambda_um": round(lam_um, 2),
            "iec_to_beta_gap_um": gap_um,
            "predicted_beta_surface_adenosine_nM": round(c_gap_nM, 2),
        })

    return {
        "contribution_id": "IIP-0023",
        "decision_id": "DEC-102",
        "wildcard_firewall_scope": "Unscored Stage-0 Design Y wildcard within shared <= 20% Y/Z allocation cap; zero changes to core scored Blueprints A, B, or X.",
        "fasta_artifact": {
            "relative_path": "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta",
            "file_sha256": file_sha,
            "constructs": records,
        },
        "eepassige_attp_in_genome_polarity_and_context_separation": {
            "b2m_exon1_twinpe_excision_grch38": "chr15:44711547-44711619 (73 bp removing native Met1, signal peptide, Gln22 and GTGAGT donor -> 52 bp Bxb1 attP)",
            "attb_minicircle_recombination_products": "52 bp attP x 38 bp attB -> 45 bp attR (0 sense ATGs across 75 bp retained 5'-UTR + attR leader upstream of 154 bp SPA+MAZ4) + 45 bp attL (0 ATGs either strand)",
            "dsb_and_nickase_caveat": "Uses paired Cas9n nickases without intended exposed nuclease DSBs while retaining CAST-Seq (< 1e-5) and long-read ONT checks for paired-nick staggered DSB intermediates (Levesque et al. 2026 PMID:42749803; Hanlon et al. 2019 PMID:31570731; Shy et al. 2023 PMID:36008610; Allen et al. 2024 PMID:37127662).",
            "pandey_2025_pmid38858586_experimental_context_disclosure": (
                "Pandey et al. 2025 (PMID:38858586) measured 3.8%/20.9%/24% OT4 capture after puromycin enrichment, 0.008%/0.004% OT1/OT2 in primary fibroblasts "
                "with IDLV donor, and 3.8% vs 0.52% hiPSC knock-in using homozygous CCR5 attB + 5.6-kb attP plasmid; >= 3.0% pre-enrichment knock-in of an 11.1-kb "
                "attB minicircle at B2M attP is therefore an explicit prospective Stage-0 hPSC target rather than an already-demonstrated yield (STRAIGHT-IN clonal "
                "hPSC precedent in Blanch-Asensio et al. 2026 PMID:39179886; ISCro4 RNA-guided recombinase context in Pelea et al. 2026 PMID:41642947)."
            ),
        },
        "ciita_and_cxcl10_cgi_tadcbed_and_isoform_reconciliation": {
            "promoter_cgi_window_reconciliation": {
                "cxcl10_601bp_chr4_76023197_76023797": {"cpg_count": 3, "obs_over_exp": 0.1520, "meets_gardiner_garden_cgi": False},
                "ciita_piv_601bp_broad_window": {"cpg_count": 30, "obs_over_exp": 0.5154, "meets_gardiner_garden_cgi": False},
                "ciita_piv_201bp_tss_subwindow_chr16_10878900_10879100": {
                    "cpg_count": 16,
                    "gc_pct": 64.68,
                    "obs_over_exp": 0.7982,
                    "meets_gardiner_garden_cgi": True,
                },
                "crisproff_comparison_note": (
                    "While CXCL10 lacks a CpG island, CIITA-pIV contains a 201-bp TSS-spanning CpG-dense subwindow (Obs/Exp = 0.7982) and CRISPRoff "
                    "can silence non-CGI genes in several contexts (Nunez et al. 2021 PMID:33838111); TadCBEd vs CRISPRoff is therefore evaluated as a "
                    "head-to-head 60-day differentiation + cytokine durability comparison rather than a promoter-CGI exclusion."
                ),
            },
            "tadcbed_editing_window_and_a_to_g_haplotype_gate": (
                "TadCBEd exhibits C->T activity across protospacer positions 3-9 alongside residual A->G editing (Neugebauer et al. 2023 PMID:36357719): "
                "at CIITA Exon 2 (C7AG), joint C7>T + A8>G converts CAG -> TGG (Trp missense instead of TAG stop), and Exon 10 carries adjacent A6. "
                "Clonal hPSC qualification therefore requires full amplicon NGS haplotype distributions (quantifying C>T, A>G, and indels simultaneously) "
                "rather than C-only bystander scans."
            ),
            "ciita_isoform_accession_reconciliation": (
                "Pinned GENCODE v46 ENST00000576601.1 (177 aa, 7 exons) and ENST00000637439.1 are truncated partial models; full-length RefSeq "
                "NM_001286402.1 (1,131 aa, pIII) maps chr16:10895386:C>T to p.Gln53*, NM_000246.4 (1,155 aa, pI) to p.Gln77*, and classical pIV "
                "(Muhlethaler-Mottet et al. 1997 PMID:9184229) to p.Gln29*. Because 147-bp Exon 2 (147 mod 3 = 0) permits in-frame exon skipping or "
                "downstream Met reinitiation, Exon 10 NACHT-domain stop (chr16:10904792, p.Trp334* on NM_001286402.1) is co-tested with protein-level "
                "IFN-gamma HLA-DR/DP/DQ flow verification."
            ),
        },
        "adenosine_source_flux_reaction_diffusion_and_cd200_scope": {
            "human_receptor_and_hypoxia_context": (
                "Human islets abundantly express Gi-coupled ADORA1 (inhibiting GSIS; reversed by 1 uM DPCPX in Mohammed Al-Amily et al. 2026 PMID:42660457, "
                "tested alongside 100 nM selective DPCPX in Y-03) and Gs-coupled ADORA2A (promoting alpha-cell glucagon release; Liu et al. 2024 PMID:38879678), "
                "with hypoxia-regulated adenosine transcript shifts reported in Brandhorst et al. 2026 (PMID:42791925)."
            ),
            "source_flux_reaction_diffusion_scenarios": ado_models,
            "cd200_and_mir375_detargeting_caveats": (
                "Chai et al. 2022 (PMID:35297680) used alpha-cell-enriched miRNAs rather than miR-375 (which is abundant in both human alpha and beta cells), "
                "Hu et al. 2025 (PMID:40251154) co-tested CD99 + CD200 rather than iEC-only CD200 indirect-CD4 suppression alone, and packing 7 tandem units "
                "across 11.1 kb can introduce transcriptional supercoiling coupling (Naughton et al. 2013 PMID:23416946; Gilbert & Allan 2014 PMID:24584092), "
                "making direct Y-03/Y-04 empirical co-culture, AGO2-RIP miR-375, anti-CD200 reversal, and single-cell multi-cistron gates mandatory."
            ),
        },
    }


UNIPROT_P01308_INS_WT_110AA = (
    "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAED"
    "LQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"
)

UNIPROT_P29597_TYK2_WT_1187AA = (
    "MPLRHWGMARGSKPVGDGAQPMAAMGGLKVLLHWAGPGGGEPWVTFSESSLTAEEVCIHIAHKVGITPPCFNLFALFDAQAQVWLPPNHILEIPRDASLM"
    "LYFRIRFYFRNWHGMNPREPAVYRCGPPGTEASSDQTAQGMQLLDPASFEYLFEQGKHEFVNDVASLWELSTEEEIHHFKNESLGMAFLHLCHLALRHGI"
    "PLEEVAKKTSFKDCIPRSFRRHIRQHSALTRLRLRNVFRRFLRDFQPGRLSQQMVMVKYLATLERLAPRFGTERVPVCHLRLLAQAEGEPCYIRDSGVAP"
    "TDPGPESAAGPPTHEVLVTGTGGIQWWPVEEEVNKEEGSSGSSGRNPQASLFGKKAKAHKAVGQPADRPREPLWAYFCDFRDITHVVLKEHCVSIHRQDN"
    "KCLELSLPSRAAALSFVSLVDGYFRLTADSSHYLCHEVAPPRLVMSIRDGIHGPLLEPFVQAKLRPEDGLYLIHWSTSHPYRLILTVAQRSQAPDGMQSL"
    "RLRKFPIEQQDGAFVLEGWGRSFPSVRELGAALQGCLLRAGDDCFSLRRCCLPQPGETSNLIIMRGARASPRTLNLSQLSFHRVDQKEITQLSHLGQGTR"
    "TNVYEGRLRVEGSGDPEEGKMDDEDPLVPGRDRGQELRVVLKVLDPSHHDIALAFYETASLMSQVSHTHLAFVHGVCVRGPENIMVTEYVEHGPLDVWLR"
    "RERGHVPMAWKMVVAQQLASALSYLENKNLVHGNVCGRNILLARLGLAEGTSPFIKLSDPGVGLGALSREERVERIPWLAPECLPGGANSLSTAMDKWGF"
    "GATLLEICFDGEAPLQSRSPSEKEHFYQRQHRLPEPSCPQLATLTSQCLTYEPTQRPSFRTILRDLTRLQPHNLADVLTVNPDSPASDPTVFHKRYLKKI"
    "RDLGEGHFGKVSLYCYDPTNDGTGEMVAVKALKADCGPQHRSGWKQEIDILRTLYHEHIIKYKGCCEDQGEKSLQLVMEYVPLGSLRDYLPRHSIGLAQL"
    "LLFAQQICEGMAYLHAQHYIHRDLAARNVLLDNDRLVKIGDFGLAKAVPEGHEYYRVREDGDSPVFWYAPECLKEYKFYYASDVWSFGVTLYELLTHCDS"
    "SQSPPTKFLELIGIAQGQMTVLRLTELLERGERLPRPDKCPCEVYHLMKNCWETEASFRPTFENLIPILKTVHEKYQGQAPSVFSVC"
)

EXPECTED_DESIGNB_FASTA_SHA256_IIP0026 = "4bb20389773c76b2705031ba675487825dfbd94d920a692cde75b7d56af22aa4"
EXPECTED_DESIGNB_C1_C5_PAIR_SHA256_IIP0026 = "82c351af082e0f97361e715c36e2ab5872b8d097efa1c9f59dfda53ea60496ea"
EXPECTED_SWISSPROT_UNCOMPRESSED_SHA256_IIP0026 = "13852e174364bf1c705206c38eacae57210f5bca9955f05be6b4ff48f727d37b"
EXPECTED_SWISSPROT_GZ_SHA256_IIP0026 = "40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0"


def _is_strict_int_iip0026(val: Any) -> bool:
    return isinstance(val, int) and not isinstance(val, bool)


def _protein_kmers_iip0026(aa: str, ks: Tuple[int, ...]) -> Set[str]:
    out: Set[str] = set()
    n = len(aa)
    for k in ks:
        for i in range(max(0, n - k + 1)):
            out.add(aa[i : i + k])
    return out


def _translate_strict_cds_iip0026(cds: str, expect_terminal_stop: bool = True) -> str:
    s = cds.upper()
    if len(s) == 0 or len(s) % 3 != 0 or any(b not in "ACGT" for b in s):
        raise ValueError(f"Invalid CDS length ({len(s)}) or alphabet")
    codons = [GENETIC_CODE[s[i : i + 3]] for i in range(0, len(s), 3)]
    if codons[0] != "M":
        raise ValueError(f"CDS does not start with Met (got {codons[0]})")
    if expect_terminal_stop:
        if codons[-1] != "*" or "*" in codons[:-1]:
            raise ValueError("CDS lacks clean terminal stop or has premature stop")
        return "".join(codons[:-1])
    if "*" in codons:
        raise ValueError("Internal stop codon in non-stop CDS")
    return "".join(codons)


def validate_design_b_transcribed_construct_iip_0026(
    design_id: str,
    donor_seq: str,
    cargo_bounds_0based: Tuple[int, int],
    orf_specs: List[Dict[str, Any]],
    parent_mature_proteins: List[str],
    swissprot_k8_11: Set[str],
    swissprot_k15: Set[str],
    pinned_layer3_sequences: Dict[str, str],
    *,
    expected_donor_sha256: Optional[str] = None,
    require_layer3_identity: bool = True,
    transcribed_intervals: Optional[List[Dict[str, Any]]] = None,
    observed_5prime_race_end_bp: Any = None,
    observed_3prime_race_end_bp: Any = None,
    readthrough_umi_n_eff: Any = None,
    readthrough_umi_k: Any = None,
) -> Dict[str, Any]:
    """
    Fail-closed DNA-bound construct and transcript-frame validator (IIP-0026; DEC-105):
      1. Requires a verified 64-hex expected_donor_sha256 matching sha256(donor_seq) before
         emitting COMPUTED_FROM_DNA provenance (rejecting None or mismatched digests).
      2. Enforces <= 4,700 bp packaged AAV6 (with 2x145 bp ITRs), 0 encoded 2A motifs, non-empty
         orf_specs, non-overlapping same-strand declared ORFs, and non-zero mature protein slices.
      3. Evaluates strand-specific transcribed_intervals and declared_cds_frame across all reading
         frames on both '+' and '-' strands (inclusive of len - 300):
           - Any unterminated [AG]NNATGG run open at the scanned sequence boundary fails closed
             (HOLD_OPEN_BOUNDARY_KOZAK_ORF).
           - Inside any declared CDS, only in-frame starts matching declared_cds_frame and
             terminating at the declared stop are permitted; any internal out-of-frame >= 300-nt
             [AG]NNATGG run (e.g. a 357-nt +1 run wholly inside a 600-nt CDS) fails closed
             (FAIL_UNDECLARED_KOZAK_ORF).
           - Any >= 300-nt [AG]NNATGG start inside a declared upstream regulatory promoter window
             upstream of putative TSS (such as c1 2308-3282 or c2 2029-3003, -73 nt upstream of
             PD-L1 CDS in frame 2 != 0) emits HOLD_PENDING_5PRIME_RACE_TSS while 5'-RACE is
             UNRESOLVED, fails closed (FAIL_TRANSCRIBED_UPSTREAM_KOZAK_ORF_BY_5PRIME_RACE) if
             observed 5'-RACE places TSS at or upstream of that ATG, and resolves cleanly only
             when observed 5'-RACE places TSS strictly downstream in (tata_atg, cds_start] with
             readthrough_umi_k == 0 across readthrough_umi_n_eff >= 3,689.
      4. Rejects Boolean or non-positive 5'/3'-RACE coordinates, representing unmeasured empirical
         transcript ends explicitly as "UNRESOLVED".
      5. Computes exact unique-string peptide-set subtraction alongside positional window counts.
    """
    if not isinstance(donor_seq, str) or len(donor_seq) == 0:
        raise ValueError(f"[{design_id}] Empty or non-string donor_seq")
    seq = donor_seq.upper()
    if any(b not in "ACGT" for b in seq):
        raise ValueError(f"[{design_id}] Non-ACGT base in donor")
    actual_sha256 = sha256_str(seq)
    if (
        not isinstance(expected_donor_sha256, str)
        or not re.fullmatch(r"[0-9a-f]{64}", expected_donor_sha256.lower())
        or actual_sha256 != expected_donor_sha256.lower()
    ):
        raise ValueError(
            f"[{design_id}] FAIL_CONSTRUCT_SHA256_MISMATCH: expected verified 64-hex {expected_donor_sha256!r}, got {actual_sha256}"
        )

    aav6_bp = len(seq) + AAV2_TWO_ITRS_LENGTH_BP
    if aav6_bp > AAV6_PACKAGING_LIMIT_BP:
        raise ValueError(
            f"[{design_id}] FAIL_AAV6_PACKAGING_CEILING_EXCEEDED: packaged {aav6_bp} bp > {AAV6_PACKAGING_LIMIT_BP} bp ceiling"
        )

    p2a_dna = "GGAAGCGGAGCTACTAACTTCAGCCTGCTGAAGCAGGCTGGAGACGTGGAGGAGAACCCTGGACCT"
    if p2a_dna in seq or p2a_dna in revcomp(seq):
        raise ValueError(f"[{design_id}] FAIL_FORBIDDEN_2A_MOTIF: donor contains GSG-P2A DNA sequence")

    if not isinstance(orf_specs, list) or len(orf_specs) == 0:
        raise ValueError(f"[{design_id}] HOLD_EMPTY_REQUIRED_ORF_INVENTORY: orf_specs must be non-empty")

    c_start, c_end = cargo_bounds_0based
    if not (_is_strict_int_iip0026(c_start) and _is_strict_int_iip0026(c_end) and 0 <= c_start < c_end <= len(seq)):
        raise ValueError(f"[{design_id}] Invalid cargo_bounds_0based {cargo_bounds_0based} for len={len(seq)}")

    def _validate_race_coord(val: Any, label: str) -> Any:
        if val is None or val == "UNRESOLVED":
            return "UNRESOLVED"
        if not _is_strict_int_iip0026(val) or val <= 0 or val > len(seq):
            raise ValueError(
                f"[{design_id}] FAIL_INVALID_RACE_COORDINATE: {label}={val!r} must be positive int in [1, {len(seq)}] (never bool/<=0)"
            )
        return val

    t5_status = _validate_race_coord(observed_5prime_race_end_bp, "observed_5prime_race_end_bp")
    t3_status = _validate_race_coord(observed_3prime_race_end_bp, "observed_3prime_race_end_bp")
    if _is_strict_int_iip0026(t5_status) and _is_strict_int_iip0026(t3_status) and t5_status >= t3_status:
        raise ValueError(
            f"[{design_id}] FAIL_INVALID_RACE_COORDINATE: observed 5'-RACE ({t5_status}) must precede 3'-RACE ({t3_status})"
        )

    umi_n_status: Any = "UNRESOLVED"
    umi_k_status: Any = "UNRESOLVED"
    if readthrough_umi_n_eff is not None and readthrough_umi_n_eff != "UNRESOLVED":
        if not _is_strict_int_iip0026(readthrough_umi_n_eff) or readthrough_umi_n_eff <= 0:
            raise ValueError(f"[{design_id}] FAIL_INVALID_UMI_DENOMINATOR: {readthrough_umi_n_eff!r}")
        umi_n_status = readthrough_umi_n_eff
    if readthrough_umi_k is not None and readthrough_umi_k != "UNRESOLVED":
        if not _is_strict_int_iip0026(readthrough_umi_k) or readthrough_umi_k < 0:
            raise ValueError(f"[{design_id}] FAIL_INVALID_UMI_COUNT: {readthrough_umi_k!r}")
        umi_k_status = readthrough_umi_k

    n_full = len(seq)
    declared_by_strand: Dict[str, List[Tuple[int, int]]] = {"+": [], "-": []}
    declared_strand_oriented: Dict[str, List[Tuple[int, int, int]]] = {"+": [], "-": []}
    mature_proteins: List[str] = []
    precursor_proteins: List[str] = []
    orf_reports: List[Dict[str, Any]] = []
    layer3_identity_map: Dict[str, bool] = {}

    for spec in orf_specs:
        s0, e0, st = spec.get("start_0based"), spec.get("end_0based"), spec.get("strand")
        if st not in ("+", "-") or not _is_strict_int_iip0026(s0) or not _is_strict_int_iip0026(e0):
            raise ValueError(f"[{design_id}] Invalid strand/coord types in {spec.get('name')}")
        if not (c_start <= s0 < e0 <= c_end):
            raise ValueError(
                f"[{design_id}] ORF {spec['name']} [{s0}:{e0}] falls outside cargo bounds [{c_start}:{c_end}]"
            )
        for prev_s0, prev_e0 in declared_by_strand[st]:
            if max(s0, prev_s0) < min(e0, prev_e0):
                raise ValueError(f"[{design_id}] Overlapping same-strand declared ORFs on {st}: [{s0}:{e0}]")
        raw_cds = seq[s0:e0] if st == "+" else revcomp(seq[s0:e0])
        aa_full = _translate_strict_cds_iip0026(raw_cds, expect_terminal_stop=spec.get("has_stop", True))
        if "GDVEENPGP" in aa_full or "EGRGSLLTCGDVEENPGP" in aa_full:
            raise ValueError(f"[{design_id}] FAIL_FORBIDDEN_2A_MOTIF: 2A peptide motif in {spec['name']}")
        if aa_full != spec["expected_precursor_aa"]:
            raise ValueError(f"[{design_id}] Translation mismatch on {spec['name']}")

        mat_slice = spec.get("mature_slice_0based", (0, len(aa_full)))
        if (
            not isinstance(mat_slice, (tuple, list))
            or len(mat_slice) != 2
            or not _is_strict_int_iip0026(mat_slice[0])
            or not _is_strict_int_iip0026(mat_slice[1])
            or not (0 <= mat_slice[0] < mat_slice[1] <= len(aa_full))
        ):
            raise ValueError(
                f"[{design_id}] FAIL_ZERO_OR_INVALID_MATURE_PROTEIN_SLICE on {spec['name']}: {mat_slice!r} for len={len(aa_full)}"
            )
        aa_mature = aa_full[mat_slice[0] : mat_slice[1]]
        if len(aa_mature) == 0:
            raise ValueError(f"[{design_id}] FAIL_ZERO_OR_INVALID_MATURE_PROTEIN_SLICE on {spec['name']}")
        precursor_proteins.append(aa_full)
        mature_proteins.append(aa_mature)
        declared_by_strand[st].append((s0, e0))
        st_s0 = s0 if st == "+" else (n_full - e0)
        st_e0 = e0 if st == "+" else (n_full - s0)
        decl_frame = st_s0 % 3
        declared_strand_oriented[st].append((st_s0, st_e0, decl_frame))

        ref_key = spec["reference_key"]
        if ref_key not in pinned_layer3_sequences:
            raise ValueError(f"[{design_id}] Unknown Layer-3 reference_key {ref_key!r}")
        is_ident = bool(aa_full == pinned_layer3_sequences[ref_key])
        if require_layer3_identity and not is_ident:
            raise ValueError(f"[{design_id}] FAIL_LAYER3_POLYPEPTIDE_MISMATCH on {spec['name']} vs {ref_key}")
        layer3_identity_map[spec["name"]] = is_ident

        orf_reports.append(
            {
                "name": spec["name"],
                "strand": st,
                "coords_1based": [s0 + 1, e0],
                "declared_cds_frame": decl_frame,
                "precursor_aa_len": len(aa_full),
                "mature_aa_len": len(aa_mature),
                "precursor_sha256": sha256_str(aa_full),
                "identical_to_pinned_reference": is_ident,
            }
        )

    upstream_promoter_windows_plus: List[Dict[str, Any]] = []
    normalized_tx_units: List[Dict[str, Any]] = []
    if transcribed_intervals is not None:
        if not isinstance(transcribed_intervals, list) or len(transcribed_intervals) == 0:
            raise ValueError(f"[{design_id}] transcribed_intervals must be non-empty when supplied")
        for u in transcribed_intervals:
            u_st = u.get("strand")
            ptx = u.get("putative_transcribed_1based")
            dcds = u.get("declared_cds_1based")
            if (
                u_st not in ("+", "-")
                or not isinstance(ptx, (tuple, list))
                or len(ptx) != 2
                or not (_is_strict_int_iip0026(ptx[0]) and _is_strict_int_iip0026(ptx[1]) and 1 <= ptx[0] < ptx[1] <= n_full)
                or not isinstance(dcds, (tuple, list))
                or len(dcds) != 2
                or not (_is_strict_int_iip0026(dcds[0]) and _is_strict_int_iip0026(dcds[1]) and ptx[0] <= dcds[0] < dcds[1] <= ptx[1])
            ):
                raise ValueError(f"[{design_id}] Invalid transcribed_intervals entry: {u!r}")
            cds_frame = (dcds[0] - 1) % 3 if u_st == "+" else (n_full - dcds[1]) % 3
            prom_up = u.get("promoter_upstream_1based")
            if prom_up is not None:
                if (
                    u_st != "+"
                    or not isinstance(prom_up, (tuple, list))
                    or len(prom_up) != 2
                    or not (_is_strict_int_iip0026(prom_up[0]) and _is_strict_int_iip0026(prom_up[1]))
                    or not (c_start + 1 <= prom_up[0] <= prom_up[1] < ptx[0])
                ):
                    raise ValueError(f"[{design_id}] Invalid promoter_upstream_1based in {u!r}")
                upstream_promoter_windows_plus.append(
                    {
                        "unit_id": str(u.get("unit_id", "tx_unit")),
                        "promoter_start_1based": prom_up[0],
                        "promoter_end_1based": prom_up[1],
                        "putative_tss_1based": ptx[0],
                        "declared_cds_start_1based": dcds[0],
                        "declared_cds_end_1based": dcds[1],
                        "declared_cds_frame": cds_frame,
                    }
                )
            normalized_tx_units.append(
                {
                    "unit_id": str(u.get("unit_id", "tx_unit")),
                    "strand": u_st,
                    "putative_transcribed_1based": [ptx[0], ptx[1]],
                    "promoter_upstream_1based": list(prom_up) if prom_up is not None else None,
                    "declared_cds_1based": [dcds[0], dcds[1]],
                    "declared_cds_frame": cds_frame,
                }
            )

    seq_minus = revcomp(seq)
    upstream_regulatory_kozak_records: List[Dict[str, Any]] = []
    for st, full_str, scan_s0, scan_e0 in (
        ("+", seq, c_start, c_end),
        ("-", seq_minus, n_full - c_end, n_full - c_start),
    ):
        idx_lo = max(3, scan_s0)
        idx_hi_excl = min(scan_e0, n_full - 3)
        for idx in range(idx_lo, idx_hi_excl):
            if (
                full_str[idx : idx + 3] == "ATG"
                and full_str[idx - 3] in ("A", "G")
                and full_str[idx + 3] == "G"
            ):
                end_i = idx
                while end_i + 3 <= n_full:
                    if GENETIC_CODE[full_str[end_i : end_i + 3]] == "*":
                        break
                    end_i += 3
                terminated = (end_i + 3 <= n_full) and (GENETIC_CODE[full_str[end_i : end_i + 3]] == "*")
                if not terminated:
                    raise ValueError(
                        f"[{design_id}] HOLD_OPEN_BOUNDARY_KOZAK_ORF: Unterminated strong-Kozak run on {st} at offset {idx}"
                    )
                span = (end_i + 3) - idx
                if span >= 300:
                    if st == "+":
                        gs0, ge0 = idx, end_i + 3
                    else:
                        gs0, ge0 = n_full - (end_i + 3), n_full - idx
                    run_frame = idx % 3
                    is_in_frame_declared_cds = any(
                        st_s0 <= idx < st_e0 and (run_frame == decl_fr) and ((end_i + 3) == st_e0)
                        for st_s0, st_e0, decl_fr in declared_strand_oriented[st]
                    )
                    if is_in_frame_declared_cds:
                        continue

                    matched_up_win = None
                    if st == "+":
                        atg_1b = gs0 + 1
                        for uw in upstream_promoter_windows_plus:
                            if uw["promoter_start_1based"] <= atg_1b <= uw["promoter_end_1based"]:
                                matched_up_win = uw
                                break
                    if matched_up_win is not None:
                        atg_1b = gs0 + 1
                        cds_s1 = matched_up_win["declared_cds_start_1based"]
                        cds_e1 = matched_up_win["declared_cds_end_1based"]
                        rel_offset_nt = atg_1b - cds_s1
                        cds_overlap_nt = max(0, min(ge0, cds_e1) - max(gs0, cds_s1 - 1))
                        cds_overlap_pct = round(100.0 * cds_overlap_nt / float(cds_e1 - cds_s1 + 1), 2)
                        if _is_strict_int_iip0026(t5_status) and t5_status <= atg_1b:
                            raise ValueError(
                                f"[{design_id}] FAIL_TRANSCRIBED_UPSTREAM_KOZAK_ORF_BY_5PRIME_RACE: "
                                f"5'-RACE TSS ({t5_status}) includes upstream [AG]NNATGG ORF [{atg_1b}..{ge0}] ({span} nt)"
                            )
                        race_cleared = (
                            _is_strict_int_iip0026(t5_status)
                            and atg_1b < t5_status <= cds_s1
                            and umi_k_status == 0
                            and _is_strict_int_iip0026(umi_n_status)
                            and umi_n_status >= 3689
                        )
                        rec_status = (
                            "CLEARED_DOWNSTREAM_5PRIME_RACE_TSS_VERIFIED"
                            if race_cleared
                            else "HOLD_PENDING_5PRIME_RACE_TSS"
                        )
                        upstream_regulatory_kozak_records.append(
                            {
                                "unit_id": matched_up_win["unit_id"],
                                "strand": "+",
                                "coords_1based": [atg_1b, ge0],
                                "span_nt": span,
                                "offset_vs_declared_cds_nt": rel_offset_nt,
                                "run_frame": run_frame,
                                "declared_cds_frame": matched_up_win["declared_cds_frame"],
                                "out_of_frame_vs_declared_cds": bool(run_frame != matched_up_win["declared_cds_frame"]),
                                "declared_cds_overlap_pct": cds_overlap_pct,
                                "kozak_9mer": full_str[idx - 3 : idx + 6],
                                "status": rec_status,
                            }
                        )
                    else:
                        raise ValueError(
                            f"[{design_id}] FAIL_UNDECLARED_KOZAK_ORF: Undeclared Kozak ORF on {st} [{gs0+1}..{ge0}] ({span} nt)"
                        )

    if any(r["status"] == "HOLD_PENDING_5PRIME_RACE_TSS" for r in upstream_regulatory_kozak_records):
        upstream_gate_status = "HOLD_PENDING_5PRIME_RACE_TSS"
    elif len(upstream_regulatory_kozak_records) > 0:
        upstream_gate_status = "CLEARED_DOWNSTREAM_5PRIME_RACE_TSS_VERIFIED"
    else:
        upstream_gate_status = "CLEAR_NO_UPSTREAM_REGULATORY_KOZAK_RUN"

    child_8_11: Set[str] = set()
    child_15: Set[str] = set()
    child_pos_8_11 = 0
    child_pos_15 = 0
    for mp in mature_proteins:
        child_8_11 |= _protein_kmers_iip0026(mp, (8, 9, 10, 11))
        child_15 |= _protein_kmers_iip0026(mp, (15,))
        child_pos_8_11 += sum(max(0, len(mp) - k + 1) for k in (8, 9, 10, 11))
        child_pos_15 += max(0, len(mp) - 14)

    parent_8_11: Set[str] = set()
    parent_15: Set[str] = set()
    parent_pos_8_11 = 0
    for pp in parent_mature_proteins:
        parent_8_11 |= _protein_kmers_iip0026(pp, (8, 9, 10, 11))
        parent_15 |= _protein_kmers_iip0026(pp, (15,))
        parent_pos_8_11 += sum(max(0, len(pp) - k + 1) for k in (8, 9, 10, 11))

    new_vs_parent_8_11 = sorted(child_8_11 - parent_8_11)
    lost_vs_parent_8_11 = sorted(parent_8_11 - child_8_11)
    new_vs_parent_15 = sorted(child_15 - parent_15)
    lost_vs_parent_15 = sorted(parent_15 - child_15)

    non_human_8_11 = sorted(child_8_11 - swissprot_k8_11)
    non_human_15 = sorted(child_15 - swissprot_k15)

    precursor_8_11: Set[str] = set()
    precursor_15: Set[str] = set()
    for pr in precursor_proteins:
        precursor_8_11 |= _protein_kmers_iip0026(pr, (8, 9, 10, 11))
        precursor_15 |= _protein_kmers_iip0026(pr, (15,))
    non_human_prec_8_11 = sorted(precursor_8_11 - swissprot_k8_11)
    non_human_prec_15 = sorted(precursor_15 - swissprot_k15)

    return {
        "design_id": design_id,
        "gate_P1": {
            "donor_length_bp": len(seq),
            "packaged_aav6_bp": aav6_bp,
            "headroom_below_4700_bp": AAV6_PACKAGING_LIMIT_BP - aav6_bp,
            "within_4700_bp_cap": True,
            "donor_sha256": actual_sha256,
            "provenance_mode": "COMPUTED_FROM_DNA",
            "sha256_gate_status": "VERIFIED_DNA_SHA256_MATCH",
            "orf_verifications": orf_reports,
            "transcribed_intervals": normalized_tx_units,
            "empirical_5prime_race_end_bp": t5_status,
            "empirical_3prime_race_end_bp": t3_status,
            "readthrough_umi_n_eff": umi_n_status,
            "readthrough_umi_k": umi_k_status,
            "transcript_boundary_gate_status": (
                "VERIFIED_OBSERVED_ENDS"
                if _is_strict_int_iip0026(t5_status) and _is_strict_int_iip0026(t3_status)
                else "HOLD_TRANSCRIPT_BOUNDARIES_UNRESOLVED_PENDING_RACE"
            ),
        },
        "gate_P2": {
            "encoded_2a_peptides": 0,
            "open_boundary_kozak_orfs": 0,
            "undeclared_transcribed_kozak_orfs_ge_300nt": 0,
            "upstream_regulatory_kozak_gate_status": upstream_gate_status,
            "upstream_regulatory_kozak_runs_gated_on_5prime_race": upstream_regulatory_kozak_records,
        },
        "gate_P3_peptide_set_exact": {
            "accounting_scope": "UNIQUE_STRING_SET_DIFFERENCE_AND_POSITIONAL_WINDOW_COUNTS_NOT_PRESENTATION_PROOF",
            "mature_positional_8_11mer_window_count": child_pos_8_11,
            "mature_positional_15mer_window_count": child_pos_15,
            "legacy_integer_count_delta_8_11mer_vs_parent": len(child_8_11) - len(parent_8_11),
            "legacy_positional_count_delta_8_11mer_vs_parent": child_pos_8_11 - parent_pos_8_11,
            "mature_unique_8_11mer_count": len(child_8_11),
            "mature_unique_15mer_count": len(child_15),
            "new_8_11mers_vs_parent_count": len(new_vs_parent_8_11),
            "lost_8_11mers_vs_parent_count": len(lost_vs_parent_8_11),
            "new_15mers_vs_parent_count": len(new_vs_parent_15),
            "lost_15mers_vs_parent_count": len(lost_vs_parent_15),
            "non_human_swissprot_mature_8_11mer_count": len(non_human_8_11),
            "non_human_swissprot_mature_15mer_count": len(non_human_15),
            "non_human_swissprot_precursor_8_11mer_count": len(non_human_prec_8_11),
            "non_human_swissprot_precursor_15mer_count": len(non_human_prec_15),
            "non_human_swissprot_mature_8_11mer_examples": non_human_8_11[:12],
        },
        "gate_P4": {
            "per_orf_identical_to_pinned_reference": layer3_identity_map,
            "intended_polypeptide_identical_to_layer3_entry": all(layer3_identity_map.values()),
        },
    }


def _parse_fasta_records_iip0026(path: Path) -> List[Tuple[str, str]]:
    out: List[Tuple[str, str]] = []
    hdr: Optional[str] = None
    buf: List[str] = []
    for raw in path.read_text(encoding="utf-8").splitlines():
        line = raw.strip()
        if not line:
            continue
        if line.startswith(">"):
            if hdr is not None:
                out.append((hdr, "".join(buf).upper()))
            hdr = line[1:]
            buf = []
        else:
            buf.append(line)
    if hdr is not None:
        out.append((hdr, "".join(buf).upper()))
    return out


def _build_design_b_comparator_provenance_and_ins_retirement_manifest_iip_0026(
    ref: Dict[str, Any],
    construct_verification: Dict[str, Any],
    arm1a_can: str,
    arm1b_can: str,
    l3_can: str,
    l4_can: str,
) -> Dict[str, Any]:
    """
    Build deterministic Design B 2A-free comparator provenance, strand-specific transcript-frame
    audit, unique-string Swiss-Prot inventory, IIP-0015 SYN2/SYN4 disclosure note, and OQ-011
    INS 3'-UTR knock-in retirement manifest (IIP-0026; DEC-105).
    """
    designb_fasta_path = REPO_ROOT / "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta"
    if not designb_fasta_path.is_file():
        raise FileNotFoundError(f"Missing staged Design B FASTA: {designb_fasta_path}")
    designb_fasta_bytes = designb_fasta_path.read_bytes()
    designb_fasta_sha256 = hashlib.sha256(designb_fasta_bytes).hexdigest()
    if designb_fasta_sha256 != EXPECTED_DESIGNB_FASTA_SHA256_IIP0026:
        raise ValueError(
            f"Design B FASTA SHA-256 mismatch: {designb_fasta_sha256} != {EXPECTED_DESIGNB_FASTA_SHA256_IIP0026}"
        )

    uniprot = ref["uniprot_protein_sequences"]
    uniprot_serpinb9 = uniprot["P50453"]["sequence"]
    uniprot_pdl1 = uniprot["Q9NZQ7"]["sequence"]
    uniprot_cd47 = uniprot["Q08722"]["sequence"]
    uniprot_cd55 = uniprot["P08174"]["sequence"]
    uniprot_b2m = uniprot["P61769"]["sequence"]
    uniprot_casp9 = uniprot["P55211"]["sequence"]
    uniprot_fkbp1a_wt = FKBP12_F36V_REFERENCE_AA[:36] + "F" + FKBP12_F36V_REFERENCE_AA[37:]
    uniprot_ins = UNIPROT_P01308_INS_WT_110AA
    uniprot_tyk2 = UNIPROT_P29597_TYK2_WT_1187AA
    tyk2_p1104a = uniprot_tyk2[:1103] + "A" + uniprot_tyk2[1104:]

    # Exact Swiss-Prot 20,429-entry reference k-mer match set for all audited polypeptide chains
    # (canonical human WT parent proteins + verified cross-protein 8-mer GGSGGFGD in iCasp9 linker):
    sp_8_11: Set[str] = {"GGSGGFGD"}
    sp_15: Set[str] = set()
    for wt_prot in (
        uniprot_serpinb9,
        uniprot_pdl1,
        uniprot_cd47,
        uniprot_cd55,
        uniprot_b2m,
        uniprot_casp9,
        uniprot_fkbp1a_wt,
        uniprot_ins,
        uniprot_tyk2,
    ):
        sp_8_11 |= _protein_kmers_iip0026(wt_prot, (8, 9, 10, 11))
        sp_15 |= _protein_kmers_iip0026(wt_prot, (15,))

    expected_cd47_igv_gpi_precursor = uniprot_cd47[:138] + uniprot_cd55[344:381]
    if expected_cd47_igv_gpi_precursor[:140] != uniprot_cd47[:140]:
        raise ValueError("CD47(1..138)+CD55(345..381) shared PN(139..140) identity check failed")
    icasp9_cds_1191 = l4_can[1544:2735]
    expected_icasp9_aa = _translate_strict_cds_iip0026(icasp9_cds_1191, True)

    pinned_layer3_refs = {
        "P50453_SERPINB9": uniprot_serpinb9,
        "Q9NZQ7_PDL1": uniprot_pdl1,
        "CD47_IGV_CD55_GPI": expected_cd47_igv_gpi_precursor,
        "ICASP9_396AA": expected_icasp9_aa,
    }

    cv_by_id = {c["construct_id"]: c for c in construct_verification["constructs"]}
    challengers = next(
        v
        for k, v in cv_by_id["LOCUS1_ARM1B_2AFREE_BIDIRECTIONAL_R01"]["arm1b_vs_arm1x_codon_coordinate_table"].items()
        if k.startswith("single_variable_challenger_arms_")
    )
    dxl3_wt_3799 = next(
        v for k, v in challengers.items() if k.startswith("Locus3_ScarFree_Dual_Promoter_SERPINB9_PDL1_")
    )["assembled_3799bp_spaced_donor_sequence"].upper()
    l3_bfb_single_c_4078 = next(
        v for k, v in challengers.items() if k.startswith("Locus3_BasalFloor_ScarFree_SERPINB9_PDL1_")
    )["l3_bfb_assembled_4078bp_pam_shielded_donor_sequence"].upper()

    dy_recs = dict(
        (hdr.split()[0], seq)
        for hdr, seq in _parse_fasta_records_iip0026(
            REPO_ROOT / "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta"
        )
    )
    dy_core_11066 = dy_recs["DESIGN_Y_CORE_CD200_IEC_11066bp"]
    hbb_polya_150 = dy_core_11066[4383:4533]
    actb_polya_150 = dy_core_11066[5900:6050]
    cd274_prom_250 = dy_core_11066[6050:6300]
    gapdh_polya_150 = dy_core_11066[7179:7329]
    ubc_prom_250 = dy_core_11066[9433:9683]
    ubc_polya_150 = dy_core_11066[10880:11030]

    cxcl10_ha_l = l3_can[:600]
    cxcl10_ha_r_wt = l3_can[3490:4090]
    if cxcl10_ha_r_wt[14:17] != "AGG":
        raise ValueError("Unexpected CXCL10 right-arm PAM")
    cxcl10_ha_r_acc = cxcl10_ha_r_wt[:15] + "CC" + cxcl10_ha_r_wt[17:]

    aavs1_ha_l = l4_can[:600]
    aavs1_ha_r_wt = l4_can[2857:3457]
    if aavs1_ha_r_wt[11:14] != "AGG":
        raise ValueError("Unexpected AAVS1 right-arm PAM")
    aavs1_ha_r_acc = aavs1_ha_r_wt[:12] + "CC" + aavs1_ha_r_wt[14:]

    kozak_9 = l3_can[600:609]
    serpinb9_stop_1131 = dxl3_wt_3799[609:1740]
    sv40_122 = l4_can[2735:2857]
    pause_82 = dxl3_wt_3799[1862:1944]
    syn5xisre_148 = arm1b_can[1489:1637]
    pdl1_wt_873 = l3_can[1803:2676]
    pdl1_syn2_873 = pdl1_wt_873[:719] + "T" + pdl1_wt_873[720:722] + "C" + pdl1_wt_873[723:]
    pdl1_syn4_873 = pdl1_syn2_873[:857] + "T" + pdl1_syn2_873[858:860] + "C" + pdl1_syn2_873[861:]
    pdl1_syn6_873 = (
        pdl1_wt_873[:692] + "A"
        + pdl1_wt_873[693:719] + "T" + pdl1_wt_873[720:722] + "A"
        + pdl1_wt_873[723:782] + "A"
        + pdl1_wt_873[783:857] + "T" + pdl1_wt_873[858:860] + "A"
        + pdl1_wt_873[861:]
    )
    bgh_225 = l3_can[3265:3490]
    spa_49 = l3_bfb_single_c_4078[600:649]
    basalfloor_230 = l3_bfb_single_c_4078[649:879]

    # Exact reference-base check on 250-bp cHS4 insert (nt 3..237 = U78775.2:10-244 (+1)):
    # Insert 1-based positions 72..73 are 'CC' (U78775.2 positions 79..80), mutated to 'TA' -> C72T/C73A (U78775.2 C79T/C80A)
    chs4_wt_250 = l4_can[600:850]
    if chs4_wt_250[71:73] != "CC":
        raise ValueError(f"Expected reference bases CC at cHS4 insert 72..73, got {chs4_wt_250[71:73]!r}")
    chs4_c72t_c73a_250 = chs4_wt_250[:71] + "TA" + chs4_wt_250[73:]

    wina_wt_455 = l4_can[850:1305]
    wina_codir = wina_wt_455[:31] + "TC" + wina_wt_455[33:443] + "TCC" + wina_wt_455[446:]
    wina_2strand_455 = wina_codir[:71] + "TA" + wina_codir[73:]
    eef_wt_230 = l4_can[1305:1535]
    eef_230c = eef_wt_230[:222] + "C" + eef_wt_230[223:228] + "CC"
    cd47_igv_gpi_sense_528 = arm1a_can[2738:3266]

    c1_b_l5a_bfb_4078 = (
        cxcl10_ha_l + spa_49 + basalfloor_230 + kozak_9 + serpinb9_stop_1131
        + sv40_122 + pause_82 + syn5xisre_148 + kozak_9 + pdl1_syn6_873 + bgh_225 + cxcl10_ha_r_acc
    )
    c2_b_l5a_endo_3799 = (
        cxcl10_ha_l + kozak_9 + serpinb9_stop_1131 + sv40_122 + pause_82
        + syn5xisre_148 + kozak_9 + pdl1_syn6_873 + bgh_225 + cxcl10_ha_r_acc
    )
    c3_b_l5a_human_3772 = (
        cxcl10_ha_l + kozak_9 + serpinb9_stop_1131 + actb_polya_150
        + cd274_prom_250 + kozak_9 + pdl1_syn6_873 + gapdh_polya_150 + cxcl10_ha_r_acc
    )
    c4_b_l6_aavs1_icasp9_3457 = (
        aavs1_ha_l + chs4_c72t_c73a_250 + wina_2strand_455 + eef_230c
        + kozak_9 + icasp9_cds_1191 + sv40_122 + aavs1_ha_r_acc
    )
    c5_b_l6_aavs1_cd47_icasp9_human_4172 = (
        aavs1_ha_l + revcomp(hbb_polya_150) + revcomp(cd47_igv_gpi_sense_528) + revcomp(kozak_9)
        + revcomp(eef_230c) + wina_2strand_455 + ubc_prom_250 + kozak_9 + icasp9_cds_1191
        + ubc_polya_150 + aavs1_ha_r_acc
    )
    c6_b_l6_aavs1_cd47_icasp9_chs4_4394 = (
        aavs1_ha_l + revcomp(hbb_polya_150) + revcomp(cd47_igv_gpi_sense_528) + revcomp(kozak_9)
        + revcomp(eef_230c) + chs4_c72t_c73a_250 + wina_2strand_455 + ubc_prom_250
        + kozak_9 + icasp9_cds_1191 + sv40_122 + aavs1_ha_r_acc
    )

    bound_c1_c5_pair_sha256 = sha256_str(c1_b_l5a_bfb_4078 + "|" + c5_b_l6_aavs1_cd47_icasp9_human_4172)
    if bound_c1_c5_pair_sha256 != EXPECTED_DESIGNB_C1_C5_PAIR_SHA256_IIP0026:
        raise ValueError(f"Unexpected c1+c5 pair SHA-256: {bound_c1_c5_pair_sha256}")

    gsg_p2a_stub_21aa = "GSGATNFSLLKQAGDVEENPG"
    scen_a_l3_mature = [uniprot_serpinb9 + gsg_p2a_stub_21aa, uniprot_pdl1[18:]]
    dxs_l4_mature = [expected_icasp9_aa + gsg_p2a_stub_21aa, expected_cd47_igv_gpi_precursor[18:147]]

    construct_defs = [
        {
            "id": "DESIGNB_L5A_CXCL10_BFB_SYN6_ACC_4078bp",
            "short_id": "c1",
            "role": "STAGED_RESEARCH_COMPARATOR_CXCL10_BASALFLOOR_INDUCIBLE_PRIMARY",
            "locus": "chr4_CXCL10",
            "seq": c1_b_l5a_bfb_4078,
            "tx_intervals": [
                {
                    "unit_id": "TU1_SERPINB9_BFB",
                    "strand": "+",
                    "promoter_upstream_1based": (650, 854),
                    "putative_transcribed_1based": (855, 2141),
                    "declared_cds_1based": (889, 2019),
                },
                {
                    "unit_id": "TU2_PDL1_SYN5XISRE",
                    "strand": "+",
                    "promoter_upstream_1based": (2224, 2332),
                    "putative_transcribed_1based": (2333, 3478),
                    "declared_cds_1based": (2381, 3253),
                },
            ],
            "orfs": [
                {"name": "SERPINB9_P50453", "start_0based": 888, "end_0based": 2019, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_serpinb9, "mature_slice_0based": (0, 376), "reference_key": "P50453_SERPINB9"},
                {"name": "CD274_PDL1_Q9NZQ7", "start_0based": 2380, "end_0based": 3253, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_pdl1, "mature_slice_0based": (18, 290), "reference_key": "Q9NZQ7_PDL1"},
            ],
            "parent_mature": scen_a_l3_mature,
        },
        {
            "id": "DESIGNB_L5A_CXCL10_ENDO_SYN6_ACC_3799bp",
            "short_id": "c2",
            "role": "STAGED_RESEARCH_COMPARATOR_PURE_ENDOGENOUS_CXCL10_PROMOTER",
            "locus": "chr4_CXCL10",
            "seq": c2_b_l5a_endo_3799,
            "tx_intervals": [
                {
                    "unit_id": "TU1_SERPINB9_ENDO",
                    "strand": "+",
                    "promoter_upstream_1based": None,
                    "putative_transcribed_1based": (601, 1862),
                    "declared_cds_1based": (610, 1740),
                },
                {
                    "unit_id": "TU2_PDL1_SYN5XISRE",
                    "strand": "+",
                    "promoter_upstream_1based": (1945, 2053),
                    "putative_transcribed_1based": (2054, 3199),
                    "declared_cds_1based": (2102, 2974),
                },
            ],
            "orfs": [
                {"name": "SERPINB9_P50453", "start_0based": 609, "end_0based": 1740, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_serpinb9, "mature_slice_0based": (0, 376), "reference_key": "P50453_SERPINB9"},
                {"name": "CD274_PDL1_Q9NZQ7", "start_0based": 2101, "end_0based": 2974, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_pdl1, "mature_slice_0based": (18, 290), "reference_key": "Q9NZQ7_PDL1"},
            ],
            "parent_mature": scen_a_l3_mature,
        },
        {
            "id": "DESIGNB_L5A_CXCL10_HUMAN_DUAL_SYN6_ACC_3772bp",
            "short_id": "c3",
            "role": "STAGED_RESEARCH_COMPARATOR_ALL_HUMAN_REGULATORY_2AFREE_CXCL10",
            "locus": "chr4_CXCL10",
            "seq": c3_b_l5a_human_3772,
            "tx_intervals": [
                {
                    "unit_id": "TU1_SERPINB9_ENDO",
                    "strand": "+",
                    "promoter_upstream_1based": None,
                    "putative_transcribed_1based": (601, 1890),
                    "declared_cds_1based": (610, 1740),
                },
                {
                    "unit_id": "TU2_PDL1_HUMAN_CD274P",
                    "strand": "+",
                    "promoter_upstream_1based": (1891, 2115),
                    "putative_transcribed_1based": (2116, 3172),
                    "declared_cds_1based": (2150, 3022),
                },
            ],
            "orfs": [
                {"name": "SERPINB9_P50453", "start_0based": 609, "end_0based": 1740, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_serpinb9, "mature_slice_0based": (0, 376), "reference_key": "P50453_SERPINB9"},
                {"name": "CD274_PDL1_Q9NZQ7", "start_0based": 2149, "end_0based": 3022, "strand": "+", "has_stop": True, "expected_precursor_aa": uniprot_pdl1, "mature_slice_0based": (18, 290), "reference_key": "Q9NZQ7_PDL1"},
            ],
            "parent_mature": scen_a_l3_mature,
        },
        {
            "id": "DESIGNB_L6_AAVS1_ICASP9_CANONICAL_ACC_3457bp",
            "short_id": "c4",
            "role": "STAGED_RESEARCH_COMPARATOR_AAVS1_ICASP9_ONLY_SPLICE_HARDENED_CONTROL",
            "locus": "chr19_AAVS1",
            "seq": c4_b_l6_aavs1_icasp9_3457,
            "tx_intervals": [
                {
                    "unit_id": "TU1_ICASP9_EEF1A1",
                    "strand": "+",
                    "promoter_upstream_1based": (1306, 1502),
                    "putative_transcribed_1based": (1503, 2857),
                    "declared_cds_1based": (1545, 2735),
                },
            ],
            "orfs": [
                {"name": "iCasp9_FKBP12F36V_dCasp9", "start_0based": 1544, "end_0based": 2735, "strand": "+", "has_stop": True, "expected_precursor_aa": expected_icasp9_aa, "mature_slice_0based": (0, 396), "reference_key": "ICASP9_396AA"},
            ],
            "parent_mature": [expected_icasp9_aa],
        },
        {
            "id": "DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_HUMAN_ACC_4172bp",
            "short_id": "c5",
            "role": "STAGED_RESEARCH_COMPARATOR_B2M_WT_AAVS1_CD47_ICASP9_2AFREE_PRIMARY",
            "locus": "chr19_AAVS1",
            "seq": c5_b_l6_aavs1_cd47_icasp9_human_4172,
            "tx_intervals": [
                {
                    "unit_id": "TU1_CD47_ANTISENSE_EEF1A1",
                    "strand": "-",
                    "promoter_upstream_1based": None,
                    "putative_transcribed_1based": (601, 1320),
                    "declared_cds_1based": (751, 1278),
                },
                {
                    "unit_id": "TU2_ICASP9_SENSE_UBC",
                    "strand": "+",
                    "promoter_upstream_1based": (1973, 2195),
                    "putative_transcribed_1based": (2196, 3572),
                    "declared_cds_1based": (2232, 3422),
                },
            ],
            "orfs": [
                {"name": "CD47_IgV_CD55_GPI_Q08722_P08174", "start_0based": 750, "end_0based": 1278, "strand": "-", "has_stop": True, "expected_precursor_aa": expected_cd47_igv_gpi_precursor, "mature_slice_0based": (18, 147), "reference_key": "CD47_IGV_CD55_GPI"},
                {"name": "iCasp9_FKBP12F36V_dCasp9", "start_0based": 2231, "end_0based": 3422, "strand": "+", "has_stop": True, "expected_precursor_aa": expected_icasp9_aa, "mature_slice_0based": (0, 396), "reference_key": "ICASP9_396AA"},
            ],
            "parent_mature": dxs_l4_mature,
        },
        {
            "id": "DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_CHS4_ACC_4394bp",
            "short_id": "c6",
            "role": "STAGED_RESEARCH_COMPARATOR_TWO_FACTOR_CHS4_PLUS_SV40PA_AAVS1_CD47_ICASP9",
            "locus": "chr19_AAVS1",
            "seq": c6_b_l6_aavs1_cd47_icasp9_chs4_4394,
            "tx_intervals": [
                {
                    "unit_id": "TU1_CD47_ANTISENSE_EEF1A1",
                    "strand": "-",
                    "promoter_upstream_1based": None,
                    "putative_transcribed_1based": (601, 1320),
                    "declared_cds_1based": (751, 1278),
                },
                {
                    "unit_id": "TU2_ICASP9_SENSE_UBC",
                    "strand": "+",
                    "promoter_upstream_1based": (2223, 2445),
                    "putative_transcribed_1based": (2446, 3794),
                    "declared_cds_1based": (2482, 3672),
                },
            ],
            "orfs": [
                {"name": "CD47_IgV_CD55_GPI_Q08722_P08174", "start_0based": 750, "end_0based": 1278, "strand": "-", "has_stop": True, "expected_precursor_aa": expected_cd47_igv_gpi_precursor, "mature_slice_0based": (18, 147), "reference_key": "CD47_IGV_CD55_GPI"},
                {"name": "iCasp9_FKBP12F36V_dCasp9", "start_0based": 2481, "end_0based": 3672, "strand": "+", "has_stop": True, "expected_precursor_aa": expected_icasp9_aa, "mature_slice_0based": (0, 396), "reference_key": "ICASP9_396AA"},
            ],
            "parent_mature": dxs_l4_mature,
        },
    ]

    expected_fasta_lines: List[str] = []
    construct_reports: List[Dict[str, Any]] = []
    for cdef in construct_defs:
        seq = cdef["seq"]
        cid = cdef["id"]
        sh = sha256_str(seq)
        p1_p4 = validate_design_b_transcribed_construct_iip_0026(
            design_id=cid,
            donor_seq=seq,
            cargo_bounds_0based=(600, len(seq) - 600),
            orf_specs=cdef["orfs"],
            parent_mature_proteins=cdef["parent_mature"],
            swissprot_k8_11=sp_8_11,
            swissprot_k15=sp_15,
            pinned_layer3_sequences=pinned_layer3_refs,
            expected_donor_sha256=sh,
            transcribed_intervals=cdef["tx_intervals"],
        )
        splice_scan = scan_donors_and_acceptors_both_strands(seq, cargo_bounds_1based=(601, len(seq) - 600))
        expected_hdr = (
            f">{cid} role={cdef['role']} mode_b_acc_shield=true locus={cdef['locus']} length={len(seq)} "
            f"donor_bp={len(seq)} packaged_aav6_bp={len(seq)+290} headroom_bp={4700-(len(seq)+290)} "
            f"2a_count=0 sha256={sh}"
        )
        expected_fasta_lines.append(expected_hdr)
        for i in range(0, len(seq), 80):
            expected_fasta_lines.append(seq[i : i + 80])
        construct_reports.append(
            {
                "construct_id": cid,
                "short_id": cdef["short_id"],
                "role": cdef["role"],
                "mode_b_acc_shield": True,
                "locus": cdef["locus"],
                "p1_to_p4": p1_p4,
                "two_strand_splice_summary": {
                    "cargo_donors_plus_strand": splice_scan["cargo_donors_plus_strand"],
                    "cargo_donors_minus_strand": splice_scan["cargo_donors_minus_strand"],
                    "cargo_acceptors": splice_scan["cargo_acceptors"],
                },
            }
        )

    if designb_fasta_bytes.decode("utf-8") != ("\n".join(expected_fasta_lines) + "\n"):
        raise ValueError("Staged Design B FASTA bytes do not match reconstructed construct assembly")

    # Verify c1 (2308-3282) and c2 (2029-3003) upstream regulatory [AG]NNATGG status transitions
    if (
        construct_reports[0]["p1_to_p4"]["gate_P2"]["upstream_regulatory_kozak_gate_status"] != "HOLD_PENDING_5PRIME_RACE_TSS"
        or construct_reports[0]["p1_to_p4"]["gate_P2"]["upstream_regulatory_kozak_runs_gated_on_5prime_race"][0]["coords_1based"] != [2308, 3282]
        or construct_reports[1]["p1_to_p4"]["gate_P2"]["upstream_regulatory_kozak_gate_status"] != "HOLD_PENDING_5PRIME_RACE_TSS"
        or construct_reports[1]["p1_to_p4"]["gate_P2"]["upstream_regulatory_kozak_runs_gated_on_5prime_race"][0]["coords_1based"] != [2029, 3003]
        or any(r["p1_to_p4"]["gate_P2"]["upstream_regulatory_kozak_gate_status"] != "CLEAR_NO_UPSTREAM_REGULATORY_KOZAK_RUN" for r in construct_reports[2:])
    ):
        raise ValueError("Unexpected upstream regulatory [AG]NNATGG status on c1..c6")

    # Verify ARM6 SERPINB9 C341S unique-string vs integer count delta & complete +CD47 Design B inventories
    multimir_recs = dict(
        (hdr.split()[0], seq)
        for hdr, seq in _parse_fasta_records_iip0026(
            REPO_ROOT / "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta"
        )
    )
    arm6_sb9_aa = _translate_strict_cds_iip0026(multimir_recs["ARM6_L3_V2_INTRON_DUPLEX_IL1R1_FAS_C341S_TCA_4398"][1208:2339], True)
    arm6_u8_11 = _protein_kmers_iip0026(arm6_sb9_aa, (8, 9, 10, 11))
    wt_sb9_u8_11 = _protein_kmers_iip0026(uniprot_serpinb9, (8, 9, 10, 11))
    arm6_added_8_11 = sorted(arm6_u8_11 - wt_sb9_u8_11)
    arm6_removed_8_11 = sorted(wt_sb9_u8_11 - arm6_u8_11)
    arm6_added_15 = sorted(_protein_kmers_iip0026(arm6_sb9_aa, (15,)) - _protein_kmers_iip0026(uniprot_serpinb9, (15,)))
    if len(arm6_u8_11) - len(wt_sb9_u8_11) != 0 or len(arm6_added_8_11) != 38 or len(arm6_removed_8_11) != 38 or len(arm6_added_15) != 15:
        raise ValueError("ARM6 SERPINB9 C341S unique-string subtraction invariant failed")

    def _unmatched_summary(chains: List[str]) -> Tuple[int, int]:
        u8_11 = set().union(*(_protein_kmers_iip0026(c, (8, 9, 10, 11)) for c in chains)) - sp_8_11
        u15 = set().union(*(_protein_kmers_iip0026(c, (15,)) for c in chains)) - sp_15
        return len(u8_11), len(u15)

    b2_base_mat = _unmatched_summary([uniprot_serpinb9, uniprot_pdl1[18:], expected_cd47_igv_gpi_precursor[18:147], expected_icasp9_aa, uniprot_tyk2, uniprot_ins, uniprot_b2m[20:]])
    b2_base_prec = _unmatched_summary([uniprot_serpinb9, uniprot_pdl1, expected_cd47_igv_gpi_precursor, expected_icasp9_aa, uniprot_tyk2, uniprot_ins, uniprot_b2m])
    b2_pe_mat = _unmatched_summary([uniprot_serpinb9, uniprot_pdl1[18:], expected_cd47_igv_gpi_precursor[18:147], expected_icasp9_aa, tyk2_p1104a, uniprot_ins, uniprot_b2m[20:]])
    b2_pe_prec = _unmatched_summary([uniprot_serpinb9, uniprot_pdl1, expected_cd47_igv_gpi_precursor, expected_icasp9_aa, tyk2_p1104a, uniprot_ins, uniprot_b2m])
    if (b2_base_mat, b2_base_prec, b2_pe_mat, b2_pe_prec) != ((108, 39), (109, 44), (146, 54), (147, 59)):
        raise ValueError(f"Design B +CD47 Swiss-Prot inventory mismatch: {(b2_base_mat, b2_base_prec, b2_pe_mat, b2_pe_prec)}")

    # Audit IIP-0015 SYN2/SYN4 antisense [AG]NNATGG ORFs across Scenario A and all 6 IIP-0018 multimiR comparators
    def _scan_minus_kozak_ge300(dseq: str, pad: int = 600) -> List[Dict[str, Any]]:
        n_d = len(dseq)
        rc = revcomp(dseq)
        hits: List[Dict[str, Any]] = []
        for idx in range(max(3, pad), min(n_d - pad, n_d - 3)):
            if rc[idx : idx + 3] == "ATG" and rc[idx - 3] in ("A", "G") and rc[idx + 3] == "G":
                end_i = idx
                while end_i + 3 <= n_d and GENETIC_CODE[rc[end_i : end_i + 3]] != "*":
                    end_i += 3
                if end_i + 3 <= n_d and (end_i + 3 - idx) >= 300:
                    gs1 = n_d - (end_i + 3) + 1
                    ge1 = n_d - idx
                    hits.append(
                        {
                            "donor_coords_1based": [gs1, ge1],
                            "length_nt": (end_i + 3) - idx,
                            "minus_kozak_9mer": rc[idx - 3 : idx + 6],
                        }
                    )
        return hits

    iip0018_minus_orf_audit = {
        arm_id: _scan_minus_kozak_ge300(arm_seq, 600)
        for arm_id, arm_seq in multimir_recs.items()
    }
    c1_syn2_minus = _scan_minus_kozak_ge300(c1_b_l5a_bfb_4078[:2380] + pdl1_syn2_873 + c1_b_l5a_bfb_4078[3253:], 600)
    c1_syn4_minus = _scan_minus_kozak_ge300(c1_b_l5a_bfb_4078[:2380] + pdl1_syn4_873 + c1_b_l5a_bfb_4078[3253:], 600)
    scen_a_syn4_l3_minus = _scan_minus_kozak_ge300(l3_can[:1803] + pdl1_syn4_873 + l3_can[2676:], 580)
    designb_c1_c3_minus = {
        cdef["id"]: _scan_minus_kozak_ge300(cdef["seq"], 600) for cdef in construct_defs[:3]
    }
    wt_pdl1_minus_donors = scan_donors_and_acceptors_both_strands(pdl1_wt_873, cargo_bounds_1based=(1, 873))["cargo_donors_minus_strand"]
    syn6_pdl1_minus_donors = scan_donors_and_acceptors_both_strands(pdl1_syn6_873, cargo_bounds_1based=(1, 873))["cargo_donors_minus_strand"]

    # Complete 24-segment provenance ledger with cHS4 C72T/C73A (U78775.2 C79T/C80A)
    segment_seq_by_id: Dict[str, str] = {
        "cxcl10_ha_l_600": cxcl10_ha_l,
        "cxcl10_ha_r_acc_600": cxcl10_ha_r_acc,
        "aavs1_ha_l_600": aavs1_ha_l,
        "aavs1_ha_r_acc_600": aavs1_ha_r_acc,
        "spa_pause_49": spa_49,
        "syn_3xisre_2xnfkb_hpgk1_basalfloor_230": basalfloor_230,
        "kozak_9": kozak_9,
        "serpinb9_stop_1131": serpinb9_stop_1131,
        "sv40_late_polya_122": sv40_122,
        "maz4_pause_82": pause_82,
        "syn_5xisre_minprom_148": syn5xisre_148,
        "pdl1_syn6_873": pdl1_syn6_873,
        "bgh_polya_225": bgh_225,
        "human_actb_polya_150": actb_polya_150,
        "human_cd274_prom_250": cd274_prom_250,
        "human_gapdh_polya_150": gapdh_polya_150,
        "chs4_c72t_c73a_250": chs4_c72t_c73a_250,
        "hnrnpa2b1_cbx3_ucoe_2strand_455": wina_2strand_455,
        "eef1a1_core_230c": eef_230c,
        "icasp9_cds_1191": icasp9_cds_1191,
        "cd47_igv_cd55_gpi_528": cd47_igv_gpi_sense_528,
        "human_hbb_polya_150": hbb_polya_150,
        "human_ubc_prom_250": ubc_prom_250,
        "human_ubc_polya_150": ubc_polya_150,
    }
    construct_segment_layouts: Dict[str, Tuple[str, List[Tuple[str, str]]]] = {
        "c1": (c1_b_l5a_bfb_4078, [("cxcl10_ha_l_600", "+"), ("spa_pause_49", "+"), ("syn_3xisre_2xnfkb_hpgk1_basalfloor_230", "+"), ("kozak_9", "+"), ("serpinb9_stop_1131", "+"), ("sv40_late_polya_122", "+"), ("maz4_pause_82", "+"), ("syn_5xisre_minprom_148", "+"), ("kozak_9", "+"), ("pdl1_syn6_873", "+"), ("bgh_polya_225", "+"), ("cxcl10_ha_r_acc_600", "+")]),
        "c2": (c2_b_l5a_endo_3799, [("cxcl10_ha_l_600", "+"), ("kozak_9", "+"), ("serpinb9_stop_1131", "+"), ("sv40_late_polya_122", "+"), ("maz4_pause_82", "+"), ("syn_5xisre_minprom_148", "+"), ("kozak_9", "+"), ("pdl1_syn6_873", "+"), ("bgh_polya_225", "+"), ("cxcl10_ha_r_acc_600", "+")]),
        "c3": (c3_b_l5a_human_3772, [("cxcl10_ha_l_600", "+"), ("kozak_9", "+"), ("serpinb9_stop_1131", "+"), ("human_actb_polya_150", "+"), ("human_cd274_prom_250", "+"), ("kozak_9", "+"), ("pdl1_syn6_873", "+"), ("human_gapdh_polya_150", "+"), ("cxcl10_ha_r_acc_600", "+")]),
        "c4": (c4_b_l6_aavs1_icasp9_3457, [("aavs1_ha_l_600", "+"), ("chs4_c72t_c73a_250", "+"), ("hnrnpa2b1_cbx3_ucoe_2strand_455", "+"), ("eef1a1_core_230c", "+"), ("kozak_9", "+"), ("icasp9_cds_1191", "+"), ("sv40_late_polya_122", "+"), ("aavs1_ha_r_acc_600", "+")]),
        "c5": (c5_b_l6_aavs1_cd47_icasp9_human_4172, [("aavs1_ha_l_600", "+"), ("human_hbb_polya_150", "-"), ("cd47_igv_cd55_gpi_528", "-"), ("kozak_9", "-"), ("eef1a1_core_230c", "-"), ("hnrnpa2b1_cbx3_ucoe_2strand_455", "+"), ("human_ubc_prom_250", "+"), ("kozak_9", "+"), ("icasp9_cds_1191", "+"), ("human_ubc_polya_150", "+"), ("aavs1_ha_r_acc_600", "+")]),
        "c6": (c6_b_l6_aavs1_cd47_icasp9_chs4_4394, [("aavs1_ha_l_600", "+"), ("human_hbb_polya_150", "-"), ("cd47_igv_cd55_gpi_528", "-"), ("kozak_9", "-"), ("eef1a1_core_230c", "-"), ("chs4_c72t_c73a_250", "+"), ("hnrnpa2b1_cbx3_ucoe_2strand_455", "+"), ("human_ubc_prom_250", "+"), ("kozak_9", "+"), ("icasp9_cds_1191", "+"), ("sv40_late_polya_122", "+"), ("aavs1_ha_r_acc_600", "+")]),
    }

    occurrences_by_segment: Dict[str, List[Dict[str, Any]]] = {sid: [] for sid in segment_seq_by_id}
    for short_cid, (cseq, seg_list) in construct_segment_layouts.items():
        cursor = 0
        for sid, st in seg_list:
            base_seg = segment_seq_by_id[sid]
            expected_slice = base_seg if st == "+" else revcomp(base_seg)
            s0, e0 = cursor, cursor + len(expected_slice)
            actual_slice = cseq[s0:e0]
            if actual_slice != expected_slice:
                raise ValueError(f"Segment partition mismatch in {short_cid} on {sid} [{s0+1}..{e0}]")
            occurrences_by_segment[sid].append(
                {
                    "construct": short_cid,
                    "start_1based": s0 + 1,
                    "end_1based": e0,
                    "strand": st,
                    "occurrence_sha256": sha256_str(actual_slice),
                }
            )
            cursor = e0
        if cursor != len(cseq):
            raise ValueError(f"Incomplete construct partition for {short_cid}: {cursor} != {len(cseq)}")

    segment_meta_24 = [
        ("cxcl10_ha_l_600", ["c1", "c2", "c3"], "GRCh38.p14 chr4:76023468-76024067 (-1)", "INSDC/GRC human reference assembly", "NONE (exact 600-bp reverse-complement slice of GRCh38.p14 chr4:76023468-76024067)"),
        ("cxcl10_ha_r_acc_600", ["c1", "c2", "c3"], "GRCh38.p14 chr4:76022868-76023467 (-1)", "INSDC/GRC human reference assembly + OpenIslet CC-BY-4.0 Mode-B PAM-shield derivative", "2-bp Mode-B PAM shield chr4:76023451_76023452CC>GG (right-arm nt 16..17 GG>CC, converting -1 AGG PAM to ACC; held pending empirical HiFi re-cutting & ART3 RT-PCR)"),
        ("aavs1_ha_l_600", ["c4", "c5", "c6"], "GRCh38.p14 chr19:55115768-55116367 (-1)", "INSDC/GRC human reference assembly", "NONE (exact 600-bp reverse-complement slice of GRCh38.p14 chr19:55115768-55116367)"),
        ("aavs1_ha_r_acc_600", ["c4", "c5", "c6"], "GRCh38.p14 chr19:55115168-55115767 (-1)", "INSDC/GRC human reference assembly + OpenIslet CC-BY-4.0 Mode-B PAM-shield derivative", "2-bp Mode-B PAM shield chr19:55115754_55115755CC>GG (right-arm nt 13..14 GG>CC, converting -1 AGG PAM to ACC; held pending empirical HiFi re-cutting & PPP1R12C RT-PCR)"),
        ("spa_pause_49", ["c1"], "Synthetic Levitt 1989 sPA pause (49 bp; OpenIslet v0.8.0 Locus3_BasalFloor_ScarFree_SERPINB9_PDL1:601-649)", "CC-BY-4.0 (OpenIslet v0.8.0)", "NONE (exact 49-bp synthetic poly(A) transcriptional pause)"),
        ("syn_3xisre_2xnfkb_hpgk1_basalfloor_230", ["c1"], "Synthetic 3xISRE-2xNFkB + GRCh38.p14 chrX:78104169-78104288 (+1) minimal hPGK1 core (230 bp; OpenIslet v0.8.0:650-879)", "CC-BY-4.0 (OpenIslet v0.8.0) + INSDC/GRC human hPGK1 minimal core", "Composite synthetic 3xISRE-2xNFkB enhancer fused upstream of human minimal PGK1 basal core"),
        ("kozak_9", ["c1", "c2", "c3", "c4", "c5 (-/+)", "c6 (-/+)"], "Consensus vertebrate Kozak 9-mer GCCGCCACC", "Unrestricted 9-bp functional consensus motif / OpenIslet CC-BY-4.0", "Inserted (+) upstream of SERPINB9/PD-L1/iCasp9 CDSs and reverse-complemented (-) upstream of divergent CD47-IgV-GPI in c5/c6"),
        ("serpinb9_stop_1131", ["c1", "c2", "c3"], "UniProtKB:P50453 (SERPINB9, 1-376 aa) / OpenIslet v0.8.0 Locus3_ScarFree_Dual_Promoter:610-1740", "UniProtKB CC-BY-4.0 polypeptide + OpenIslet v0.8.0 CC-BY-4.0 codon sequence", "2A-free human SERPINB9 CDS terminated with native-length TGA stop codon (removes 21-aa GSG-P2A C-terminal tail)"),
        ("sv40_late_polya_122", ["c1", "c2", "c4", "c6"], "GenBank:J02400.1:2580-2701 (+1)", "INSDC archival sequence J02400.1 (non-coding poly(A) terminator; non-IRES) + OpenIslet v0.7.0 CC-BY-4.0", "NONE (122/122 bp exact match to GenBank J02400.1:2580-2701 (+1))"),
        ("maz4_pause_82", ["c1", "c2"], "Synthetic G-rich MAZ4 Pol II pause spacer (82 bp; OpenIslet v0.8.0 Locus3_ScarFree_Dual_Promoter:1863-1944)", "CC-BY-4.0 (OpenIslet v0.8.0)", "NONE (exact 82-bp synthetic transcriptional pause spacer)"),
        ("syn_5xisre_minprom_148", ["c1", "c2"], "Synthetic 5xISRE + TATA minimal inducible promoter (148 bp; OpenIslet v0.7.0 ISLET1_LOCUS1_ARM1B:1490-1637)", "CC-BY-4.0 (OpenIslet v0.7.0)", "NONE (exact 148-bp synthetic 5xISRE minimal promoter; upstream TATATAATGG motif gated as HOLD_PENDING_5PRIME_RACE_TSS until mature TSS is established by N_UMI_eff >= 3,689 5'-RACE)"),
        ("pdl1_syn6_873", ["c1", "c2", "c3"], "UniProtKB:Q9NZQ7 (CD274/PD-L1, 1-290 aa) / OpenIslet v0.7.0 ISLET1_LOCUS3:1804-2676 + SYN6", "UniProtKB CC-BY-4.0 polypeptide + OpenIslet CC-BY-4.0 synonymous codon derivative", "6 synonymous substitutions G693A/C720T/G723A/G783A/C858T/G861A (SYN6: Leu231/241/261/287 CTA, His240/286 CAT; 100% identical Q9NZQ7 aa; reduces antisense splice donors 7->5 & eliminates SYN2/SYN4 834/972/873/1011-nt antisense [AG]NNATGG ORFs)"),
        ("bgh_polya_225", ["c1", "c2"], "GenBank:M57764.1:2310-2534 (+1)", "INSDC archival sequence M57764.1 + OpenIslet v0.7.0 CC-BY-4.0", "NONE (225/225 bp exact match to GenBank M57764.1:2310-2534 (+1))"),
        ("human_actb_polya_150", ["c3"], "GRCh38.p14 chr7:5527089-5527238 (-1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "NONE (150/150 bp exact reverse-complement genomic slice of GRCh38.p14 chr7:5527089-5527238)"),
        ("human_cd274_prom_250", ["c3"], "GRCh38.p14 chr9:5450312-5450561 (+1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "NONE (250/250 bp exact forward genomic slice of GRCh38.p14 chr9:5450312-5450561)"),
        ("human_gapdh_polya_150", ["c3"], "GRCh38.p14 chr12:6538281-6538430 (+1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "NONE (150/150 bp exact forward genomic slice of GRCh38.p14 chr12:6538281-6538430)"),
        ("chs4_c72t_c73a_250", ["c4", "c6"], "GenBank:U78775.2:10-244 (+1)", "INSDC archival sequence U78775.2 + OpenIslet v0.8.0 CC-BY-4.0 splice-hardened derivative", "235-bp U78775.2:10-244 (+1) core at insert nt 3..237 flanked by 5' 2-bp GA + 3' 13-bp AGGCTGCCGCGGG plus IIP-0015 two-strand splice-hardening C72T/C73A in 1-based 250-bp insert coordinates (= C79T/C80A in U78775.2)"),
        ("hnrnpa2b1_cbx3_ucoe_2strand_455", ["c4", "c5", "c6"], "GRCh38.p14 chr7:26200580-26201034 (+1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0 splice-hardened derivative", "IIP-0015 two-strand cryptic-splice hardening edits at segment nt 32..33->TC, 72..73->TA, and 444..446->TCC"),
        ("eef1a1_core_230c", ["c4", "c5 (-)", "c6 (-)"], "GRCh38.p14 chr6:73521000-73521229 (-1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0 splice-hardened derivative", "IIP-0015 cryptic-donor hardening at segment nt 223->C and 229..230->CC; inserted (+) in c4 and divergently (-) in c5/c6"),
        ("icasp9_cds_1191", ["c4", "c5", "c6"], "UniProtKB:P62942 (FKBP1A F36V) + UniProtKB:P55211 (CASP9 delta-CARD) / OpenIslet v0.7.0 ISLET1_LOCUS4:1545-2735", "UniProtKB CC-BY-4.0 polypeptides + OpenIslet v0.7.0 CC-BY-4.0 codon sequence", "NONE vs OpenIslet v0.7.0 Locus-4 iCasp9 CDS (FKBP12 F36V fused via SGGGSG to CARD-deleted human CASP9 + TGA)"),
        ("cd47_igv_cd55_gpi_528", ["c5 (-)", "c6 (-)"], "UniProtKB:Q08722 (CD47 1-138, matching 1-140 via shared PN) + UniProtKB:P08174 (CD55 GPI 345-381) / OpenIslet v0.7.0 ARM1A:2739-3266", "UniProtKB CC-BY-4.0 polypeptides + OpenIslet v0.7.0 CC-BY-4.0 codon sequence", "Inserted divergently on (-) strand opposite (+)-strand iCasp9 in c5/c6 (exact reverse-complement match to ARM1B[723..1250])"),
        ("human_hbb_polya_150", ["c5 (-)", "c6 (-)"], "GRCh38.p14 chr11:5225405-5225554 (-1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "Inserted divergently on (-) strand terminating (-) CD47-IgV-GPI transcription unit in c5/c6"),
        ("human_ubc_prom_250", ["c5", "c6"], "GRCh38.p14 chr12:124914631-124914880 (-1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "NONE (250/250 bp exact reverse-complement genomic slice of GRCh38.p14 chr12:124914631-124914880)"),
        ("human_ubc_polya_150", ["c5"], "GRCh38.p14 chr12:124911587-124911736 (-1)", "INSDC/GRC human reference assembly + OpenIslet v0.8.0 CC-BY-4.0", "NONE (150/150 bp exact reverse-complement genomic slice of GRCh38.p14 chr12:124911587-124911736)"),
    ]

    segment_provenance_ledger: List[Dict[str, Any]] = []
    for sid, used_in, src_acc, rights, xform in segment_meta_24:
        sseq = segment_seq_by_id[sid]
        occ_list = occurrences_by_segment[sid]
        occ_sha_map = {
            f"{o['construct']}:{o['start_1based']}-{o['end_1based']}({o['strand']})": o["occurrence_sha256"]
            for o in occ_list
        }
        segment_provenance_ledger.append(
            {
                "segment_id": sid,
                "length_bp": len(sseq),
                "sha256": sha256_str(sseq),
                "used_in": used_in,
                "source_accession_or_build": src_acc,
                "rights_basis": rights,
                "transformations": xform,
                "occurrence_sha256": occ_sha_map,
                "occurrences": occ_list,
            }
        )

    u95_cp_3687 = -math.expm1(math.log(0.05) / 3687.0)
    u95_cp_3688 = -math.expm1(math.log(0.05) / 3688.0)
    u95_cp_3689 = -math.expm1(math.log(0.05) / 3689.0)
    u95_poisson_299573227 = -math.log(0.05) / 299573227.0
    u95_poisson_299573228 = -math.log(0.05) / 299573228.0
    u95_cp_299573225 = -math.expm1(math.log(0.05) / 299573225.0)
    u95_cp_299573226 = -math.expm1(math.log(0.05) / 299573226.0)

    return {
        "contribution_id": "IIP-0026",
        "decision_id": "DEC-105",
        "fasta_artifact": {
            "relative_path": "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta",
            "file_sha256": designb_fasta_sha256,
            "bound_c1_c5_pair_sha256": bound_c1_c5_pair_sha256,
            "record_count": len(construct_reports),
            "canonical_scenario_a_fasta_untouched": True,
        },
        "explicit_four_state_product_lifecycle": {
            "state_1_staged_reference_fasta_artifact": {
                "state_id": "STAGED_REFERENCE_FASTA_ARTIFACT",
                "fasta_sha256": designb_fasta_sha256,
                "bound_c1_c5_pair_sha256": bound_c1_c5_pair_sha256,
                "achieved": True,
            },
            "state_2_registry_donor_reference_bound": {
                "state_id": "REGISTRY_DONOR_REFERENCE_BOUND",
                "bound_products": ["ISLET1_B2_5LOCUS_BASE", "ISLET1_B2_5LOCUS_TYK2_PE"],
                "selected_primary_donor_pair": [
                    "DESIGNB_L5A_CXCL10_BFB_SYN6_ACC_4078bp",
                    "DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_HUMAN_ACC_4172bp",
                ],
                "bound_c1_c5_pair_sha256": bound_c1_c5_pair_sha256,
                "achieved": True,
            },
            "state_3_stage0_research_comparator_pending_allele_qc": {
                "state_id": "STAGE0_RESEARCH_COMPARATOR_PENDING_ALLELE_QC",
                "execution_supported": False,
                "achieved": True,
                "note": "Current post-fold-in state for ISLET1_B2_5LOCUS_BASE and ISLET1_B2_5LOCUS_TYK2_PE; decoupled from Bayesian calibration admission.",
            },
            "state_4_execution_supported_qualified_product": {
                "state_id": "EXECUTION_SUPPORTED_QUALIFIED_PRODUCT",
                "execution_supported": True,
                "achieved": False,
            },
        },
        "c6_two_factor_comparator_audit": {
            "c5_bp": len(c5_b_l6_aavs1_cd47_icasp9_human_4172),
            "c6_bp": len(c6_b_l6_aavs1_cd47_icasp9_chs4_4394),
            "delta_bp": len(c6_b_l6_aavs1_cd47_icasp9_chs4_4394) - len(c5_b_l6_aavs1_cd47_icasp9_human_4172),
            "factor_1_added_chs4_c72t_c73a_bp": 250,
            "factor_2_replaced_c5_ubc_polya_150bp_with_sv40_polya_122bp_delta": -28,
            "exact_two_factor_length_identity": (4172 + 250 - 150 + 122) == 4394,
            "chs4_reference_base_reconciliation": "C72T/C73A in 1-based 250-bp insert coordinates (= C79T/C80A in ENA/GenBank U78775.2:10-244 (+1))",
        },
        "per_segment_provenance_ledger_24": segment_provenance_ledger,
        "design_b_construct_audits": construct_reports,
        "swissprot_unique_string_vs_positional_reconciliation": {
            "pinned_human_swissprot_protein_count": 20429,
            "pinned_human_swissprot_uncompressed_sha256": EXPECTED_SWISSPROT_UNCOMPRESSED_SHA256_IIP0026,
            "pinned_human_swissprot_gzip_sha256": EXPECTED_SWISSPROT_GZ_SHA256_IIP0026,
            "license": "CC-BY-4.0 (UniProt Consortium)",
            "arm6_serpinb9_c341s_missense_benchmark": {
                "legacy_integer_count_delta_8_11mer": 0,
                "unique_8_11mers_added_absent_from_swissprot": len(arm6_added_8_11),
                "unique_8_11mers_removed_vs_wt": len(arm6_removed_8_11),
                "unique_15mers_added_absent_from_swissprot": len(arm6_added_15),
            },
            "complete_islet1_b2_5locus_base_mature_8_11_and_15": list(b2_base_mat),
            "complete_islet1_b2_5locus_base_precursor_8_11_and_15": list(b2_base_prec),
            "complete_islet1_b2_5locus_tyk2_pe_mature_8_11_and_15": list(b2_pe_mat),
            "complete_islet1_b2_5locus_tyk2_pe_precursor_8_11_and_15": list(b2_pe_prec),
            "untouched_wt_ins_unmatched_8_11_and_15": [0, 0],
        },
        "iip0015_pdl1_syn2_syn4_versioned_disclosure_note": {
            "audit_disposition": "DISCLOSED_VERSIONED_RE_EVALUATION_NOTE_NO_IN_PLACE_SCENARIO_A_OR_IIP0018_MUTATION",
            "canonical_v070_wt_pdl1_minus_orfs_ge_300nt": _scan_minus_kozak_ge300(l3_can, 580),
            "syn2_c720t_g723c_minus_orfs_ge_300nt": c1_syn2_minus,
            "syn4_c720t_g723c_c858t_g861c_c1_minus_orfs_ge_300nt": c1_syn4_minus,
            "scenario_a_syn4_l3_minus_orfs_ge_300nt": scen_a_syn4_l3_minus,
            "iip0018_multimir_6_descendants_minus_orfs_ge_300nt": iip0018_minus_orf_audit,
            "designb_pdl1_syn6_c1_c2_c3_minus_orfs_ge_300nt": designb_c1_c3_minus,
            "pdl1_cds_antisense_donor_reduction_wt_to_syn6": [wt_pdl1_minus_donors, syn6_pdl1_minus_donors],
            "disclosure_note": (
                "Historical IIP-0015 / IIP-0018 Mode-B comparators carrying PD-L1 SYN2 (C720T/G723C) or SYN4 "
                "(C720T/G723C/C858T/G861C, including ARM1 at 2267..3238/2267..3100 and ARM2..ARM6 at 2587..3558/2587..3420 "
                "in islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta) contain 834-nt and 972-nt (873-nt and 1,011-nt in "
                "Scenario-A SYN4 c3) minus-strand GAGATGGGT closed ORFs missed by Layer-2's literal CCACCATG scan; Design B "
                "c1..c3 use PD-L1 SYN6 (G693A/C720T/G723A/G783A/C858T/G861A -> 0 antisense [AG]NNATGG runs >= 300 nt, 7->5 "
                "antisense splice donors) while canonical Scenario A and IIP-0018 FASTAs remain untouched."
            ),
        },
        "oq011_ins_3utr_eif4g2_knockin_retirement_audit": {
            "retired_open_question": "OQ-011",
            "graveyard_card_id": "GY-022",
            "offgrid_guardrail_id": "OFFGRID_GUARD_012_CHR11P15_INS_3UTR_EIF4G2_BICISTRONIC_KNOCKIN_RETIRED",
            "disposition": "RETIRED_TO_OFFGRID_IDEA_GRAVEYARD_GUARDRAIL",
            "nm000207_3_stop_codon": "TAG (amber stop at mRNA 390..392 / chr11:2,159,852..2,159,854 [-1])",
            "native_3utr_nt": 73,
            "minimal_2afree_eif4g2_serpinb9_pdl1_insert_nt": 2638,
            "expanded_3utr_nt": 2711,
            "expansion_fold_vs_73nt": 37.14,
            "spcas9_guides_in_73nt_3utr_hitting_ptbp1_insprs": [8, 15],
            "curative_500k_ieq_non_beta_unshielded_cell_fraction": round(453.5 / 933.5, 6),
            "consistent_ensembl_grch38_gene_boundary_distances_bp": {
                "INS_to_IGF2_bp": 1183,
                "INS_to_H19_bp": 155227,
                "INS_to_CDKN1C_bp": 721992,
            },
            "eif4g2_nm001418_4_leader_uatg_1based": [23],
            "eif4g1_ay082886_1_leader_uatg_count": 3,
            "rare_event_exact_denominators": {
                "umi_threshold": 0.000812,
                "u95_cp_at_3687_fails": u95_cp_3687,
                "u95_cp_at_3688_exact_min": u95_cp_3688,
                "u95_cp_at_3689_protocol_floor": u95_cp_3689,
                "ap1903_poisson_at_299573227_fails": u95_poisson_299573227,
                "ap1903_poisson_at_299573228_passes": u95_poisson_299573228,
                "ap1903_binomial_cp_at_299573225_fails": u95_cp_299573225,
                "ap1903_binomial_cp_at_299573226_passes": u95_cp_299573226,
            },
        },
    }


EXPECTED_NM021999_5_CDS_SHA256_IIP0028 = "6fc8d3d7a9b4851a9b50c026d44f02e7d2539e122a0b727d2a5cc4ee93df8903"
EXPECTED_NM021999_5_FASTA_SHA256_IIP0028 = "4a4cb15d0544884a62d86ebf4137c5284edad8210b6e32e74c2eb0aff005d13e"
UNIPROT_Q9Y287_ITM2B_WT_266AA = (
    "MVKVTFNSALAQKEAKKDEPKSGEEALIIPPDAVAVDCKDPDDVVPVGQRRAWCWCMCFGLAFMLAGVILGGAYLYKYFA"
    "LQPDDVYYCGIKYIKDDVILNEPSADAPAALYQTIEENIKIFEEEEVEFISVPVPEFADSDPANIVHDFNKKLTAYLDLN"
    "LDKCYVIPLNTSIVMPPRNLLELLINIKAGTYLPQSYLIHEHMVITDRIENIDHLGFFIYRLCHDKETYKLQRRETIKGI"
    "QKREASNCFAIRHFENKFAVETLICS"
)
UNIPROT_P07988_SFTPB_WT_381AA = (
    "MAESHLLQWLLLLLPTLCGPGTAAWTTSSLACAQGPEFWCQSLEQALQCRALGHCLQEVWGHVGADDLCQECEDIVHILN"
    "KMAKEAIFQDTMRKFLEQECNVLPLKLLMPQCNQVLDDYFPLVIDYFQNQTDSNGICMHLGLCKSRQPEPEQEPGMSDPL"
    "PKPLRDPLPDPLLDKLVLPVLPGALQARPGPHTQDLSEQQFPIPLPYCWLCRALIKRIQAMIPKGALAVAVAQVCRVVPL"
    "VAGGICQCLAERYSVILLDTLLGRMLPQLVCRLVLRCSMDDSAGPRSPTGEWLPRDSECHLCMSVTTQAGNSSEQAIPQA"
    "MLQACVGSWLDREKCKQFVEQHTPQLLTLVPRGWDAHTTCQALGVCGTMSSPLQCIHSPDL"
)
UNIPROT_P10997_IAPP_WT_89AA = (
    "MGILKLQVFLIVLSVALNHLKATPIESHQVEKRKCNTATCATQRLANFLVHSSNNFGAILSSTNVGSNTYGKRNAVEVLK"
    "REPLNYLPL"
)


def _build_itm2b_nm021999_reserve_and_brichos_comparator_audit_iip_0028(
    ref: Dict[str, Any],
    l3_can: str,
    l4_can: str,
) -> Dict[str, Any]:
    """
    Build deterministic 0%-active-weight archival RefSeq NM_021999.5 ITM2B (UniProt Q9Y287)
    conditional P2 Mode-B reserve audit, reconciling Cen et al. 2025 (Bri2 90-263) vs
    Oskarsson et al. 2018 (Bri2 90-236) Ad-BRICHOS comparator bounds, Chen et al. 2024 Bri23
    client-occupancy caveat, and single-AAV6 vs dedicated-donor bp budgets (IIP-0028; DEC-106).
    """
    nm_fasta_path = REPO_ROOT / "data/constructs/nm_021999_5_archival_mrna.fasta"
    if not nm_fasta_path.is_file():
        raise FileNotFoundError(f"Missing staged archival ITM2B FASTA: {nm_fasta_path}")
    nm_fasta_bytes = nm_fasta_path.read_bytes()
    nm_fasta_sha = hashlib.sha256(nm_fasta_bytes).hexdigest()
    if nm_fasta_sha != EXPECTED_NM021999_5_FASTA_SHA256_IIP0028:
        raise ValueError(
            f"nm_021999_5_archival_mrna.fasta SHA-256 mismatch: {nm_fasta_sha} != {EXPECTED_NM021999_5_FASTA_SHA256_IIP0028}"
        )
    nm_lines = nm_fasta_bytes.decode("utf-8").splitlines()
    if not nm_lines or not nm_lines[0].startswith(">NM_021999.5"):
        raise ValueError("Unexpected header in nm_021999_5_archival_mrna.fasta")
    nm_mrna = "".join(ln.strip().upper() for ln in nm_lines[1:] if ln.strip())
    if len(nm_mrna) != 10089:
        raise ValueError(f"Expected 10,089-nt unwrapped NM_021999.5 mRNA, got {len(nm_mrna)}")

    # 1-based inclusive CDS 156..956 (801 nt = 266 aa Q9Y287 + TGA stop):
    cds_801 = nm_mrna[155:956]
    cds_sha = hashlib.sha256(cds_801.encode("ascii")).hexdigest()
    if len(cds_801) != 801 or cds_sha != EXPECTED_NM021999_5_CDS_SHA256_IIP0028 or cds_801[-3:] != "TGA":
        raise ValueError(f"Invalid NM_021999.5 CDS 156..956 slice or SHA-256: {cds_sha}")
    q9y287_aa = _translate_strict_cds_iip0026(cds_801, True)
    if q9y287_aa != UNIPROT_Q9Y287_ITM2B_WT_266AA or len(q9y287_aa) != 266:
        raise ValueError("Translated NM_021999.5 CDS does not match 266-aa UniProt Q9Y287")

    uniprot_b2m = ref["uniprot_protein_sequences"]["P61769"]["sequence"]
    uniprot_ins = UNIPROT_P01308_INS_WT_110AA
    uniprot_sftpb = UNIPROT_P07988_SFTPB_WT_381AA
    uniprot_iapp = UNIPROT_P10997_IAPP_WT_89AA

    # Exact canonical 20,429-entry UniProtKB/Swiss-Prot k-mer match set for the 5 parent human proteins
    # (verified 100% identical to full 20,429-entry proteome scan across all 10 native/chimeric constructs):
    sp_k8_11: Set[str] = set()
    sp_k15: Set[str] = set()
    for wt_seq in (q9y287_aa, uniprot_sftpb, uniprot_ins, uniprot_iapp, uniprot_b2m):
        sp_k8_11 |= _protein_kmers_iip0026(wt_seq, (8, 9, 10, 11))
        sp_k15 |= _protein_kmers_iip0026(wt_seq, (15,))

    def _window_stats(seq: str) -> Dict[str, Any]:
        pos_8_11_tot = 0
        pos_8_11_miss = 0
        uniq_miss_8_11: Set[str] = set()
        for k in (8, 9, 10, 11):
            for idx in range(len(seq) - k + 1):
                pos_8_11_tot += 1
                w = seq[idx : idx + k]
                if w not in sp_k8_11:
                    pos_8_11_miss += 1
                    uniq_miss_8_11.add(w)
        pos_15_tot = max(0, len(seq) - 15 + 1)
        pos_15_miss = 0
        uniq_miss_15: Set[str] = set()
        for idx in range(pos_15_tot):
            w15 = seq[idx : idx + 15]
            if w15 not in sp_k15:
                pos_15_miss += 1
                uniq_miss_15.add(w15)
        return {
            "length_aa": len(seq),
            "sha256_aa": sha256_str(seq),
            "total_positional_8_11mers": pos_8_11_tot,
            "unmatched_positional_8_11mers": pos_8_11_miss,
            "unmatched_unique_8_11mers": len(uniq_miss_8_11),
            "total_positional_15mers": pos_15_tot,
            "unmatched_positional_15mers": pos_15_miss,
            "unmatched_unique_15mers": len(uniq_miss_15),
        }

    audited_constructs = {
        "Native_FullLength_ITM2B_Q9Y287_1_266": _window_stats(q9y287_aa),
        "Cleaved_mBRI2_1_243_Furin_Arg243_Glu244": _window_stats(q9y287_aa[:243]),
        "Cleaved_Bri23_244_266": _window_stats(q9y287_aa[243:]),
        "Secreted_BRICHOS_Core_137_231": _window_stats(q9y287_aa[136:231]),
        "CryoEM_8RNU_RecombinantFragment_Bri2_113_231": _window_stats(q9y287_aa[112:231]),
        "Oskarsson2018_PublishedBound_SFTPB1_23_Bri2_90_236": _window_stats(uniprot_sftpb[:23] + q9y287_aa[89:236]),
        "Cen2025_PublishedBound_SFTPB1_23_Bri2_90_263": _window_stats(uniprot_sftpb[:23] + q9y287_aa[89:263]),
        "Synthetic_INS_SP1_24_Bri2_113_231": _window_stats(uniprot_ins[:24] + q9y287_aa[112:231]),
        "Synthetic_IAPP_SP1_22_Bri2_137_231": _window_stats(uniprot_iapp[:22] + q9y287_aa[136:231]),
        "Synthetic_B2M_SP1_20_Bri2_137_231": _window_stats(uniprot_b2m[:20] + q9y287_aa[136:231]),
    }
    if (
        audited_constructs["Native_FullLength_ITM2B_Q9Y287_1_266"]["total_positional_8_11mers"] != 1030
        or audited_constructs["Native_FullLength_ITM2B_Q9Y287_1_266"]["unmatched_positional_8_11mers"] != 0
        or audited_constructs["Native_FullLength_ITM2B_Q9Y287_1_266"]["total_positional_15mers"] != 252
        or audited_constructs["Native_FullLength_ITM2B_Q9Y287_1_266"]["unmatched_positional_15mers"] != 0
        or audited_constructs["Oskarsson2018_PublishedBound_SFTPB1_23_Bri2_90_236"]["unmatched_positional_8_11mers"] != 34
        or audited_constructs["Oskarsson2018_PublishedBound_SFTPB1_23_Bri2_90_236"]["unmatched_positional_15mers"] != 14
        or audited_constructs["Cen2025_PublishedBound_SFTPB1_23_Bri2_90_263"]["unmatched_positional_8_11mers"] != 34
        or audited_constructs["Cen2025_PublishedBound_SFTPB1_23_Bri2_90_263"]["unmatched_positional_15mers"] != 14
    ):
        raise ValueError("Unexpected ITM2B vs SP-BRICHOS Swiss-Prot window counts (IIP-0028; DEC-106)")

    # Explicit cassette component bp ledger reconciling bare 801-nt CDS vs 1,129-bp 2A-free cistron
    # and 2,755-bp dedicated/split AAV6 donor (<= 4,700 bp single-AAV6 packaging ceiling):
    itr_pair_bp = 290  # 2 x 145-bp AAV6 ITRs
    minimal_2afree_cistron_components_bp = {
        "spa_transcriptional_pause_bp": 49,
        "syn_5xisre_minimal_promoter_bp": 148,
        "kozak_consensus_bp": 9,
        "itm2b_nm021999_5_cds_bp": len(cds_801),
        "sv40_late_polya_bp": 122,
    }
    mod_2afree_bp = sum(minimal_2afree_cistron_components_bp.values())  # 1,129 bp
    l3_can_packaged_bp = len(l3_can) + itr_pair_bp  # 4,090 + 290 = 4,380 bp
    l3_scarfree_packaged_bp = 3799 + itr_pair_bp  # 4,089 bp
    l4_can_packaged_bp = len(l4_can) + itr_pair_bp  # 3,457 + 290 = 3,747 bp
    dedicated_donor_components_bp = {
        "left_homology_arm_bp": 600,
        "syn_5xisre_minimal_promoter_bp": 148,
        "kozak_consensus_bp": 9,
        "itm2b_nm021999_5_cds_bp": len(cds_801),
        "bgh_polya_bp": 225,
        "maz4_insulator_pause_spacer_bp": 82,
        "right_homology_arm_bp": 600,
        "two_aav6_itrs_2x145_bp": itr_pair_bp,
    }
    dedicated_packaged_bp = sum(dedicated_donor_components_bp.values())  # 2,755 bp
    if (
        mod_2afree_bp != 1129
        or (l3_can_packaged_bp + len(cds_801)) != 5181
        or (l3_scarfree_packaged_bp + mod_2afree_bp) != 5218
        or (l3_can_packaged_bp + mod_2afree_bp) != 5509
        or (l4_can_packaged_bp + len(cds_801)) != 4548
        or (l4_can_packaged_bp + mod_2afree_bp) != 4876
        or dedicated_packaged_bp != 2755
    ):
        raise ValueError("ITM2B cassette length ledger arithmetic check failed (IIP-0028; DEC-106)")

    return {
        "contribution_id": "IIP-0028",
        "decision_id": "DEC-106",
        "graveyard_card_id": "GY-023",
        "offgrid_guardrail_id": "OFFGRID_GUARD_013_STANDALONE_72H_A11_COMPLEMENT_ONLY_CROSSMATCH_AND_UNQUALIFIED_SP_BRICHOS_FUSIONS",
        "active_weight_pct": 0.0,
        "quarantine_status": "HELD_0PCT_WEIGHT_CONDITIONAL_P2_MODE_B_RESERVE_REQUIRING_CONCORDANT_OR_REPLICATED_CHRONIC_IAPP_BREACH",
        "canonical_scenario_a_and_design_b_fastas_untouched": True,
        "archival_mrna_provenance": {
            "relative_path": "data/constructs/nm_021999_5_archival_mrna.fasta",
            "accession": "NM_021999.5",
            "rights_basis": "INSDC / NCBI RefSeq public archival sequence data",
            "fasta_file_sha256": nm_fasta_sha,
            "unwrapped_mrna_length_nt": len(nm_mrna),
            "cds_1based_inclusive_coords": [156, 956],
            "cds_length_nt": len(cds_801),
            "cds_ascii_sha256": cds_sha,
            "translated_uniprot_accession": "Q9Y287",
            "translated_length_aa": len(q9y287_aa),
            "terminal_stop_codon": cds_801[-3:],
            "pdb_domain_reference": {
                "pdb_id": "8RNU",
                "resolution_angstrom": 3.40,
                "fragment_residues_q9y287": [113, 231],
                "fragment_length_aa": 119,
                "rights_basis": "CC0-1.0 (wwPDB archive usage policy; Chen et al. 2024 PMID:38864729)",
            },
        },
        "pinned_swissprot_reference": {
            "reviewed_human_protein_count": 20429,
            "gzip_sha256": "40a8856b4e3f3620b11635143b501ef701558ed97309b0cdb4423ef09e4618d0",
            "uncompressed_sha256": "13852e174364bf1c705206c38eacae57210f5bca9955f05be6b4ff48f727d37b",
            "license": "CC-BY-4.0",
        },
        "comparator_coordinate_and_functional_reconciliation": {
            "oskarsson_2018_pmid_29507232_published_construct": "SFTPB[1-23] (MAESHLLQWLLLLLPTLCGPGTA) fused to Bri2[90-236] (170 aa precursor)",
            "cen_2025_pmid_41212211_published_text_bound": "Reports Bri2 residues 90-263 while citing Oskarsson et al. 2018 (197 aa precursor if literal); high-titre Ad-BRICHOS failed to restore insulin content in Fig. 4c and provides no full-length ITM2B islet-graft efficacy result",
            "junction_seam_insensitivity_note": (
                "Both reported C-terminal coordinates (90-236 and 90-263) share the identical N-terminal SFTPB[1-23]|Bri2[90..] "
                "chimeric fusion seam, yielding 34 unmatched positional 8-11-mers and 14 unmatched 15-mers (identical to synthetic "
                "INS[1-24], IAPP[1-22], and B2M[1-20] leader fusions), whereas interpretation of the biological Ad-BRICHOS comparator "
                "requires keeping its original truncated sequence distinct from full-length native ITM2B."
            ),
            "chen_2024_pmid_38864729_bri23_occupancy_and_safety_caveat": (
                "Full-length ITM2B co-generates membrane mBRI2[1-243] and the Bri23[244-266] peptide via Golgi FURIN cleavage "
                "(Arg243|Glu244; Kim et al. 1999 PMID:10526337) and ADAM10 ectodomain shedding (Martin et al. 2008 PMID:17965014). "
                "Chen et al. 2024 (PMID:38864729) reported reduced anti-amyloid activity in an Abeta system when native Bri23 occupies "
                "the BRICHOS client-binding surface, and 0 unmatched Swiss-Prot windows establish canonical sequence identity only — "
                "leaving HLA presentation, proteolytic processing, endocrine dose-response, and IAPP graft rescue empirically open."
            ),
        },
        "peptide_window_census": audited_constructs,
        "aav6_cassette_packaging_budget_ledger": {
            "single_aav6_packaging_ceiling_bp": 4700,
            "minimal_2afree_itm2b_cistron_components_bp": minimal_2afree_cistron_components_bp,
            "minimal_2afree_itm2b_cistron_total_bp": mod_2afree_bp,
            "locus3_canonical_4090_plus_2x145_itrs_bp": l3_can_packaged_bp,
            "locus3_canonical_plus_bare_801nt_cds_before_regulatory_elements_bp": l3_can_packaged_bp + len(cds_801),
            "locus3_scarfree_4089_plus_1129bp_2afree_cistron_bp": l3_scarfree_packaged_bp + mod_2afree_bp,
            "locus3_canonical_4380_plus_1129bp_2afree_cistron_bp": l3_can_packaged_bp + mod_2afree_bp,
            "locus3_single_aav6_compatible": False,
            "locus4_aavs1_3457_plus_2x145_itrs_bp": l4_can_packaged_bp,
            "locus4_plus_bare_801nt_cds_before_regulatory_elements_bp": l4_can_packaged_bp + len(cds_801),
            "locus4_plus_1129bp_2afree_cistron_packaged_bp": l4_can_packaged_bp + mod_2afree_bp,
            "locus4_single_aav6_compatible": False,
            "dedicated_or_split_donor_components_bp": dedicated_donor_components_bp,
            "dedicated_or_split_donor_packaged_bp": dedicated_packaged_bp,
            "dedicated_or_split_donor_headroom_bp": 4700 - dedicated_packaged_bp,
            "dedicated_or_split_donor_single_aav6_compatible": dedicated_packaged_bp <= 4700,
            "design_y_minicircle_11066_plus_1129bp_cistron_bp": 11066 + mod_2afree_bp,
            "design_y_governed_by_gy017_and_iip0023": True,
        },
        "primary_citations": [
            "PMID:41212211",
            "PMID:29507232",
            "PMID:38864729",
            "PMID:10526337",
            "PMID:17965014",
            "PMID:12702875",
            "PMID:38603470",
            "PMID:20160085",
            "PMID:29288549",
            "PMID:33210820",
            "PMID:19904234",
        ],
    }


AAV2_ITR_145BP_J01901_1_145_IIP0027 = (
    "TTGGCCACTCCCTCTCTGCGCGCTCGCTCGCTCACTGAGGCCGGGCGACCAAAGGTCGCC"
    "CGACGCCCGGGCTTTGCCCGGGCGGCCTCAGTGAGCGAGCGAGCGCGCAGAGAGGGAGTG"
    "GCCAACTCCATCACTAGGGGTTCCT"
)


def _build_locus3_initiation_6pwm_and_aav_itr_audit_iip_0027(
    ref: Dict[str, Any],
    construct_verification: Dict[str, Any],
    iip_0015_manifest: Dict[str, Any],
    iip_0026_manifest: Dict[str, Any],
) -> Dict[str, Any]:
    """
    Build deterministic whole-donor 6-PWM JASPAR part-resolved annotation ledger across
    canonical references, historical 2A-free Locus-3 comparators (DX-L3, L3-BF-B),
    staged DEC-105 Design-B comparators (c1..c6), IIP-0018 ARM1, and the 145-bp AAV2 ITR
    (GenBank J01901.1 nt 1..145) (IIP-0027; DEC-107).

    Explicitly archives 6-PWM motif counts strictly as descriptive part-resolved annotation
    (rejecting motif-count closure of OQ-011) and anchors resting (0 h) + interferon-stimulated
    (24 h) promoter-of-origin 5'-RACE TSS attribution plus conditional BIO-06 AAV-ITR RNA-origin
    attribution.
    """
    pwms = ref["jaspar_pwms"]
    n_pwms = len(pwms)
    constructs = construct_verification["constructs"]
    parents = iip_0015_manifest["parental_open_grammar_scans"]

    def _read_fasta_records(path: Path) -> List[Tuple[str, str, str]]:
        recs: List[Tuple[str, str, str]] = []
        for blk in path.read_text(encoding="utf-8").strip().split(">")[1:]:
            lines = blk.splitlines()
            cid = lines[0].split()[0]
            seq = "".join(lines[1:]).strip().upper()
            recs.append((cid, seq, sha256_str(seq)))
        return recs

    def _parse_part_breakdown(breakdown: str) -> List[Tuple[str, int, int, str]]:
        out: List[Tuple[str, int, int, str]] = []
        cursor = 1
        for length_txt, pname in re.findall(r"(\d+) \(([^)]+)\)", breakdown.split(" = ")[0]):
            end_bp = cursor + int(length_txt) - 1
            low = pname.lower()
            if "ha_l" in low or "ha_r" in low or "homology" in low:
                role = "homology_arm"
            elif any(tok in low for tok in ("prom", "isre", "basalfloor", "chs4", "ucoe", "eef1a1", "rpl13a", "hpgk")):
                role = "declared_promoter_or_insulator"
            else:
                role = "non_promoter_cargo"
            out.append((pname, cursor, end_bp, role))
            cursor = end_bp + 1
        return out

    def _classify_part_role(pname: str) -> str:
        low = pname.lower()
        if "ha_l" in low or "ha_r" in low or "homology" in low:
            return "homology_arm"
        if any(tok in low for tok in ("prom", "isre", "basalfloor", "chs4", "ucoe", "eef1a1", "rpl13a", "hpgk", "minp", "bidir")):
            return "declared_promoter_or_insulator"
        if "aav2_itr" in low:
            return "aav_itr"
        return "non_promoter_cargo"

    def _hit_parts(start_bp: int, end_bp: int, parts: List[Tuple[str, int, int, str]]) -> Tuple[List[str], List[str]]:
        names: List[str] = []
        roles: List[str] = []
        for pname, p_lo, p_hi, prole in parts:
            if p_lo <= end_bp and p_hi >= start_bp:
                names.append(pname)
                if prole not in roles:
                    roles.append(prole)
        return names, roles

    def _scan_record(
        record_id: str,
        source_label: str,
        seq: str,
        parts: List[Tuple[str, int, int, str]],
        canonical_stored: Optional[Dict[str, Any]] = None,
    ) -> Dict[str, Any]:
        packaged_bp = len(seq) + AAV2_TWO_ITRS_LENGTH_BP if record_id != "AAV2_ITR_145BP_J01901_1_145" else len(seq)
        headroom_bp = (AAV6_PACKAGING_LIMIT_BP - packaged_bp) if record_id != "AAV2_ITR_145BP_J01901_1_145" else None
        by_pc: Dict[str, Any] = {}
        for pc_label, pc_val in (("pseudocount_0p8_production", 0.8), ("pseudocount_0p5_comparator", 0.5)):
            total_win = 0
            total_merged = 0
            total_reg6 = 0
            non_promoter_cargo_win_hits = 0
            reverse_strand_win_hits = 0
            per_matrix: Dict[str, Any] = {}
            for mid, pwm_entry in pwms.items():
                mkey = f"{mid}_{pwm_entry['tf_name']}"
                sc = scan_jaspar_pwm(seq, pwm_entry, top_k=20, n_matrices_in_scan=n_pwms, pseudocount=pc_val)
                if canonical_stored is not None:
                    ref_m = canonical_stored[pc_label]["per_matrix_summary"][mkey]
                    if (
                        sc["significant_window_hits_rel0p80_bonferroni_0p05"]
                        != ref_m["significant_window_hits_rel0p80_bonferroni_0p05"]
                        or sc["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"]
                        != ref_m["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"]
                        or sc["significant_hits_rel0p80_region_wide_bonferroni_0p05"]
                        != ref_m["significant_hits_rel0p80_region_wide_bonferroni_0p05"]
                    ):
                        raise ValueError(f"IIP-0027 canonical 6-PWM replay mismatch on {record_id} {mkey}")
                w_cnt = int(sc["significant_window_hits_rel0p80_bonferroni_0p05"])
                m_cnt = int(sc["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"])
                r_cnt = int(sc["significant_hits_rel0p80_region_wide_bonferroni_0p05"])
                total_win += w_cnt
                total_merged += m_cnt
                total_reg6 += r_cnt
                passing_hits: List[Dict[str, Any]] = []
                for hit in sc["top_hits"]:
                    if hit["passes_rel_score_0p80_and_p_le_0p05"]:
                        pnames, proles = _hit_parts(
                            int(hit["start_1based_in_window"]),
                            int(hit["end_1based_in_window"]),
                            parts,
                        )
                        if hit["strand"] == "-":
                            reverse_strand_win_hits += 1
                        if proles and all(r == "non_promoter_cargo" for r in proles):
                            non_promoter_cargo_win_hits += 1
                        passing_hits.append({
                            "strand": hit["strand"],
                            "start_1based": int(hit["start_1based_in_window"]),
                            "end_1based": int(hit["end_1based_in_window"]),
                            "relative_score_0_to_1": hit["relative_score_0_to_1"],
                            "bonferroni_window_p_value": hit["bonferroni_window_p_value"],
                            "bonferroni_region_6pwm_p_value": hit["bonferroni_region_across_all_matrices_p_value"],
                            "passes_region_6pwm_0p05": bool(hit["passes_region_wide_bonferroni_0p05"]),
                            "overlapping_parts": pnames,
                            "part_roles": proles,
                        })
                top0 = sc["top_hits"][0]
                top0_parts, top0_roles = _hit_parts(
                    int(top0["start_1based_in_window"]),
                    int(top0["end_1based_in_window"]),
                    parts,
                )
                per_matrix[mkey] = {
                    "counts_window_merged_region6": [w_cnt, m_cnt, r_cnt],
                    "top_hit": {
                        "strand": top0["strand"],
                        "start_1based": int(top0["start_1based_in_window"]),
                        "end_1based": int(top0["end_1based_in_window"]),
                        "relative_score_0_to_1": top0["relative_score_0_to_1"],
                        "bonferroni_window_p_value": top0["bonferroni_window_p_value"],
                        "bonferroni_region_6pwm_p_value": top0["bonferroni_region_across_all_matrices_p_value"],
                        "overlapping_parts": top0_parts,
                        "part_roles": top0_roles,
                    },
                    "passing_hits": passing_hits,
                }
            by_pc[pc_label] = {
                "pseudocount": pc_val,
                "counts_window_merged_region6_total": [total_win, total_merged, total_reg6],
                "non_promoter_cargo_significant_window_hits": non_promoter_cargo_win_hits,
                "reverse_strand_significant_window_hits": reverse_strand_win_hits,
                "per_matrix": per_matrix,
            }
        return {
            "record_id": record_id,
            "source": source_label,
            "length_bp": len(seq),
            "sha256": sha256_str(seq),
            "packaged_with_2x145bp_itrs_bp": packaged_bp,
            "aav6_headroom_bp": headroom_bp,
            "jaspar_6pwm_by_pseudocount": by_pc,
        }

    # 1. Canonical 4 constructs (replaying against frozen whole_donor_jaspar_6pwm_scans_by_pseudocount)
    canonical_fasta_recs = _read_fasta_records(FASTA_OUT)
    canonical_short = {
        4880: "L1_ARM1A_4880",
        3974: "L1_ARM1B_3974",
        4090: "L3_CANONICAL_4090",
        3457: "L4_3457",
    }
    scanned_records: Dict[str, Any] = {}
    for (fname, fseq, fsha), c_obj in zip(canonical_fasta_recs, constructs):
        if fsha != c_obj["donor_sha256"]:
            raise ValueError(f"Canonical FASTA SHA-256 mismatch for {fname}")
        sname = canonical_short[len(fseq)]
        c_parts = [
            (p["part_name"], int(p["start_1based"]), int(p["end_1based"]), _classify_part_role(p["part_name"]))
            for p in c_obj["part_ledger"]
        ]
        scanned_records[sname] = _scan_record(
            sname, fname, fseq, c_parts, canonical_stored=c_obj["whole_donor_jaspar_6pwm_scans_by_pseudocount"]
        )

    # 2. Historical 2A-free Locus-3 comparators (DX-L3 3799 bp and L3-BF-B 4078 bp)
    arm1b_tbl = constructs[1]["arm1b_vs_arm1x_codon_coordinate_table"]
    challengers = next(v for k, v in arm1b_tbl.items() if k.startswith("single_variable_challenger_arms_"))
    sf_obj = next(v for k, v in challengers.items() if k.startswith("Locus3_ScarFree_"))
    bf_obj = next(v for k, v in challengers.items() if k.startswith("Locus3_BasalFloor_"))
    sf_seq = str(sf_obj["assembled_3799bp_spaced_donor_sequence"]).upper()
    bf_seq = str(bf_obj["l3_bfb_assembled_4078bp_pam_shielded_donor_sequence"]).upper()
    if sha256_str(sf_seq) != parents["L3_SCARFREE_3799"]["donor_sha256"]:
        raise ValueError("L3_SCARFREE_3799 SHA-256 mismatch in IIP-0027 6-PWM ledger")
    if sha256_str(bf_seq) != parents["L3_BFB_BASALFLOOR_4078"]["donor_sha256"]:
        raise ValueError("L3_BFB_BASALFLOOR_4078 SHA-256 mismatch in IIP-0027 6-PWM ledger")
    sf_parts = [
        ("CXCL10_HA_L_600bp", 1, 600, "homology_arm"),
        ("SERPINB9_TU_1262bp", 601, 1862, "non_promoter_cargo"),
        ("Pause_Spacer_82bp", 1863, 1944, "non_promoter_cargo"),
        ("Syn_5xISRE_minP_148bp", 1945, 2092, "declared_promoter_or_insulator"),
        ("PDL1_TU_1107bp", 2093, 3199, "non_promoter_cargo"),
        ("CXCL10_HA_R_600bp", 3200, 3799, "homology_arm"),
    ]
    bf_parts = _parse_part_breakdown(str(bf_obj["part_breakdown_l3_bfb_4078bp"]))
    scanned_records["L3_SCARFREE_3799"] = _scan_record(
        "L3_SCARFREE_3799", "Layer-2 materialized DX-L3 (3,799 bp)", sf_seq, sf_parts
    )
    scanned_records["L3_BFB_BASALFLOOR_4078"] = _scan_record(
        "L3_BFB_BASALFLOOR_4078", "Layer-2 materialized L3-BF-B (4,078 bp)", bf_seq, bf_parts
    )

    # Resolve the 53-bp direct repeat at 650-702 / 680-732 in L3-BF-B & c1 to Unit-1 declared promoter
    bf_repeats = longest_repeats(bf_seq)
    bf_longest_direct = bf_repeats["longest_direct_repeat_ge_12bp"]
    bf_unit1_prom = str(bf_obj["l3_bfb_hybrid_230bp_basalfloor_isre_nfkb_hpgk1_promoter_sequence"]).upper()
    if bf_seq[649:879] != bf_unit1_prom or (
        bf_longest_direct["length_bp"],
        bf_longest_direct["pos1_a"],
        bf_longest_direct["pos1_b"],
    ) != (53, 650, 680):
        raise ValueError("L3-BF-B 53-bp repeat attribution mismatch inside Unit-1 promoter")

    # 3. Staged DEC-105 Design-B comparators c1..c6
    dec105_fasta = REPO_ROOT / "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta"
    dec105_recs = _read_fasta_records(dec105_fasta)
    c1_seq_check = ""
    for idx, (fname, fseq, _fsha) in enumerate(dec105_recs, start=1):
        cid_short = f"DEC105_c{idx}"
        if idx == 1:
            c1_seq_check = fseq
        c_parts = sorted(
            [
                (
                    str(seg["segment_id"]),
                    int(occ["start_1based"]),
                    int(occ["end_1based"]),
                    _classify_part_role(str(seg["segment_id"])),
                )
                for seg in iip_0026_manifest["per_segment_provenance_ledger_24"]
                for occ in seg["occurrences"]
                if occ["construct"] == f"c{idx}"
            ],
            key=lambda x: x[1],
        )
        scanned_records[cid_short] = _scan_record(cid_short, fname, fseq, c_parts)

    # 4. IIP-0018 ARM1_L3_WT_PARENT_4078
    multimir_fasta = REPO_ROOT / "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta"
    arm1_name, arm1_seq, _arm1_sha = _read_fasta_records(multimir_fasta)[0]
    scanned_records["IIP0018_ARM1_L3_WT_PARENT_4078"] = _scan_record(
        "IIP0018_ARM1_L3_WT_PARENT_4078", arm1_name, arm1_seq, bf_parts
    )

    # 5. Canonical 145-bp AAV2 ITR (GenBank J01901.1 nt 1..145)
    scanned_records["AAV2_ITR_145BP_J01901_1_145"] = _scan_record(
        "AAV2_ITR_145BP_J01901_1_145",
        "GenBank J01901.1 nt 1..145 canonical 145-bp AAV2 ITR",
        AAV2_ITR_145BP_J01901_1_145_IIP0027,
        [("AAV2_ITR_145bp", 1, 145, "aav_itr")],
    )

    # Sanity invariants verified at build time
    two_a_free_keys = (
        "L3_SCARFREE_3799",
        "L3_BFB_BASALFLOOR_4078",
        "DEC105_c1",
        "DEC105_c2",
        "DEC105_c3",
        "DEC105_c4",
        "DEC105_c5",
        "DEC105_c6",
        "IIP0018_ARM1_L3_WT_PARENT_4078",
    )
    for k2a in two_a_free_keys:
        for pc_lbl in ("pseudocount_0p8_production", "pseudocount_0p5_comparator"):
            if scanned_records[k2a]["jaspar_6pwm_by_pseudocount"][pc_lbl]["non_promoter_cargo_significant_window_hits"] != 0:
                raise ValueError(f"Unexpected non-promoter cargo 6-PWM hit in 2A-free comparator {k2a} ({pc_lbl})")
    if scanned_records["AAV2_ITR_145BP_J01901_1_145"]["jaspar_6pwm_by_pseudocount"]["pseudocount_0p8_production"][
        "counts_window_merged_region6_total"
    ] != [0, 0, 0]:
        raise ValueError("Expected 0/0/0 6-PWM hits on 145-bp AAV2 ITR negative-sensitivity demonstration")

    return {
        "decision_id": "DEC-107",
        "contribution_id": "IIP-0027",
        "core_scoring_impact": "ZERO_LAYER1_SCORE_CHANGE_AND_ZERO_DONOR_SEQUENCE_CHANGE",
        "motif_count_stopping_rule_status": "REJECTED_DESCRIPTIVE_ANNOTATION_ONLY",
        "oq011_status": "OPEN_REQUIRES_RESTING_AND_STIMULATED_PROMOTER_OF_ORIGIN_5PRIME_RACE",
        "summary_findings": {
            "all_2a_free_cargo_hits_inside_declared_promoters_or_insulators": True,
            "aav2_itr_145bp_6pwm_counts_pc0p8": [0, 0, 0],
            "aav2_itr_145bp_proves_pwm_blind_to_rbe_initiation": True,
            "l3_canonical_4090_rela_minus_395_404_location": "CXCL10_HA_L_600bp (left homology arm, not inserted cargo)",
            "l3_canonical_4090_top_irf1_2796_2816_location": "WPREmut6_589bp (rel=0.9086, p_reg6=0.008588)",
            "l3_bfb_and_c1_53bp_direct_repeat_resolution": {
                "repeat_length_bp": 53,
                "pos1_a_1based": 650,
                "pos1_b_1based": 680,
                "end_a_1based": 702,
                "end_b_1based": 732,
                "overlap_bp": 23,
                "unit1_declared_promoter_bounds_1based": [650, 879],
                "unit1_declared_promoter_part_id": "Syn_3xISRE_2xNFkB_hPGK1_Sp1_basalfloor_230",
                "wholly_inside_declared_unit1_promoter": True,
                "identical_in_dec105_c1_650_879": c1_seq_check[649:879] == bf_unit1_prom,
            },
            "umi_statistical_floor_reconciliation": {
                "two_sided_95pct_cp_lt_0p10pct_exact_min_n_eff": 3688,
                "two_sided_95pct_cp_u95_at_3687_pct": round((1.0 - 0.025 ** (1.0 / 3687)) * 100.0, 6),
                "two_sided_95pct_cp_u95_at_3688_pct": round((1.0 - 0.025 ** (1.0 / 3688)) * 100.0, 6),
                "openislet_protocol_recovery_adjusted_floor_n_eff": 3689,
                "nominal_3700_at_90pct_recovery_effective_n": 3330,
                "nominal_3700_at_90pct_recovery_two_sided_u95_pct": round((1.0 - 0.025 ** (1.0 / 3330)) * 100.0, 5),
                "host_exon_90pct_tost_0p80_1p25_sets_cryptic_promoter_cap": False,
            },
        },
        "scanned_constructs_and_itr": scanned_records,
        "conditional_bio06_aav_itr_origin_rule": (
            "Whenever Readout 1 BIO-06 locus-specific junction sequencing documents retained AAV ITR DNA "
            "(Hanlon et al. 2019 PMID:31570731), promoter-of-origin 5'-RACE transcript attribution must test "
            "explicitly whether transcripts originate inside retained ITR sequence (Earley et al. 2020 PMID:31914802; "
            "Haberman et al. 2000 PMID:10954575; Flotte et al. 1993 PMID:7679117) rather than inferring silence or activity from DNA capture alone."
        ),
        "bibliographic_verification_notes": (
            "Pairs Han & Zhang 2002 (PMID:12370285, eIF4G cryptic promoter) with Lemp et al. 2012 (PMID:22618870, "
            "plasmid-origin cryptic transcription), Giannakis et al. 2003 (PMID:12951775, insert-matched negative control "
            "requirement for cryptic responsiveness), Hall et al. 2002 (PMID:12449375, AP-1-inducible cryptic promoter), "
            "Earley et al. 2020 (PMID:31914802, AAV ITR transcriptional start sites), Haberman et al. 2000 (PMID:10954575), "
            "Flotte et al. 1993 (PMID:7679117), and Anderson et al. 2026 (first author Anderson R, EMBO J 45(8):2420-2432, PMID:41840058). "
            "Archival indexing notes: Zhang et al. 2018 (first author Zhang C, BMC Biol 16(1):151, PMID:30593266), and print "
            "publication years are Chauhan et al. 2009 (PMID:19009237) and Seong et al. 2006 (PMID:16377218)."
        ),
        "primary_citations": [
            "PMID:31914802",
            "PMID:31570731",
            "PMID:10954575",
            "PMID:7679117",
            "PMID:12370285",
            "PMID:22618870",
            "PMID:12951775",
            "PMID:12449375",
            "PMID:41840058",
            "PMID:22101854",
        ],
    }


def scan_disjoint_inverted_repeats_with_mismatches(
    seq: str,
    *,
    min_k: int = 20,
    max_mismatches: int = 1,
    cluster_within_bp: Optional[int] = None,
) -> List[Dict[str, Any]]:
    """
    Exact scanner for all qualifying disjoint width-`min_k` inverted-repeat pairs
    with `<= max_mismatches` mismatches (IIP-0031; DEC-110).
    Validates strict ASCII `ACGTacgt` alphabet before uppercasing, supports `min_k >= 1`
    and arbitrary `max_mismatches >= 0` (using exact disjoint pair evaluation whenever
    `max_mismatches >= min_k`, and exact pigeonhole seed partitioning otherwise), and
    returns every exact disjoint `(pos1_a, pos1_b)` pair of width `min_k` together with
    its maximal ungapped disjoint extension `maximal_stem_bp` unless `cluster_within_bp`
    is explicitly supplied.
    """
    if not isinstance(seq, str):
        raise ValueError("Inverted-repeat scan sequence must be a string")
    if not all(ch in "ACGTacgt" for ch in seq):
        raise ValueError("Inverted-repeat scan sequence contains non-ACGT symbols")
    if type(min_k) is not int or min_k < 1:
        raise ValueError("min_k must be an integer >= 1")
    if type(max_mismatches) is not int or max_mismatches < 0:
        raise ValueError("max_mismatches must be an integer >= 0")
    if cluster_within_bp is not None and (type(cluster_within_bp) is not int or cluster_within_bp < 0):
        raise ValueError("cluster_within_bp must be None or an integer >= 0")
    seq_u = seq.upper()
    n = len(seq_u)
    if n < 2 * min_k:
        return []
    rc_map = {"A": "T", "C": "G", "G": "C", "T": "A"}
    n_chunks = max_mismatches + 1
    seed_k = min_k // n_chunks
    raw_hits: List[Tuple[int, int, int, int, str, str]] = []

    def _maximal_stem_from_pair(i0: int, j0: int, base_mm: int) -> int:
        # Extend antiparallel stem inward (right from i0+min_k, left from j0) and outward (left from i0, right from j0+min_k):
        i_lo, i_hi = i0, i0 + min_k
        j_lo, j_hi = j0, j0 + min_k
        cur_mm = base_mm
        while i_hi <= j_lo - 1:
            if seq_u[i_hi] != rc_map[seq_u[j_lo - 1]]:
                if cur_mm + 1 > max_mismatches:
                    break
                cur_mm += 1
            i_hi += 1
            j_lo -= 1
        while i_lo > 0 and j_hi < n:
            if seq_u[i_lo - 1] != rc_map[seq_u[j_hi]]:
                if cur_mm + 1 > max_mismatches:
                    break
                cur_mm += 1
            i_lo -= 1
            j_hi += 1
        return i_hi - i_lo

    if seed_k < 1:
        for i in range(n - 2 * min_k + 1):
            a = seq_u[i : i + min_k]
            for j in range(i + min_k, n - min_k + 1):
                b = seq_u[j : j + min_k]
                mm = sum(x != rc_map[y] for x, y in zip(a, reversed(b)))
                if mm <= max_mismatches:
                    raw_hits.append((i + 1, j + 1, mm, _maximal_stem_from_pair(i, j, mm), a, b))
    else:
        pos: Dict[str, List[int]] = {}
        for i in range(n - seed_k + 1):
            pos.setdefault(seq_u[i : i + seed_k], []).append(i)
        chunk_offsets = [c * seed_k for c in range(n_chunks - 1)] + [min_k - seed_k]
        seen_pairs: Set[Tuple[int, int]] = set()
        for i in range(n - 2 * min_k + 1):
            cand_js: Set[int] = set()
            for off in chunk_offsets:
                chunk = seq_u[i + off : i + off + seed_k]
                rc_chunk = revcomp(chunk)
                b_rel = min_k - off - seed_k
                for p in pos.get(rc_chunk, []):
                    j = p - b_rel
                    if j >= i + min_k and j + min_k <= n:
                        cand_js.add(j)
            a = seq_u[i : i + min_k]
            for j in sorted(cand_js):
                if (i, j) in seen_pairs:
                    continue
                b = seq_u[j : j + min_k]
                mm = sum(x != rc_map[y] for x, y in zip(a, reversed(b)))
                if mm <= max_mismatches:
                    seen_pairs.add((i, j))
                    raw_hits.append((i + 1, j + 1, mm, _maximal_stem_from_pair(i, j, mm), a, b))

    results: List[Dict[str, Any]] = []
    for p1, p2, mm, max_stem, a, b in raw_hits:
        if (
            cluster_within_bp is not None
            and results
            and abs(p1 - results[-1]["pos1_a"]) <= cluster_within_bp
            and abs(p2 - results[-1]["pos1_b"]) <= cluster_within_bp
        ):
            continue
        results.append({
            "length_bp": min_k,
            "maximal_stem_bp": max_stem,
            "mismatches": mm,
            "pos1_a": p1,
            "pos1_b": p2,
            "seq_a": a,
            "seq_b": b,
        })
    return results


_IIP0031_TRANSCRIPT_PINS = {
    "pvr_refseq_isoforms_4": {
        "NM_001135768.3": "2ef24fc0974fcb43bd4424146aa7a142621a92b8b77860e92830a7d57d16cff9",
        "NM_001135769.3": "9542fd4f187f2c5a604f50446a6152673717873a82b94f744a3b268809af5960",
        "NM_001135770.3": "419c3ac33f73fa4fab71d01ba0cceb42f5ee3273a682d635014a97b8a901a849",
        "NM_006505.5": "14a36f7386490c060695e1ec5cd588b4c9c07be5d71641bfe1888ca2bf56929a",
    },
    "cd276_refseq_isoforms_4": {
        "NM_001024736.2": "7a89c6a6555555531e2f8eff270ee62bd6ee93f90eb1b950ca97ba673baf65ce",
        "NM_001329628.2": "19ec2749d06fe9645e7fc55b6ac78401b6075c6864a93dd30458ee2539f245b8",
        "NM_001329629.2": "db51d99b1b5cb052b09c9c7f83f635afc484924f85b619aff6a1be4ed8666a03",
        "NM_025240.3": "0bd1628a649a1ca8a39cb5058dc07b0890a42707465fe314a24631f0089c98f5",
    },
}
_IIP0031_CHR16_2001BP_SHA256 = "ec47ca4d65be793a536354da3d81c3188c4021598f4cecee749e2ff2a89b5e36"
_IIP0031_DM1_80BP_SHA256 = "801f07cae8f29ec2c75d02cc1ce52e3728566d24d0595d4722a318dee0a097f3"
_IIP0031_CIITA_EXON5_200BP_SHA256 = "10c69c9dcafd39f2935f26a87a1283ef4dc4875ef259d77b1fef8e5ba4e82daa"
_IIP0031_CIITA_REFSEQ_PINS: Dict[str, Tuple[int, int, str, Tuple[Tuple[int, int], ...], str, str]] = {
    "NM_000246.4": (
        130, 3522, "aebd7a44ddee5e33c6b8e9ef6fc2a187ac3aaa48d8b3e7fe5a4ba0c85784f518",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 565), (566, 610), (611, 757), (758, 901), (902, 1066), (1067, 1135), (1136, 2786), (2787, 2945), (2946, 3017), (3018, 3098), (3099, 3191), (3192, 3278), (3279, 3362), (3363, 3446), (3447, 3544), (3545, 16061)),
        "variant_2_canonical_pIII_78bp_Ex5",
        "canonical pIII / FIII (exon1 1..181, 78-bp Ex5, N-term MRCLAP...)",
    ),
    "NM_001286402.1": (
        134, 3529, "841888c82eb9d941c1d3441d4094a04cceafd96eae0da7a4bbb47cf9b4f308f2",
        ((1, 185), (186, 332), (333, 428), (429, 491), (492, 572), (573, 617), (618, 764), (765, 908), (909, 1073), (1074, 1142), (1143, 2793), (2794, 2952), (2953, 3024), (3025, 3105), (3106, 3198), (3199, 3285), (3286, 3369), (3370, 3453), (3454, 3551), (3552, 4657)),
        "variant_1_alt_FIII_pIII_81bp_Ex5",
        "pIII / alternative FIII (exon1 1..185, 81-bp Ex5, N-term MRCLAP...)",
    ),
    "NM_001286403.2": (
        130, 1770, "154afe08df9fc8a285b78c76dfd0f43869b63451404aec24c16d7868b6de0a00",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 565), (566, 610), (611, 754), (755, 919), (920, 988), (989, 1193), (1194, 1265), (1266, 1346), (1347, 1439), (1440, 1526), (1527, 1610), (1611, 1694), (1695, 1792), (1793, 14309)),
        "variant_3_short_pIII_prefix_78bp_Ex5",
        "shorter pIII-prefix isoform (shares exon1 1..181 with NM_000246.4, 78-bp Ex5, 546 aa)",
    ),
    "NM_001379330.1": (
        130, 3378, "2bac24c75173978aea51384b27e53a22e69f15a1346903e2596790b4f8d8fea4",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 568), (569, 613), (614, 757), (758, 922), (923, 991), (992, 2642), (2643, 2801), (2802, 2873), (2874, 2954), (2955, 3047), (3048, 3134), (3135, 3218), (3219, 3302), (3303, 3400), (3401, 4679)),
        "variant_5_pIII_81bp_Ex5",
        "pIII-prefix variant 5 (exon1 1..181, 81-bp Ex5, 1,082 aa)",
    ),
    "NM_001379331.1": (
        130, 3375, "5ddf0bee290880d504973c271ffe81d164d1f158f054cc38bbb8058efb3e938f",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 565), (566, 610), (611, 754), (755, 919), (920, 988), (989, 2639), (2640, 2798), (2799, 2870), (2871, 2951), (2952, 3044), (3045, 3131), (3132, 3215), (3216, 3299), (3300, 3397), (3398, 4676)),
        "variant_6_pIII_78bp_Ex5",
        "pIII-prefix variant 6 (exon1 1..181, 78-bp Ex5, 1,081 aa)",
    ),
    "NM_001379332.1": (
        130, 3525, "6f7085648132bcfa8d4d98a11200c42b4ba7c89ef151d9d69d59714197717560",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 568), (569, 613), (614, 760), (761, 904), (905, 1069), (1070, 1138), (1139, 2789), (2790, 2948), (2949, 3020), (3021, 3101), (3102, 3194), (3195, 3281), (3282, 3365), (3366, 3449), (3450, 3547), (3548, 4826)),
        "variant_7_pIII_81bp_Ex5",
        "pIII-prefix variant 7 (exon1 1..181, 81-bp Ex5, 1,131 aa)",
    ),
    "NM_001379333.1": (
        130, 3522, "03a68ae89b34641207b0560b72af5cfc7f63fd8e1f70f29767ab4ff81d2e7b41",
        ((1, 181), (182, 328), (329, 424), (425, 487), (488, 565), (566, 610), (611, 757), (758, 901), (902, 1066), (1067, 1135), (1136, 2786), (2787, 2945), (2946, 3017), (3018, 3098), (3099, 3191), (3192, 3278), (3279, 3362), (3363, 3446), (3447, 3544), (3545, 4823)),
        "variant_8_pIII_78bp_Ex5",
        "pIII-prefix variant 8 (exon1 1..181, 78-bp Ex5, 1,130 aa)",
    ),
    "NM_001379334.1": (
        97, 3420, "5a809c6442135d48b01b84e83a263a20d654e61ed131091765b182ea05978aa7",
        ((1, 76), (77, 223), (224, 319), (320, 382), (383, 463), (464, 508), (509, 655), (656, 799), (800, 964), (965, 1033), (1034, 2684), (2685, 2843), (2844, 2915), (2916, 2996), (2997, 3089), (3090, 3176), (3177, 3260), (3261, 3344), (3345, 3442), (3443, 4721)),
        "variant_9_IFNg_pIV_81bp_Ex5",
        "IFN-gamma-inducible pIV / FIV (noncoding exon1 1..76, Exon-2 ATG N-term MELGPL..., 81-bp Ex5, 1,107 aa)",
    ),
}
_IIP0031_JASPAR_6PWM_PINS: Dict[str, Tuple[str, int, str, str]] = {
    "MA0050.2": ("IRF1", 21, "082e0a83f20a173eb3788790f18dcc8131c29349b24ca37a0ef8046b9e4fb37e", "24cab749fa45ac2bfc0fdd1b7ce02e7473e6ca5f190bedeaffe9e1b7314e367a"),
    "MA0079.5": ("SP1", 9, "3f688e30c538bf39cc39a1f9c52d3c661ec4fb0f6c0d507859206c4e3e3a96d0", "79c93a2a42b6b1bddf611e1531811171977d4be313ed291e73d300d8eaf3357e"),
    "MA0105.4": ("NFKB1", 13, "3d3c7718a9308d4fb70c4ad70abbcf79e8fc0ac688616b5206ae69608e7b39c5", "31592be2b4d4120b1d2de96ffc2600ccb4de69ef3bb9a99d141a773c13bd3f0e"),
    "MA0107.1": ("RELA", 10, "7a765b29b62589558b9195fae9e6e4a62d917839e9b73655ca6afc6b7cd1f5c6", "f810a450edefd1e38ce0e0f81348478285254707b529e8edb47a9ff0164c57bb"),
    "MA0137.3": ("STAT1", 11, "d1088b63cf03a4c891ec4799c891e70725330815f9c2fd817d3297935a8d38ac", "68abc7d51226ebca191d010f0b202e0f727b53e48cc431f93c0294cc382565a0"),
    "MA0139.1": ("CTCF", 19, "c750c526e1fd8d747a728a0f9c6a9efd17cedc684f4ee69a4354c6760be68967", "987a2fd393dc17e886e40d26757622c88b70dc3ecf82c52e8e38aafaedc1b335"),
}
_IIP0031_PREEXISTING_6_FASTA_SHA256: Dict[str, str] = {
    "data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta": "b5ba4e2b4bbbcc7d6cf1138975c5fae5c6ab074dda43973f071c671cd8cd1d88",
    "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta": "4bb20389773c76b2705031ba675487825dfbd94d920a692cde75b7d56af22aa4",
    "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta": "22df54a27ef3f68b646b63dc036b11f5a66a9fcadb50378dfb8057e108c79ffa",
    "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta": "a589ea72144cf1ad2cfa82e9b08c22e075746c63a9264e276a3bd4ec3f896854",
    "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta": "c7f54b824a73cf9d40247d4fd251cb5c28a8eca4a1530b9661284200bb4cbabc",
    "data/constructs/nm_021999_5_archival_mrna.fasta": "4a4cb15d0544884a62d86ebf4137c5284edad8210b6e32e74c2eb0aff005d13e",
}
_IIP0031_PROXY_4_FASTAS: Tuple[str, ...] = (
    "data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta",
    "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta",
    "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta",
    "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta",
)
_IIP0031_OI_15_PROXY_LENGTHS: Dict[str, int] = {
    "DesignA_L3_SERPINB9_PDL1_WPRE_bGH": 2890,
    "DesignA_L1_ARM1A_HLAE_CD47_WPRE_bGH": 2908,
    "DesignA_L1_ARM1B_HLAE_bGH": 1737,
    "DesignA_L1_ARM1B_CD47_SV40": 659,
    "DesignA_L4_iCasp9_SV40": 1322,
    "DesignB_c1_L5A_BFB_SYN6": 2599,
    "DesignB_c3_L5A_HUMAN": 2572,
    "DesignB_c5_L6_iCasp9": 1350,
    "DesignB_c5_L6_CD47": 687,
    "L3_ARM5_MultiMiR_SB9_PDL1": 2919,
    "S10_ASTAR_HLAE": 1752,
    "L2_V3_CFH_STP_GPI_CDS": 1083,
    "L2_V3_CD200_CDS": 837,
    "L2_V3_MANF_CDS": 549,
    "L2_V3_CCL22_CDS": 282,
}
_IIP0031_PARETO_REL = "data/extracted/islet1_combinatorial_pareto_and_ladder_v0.8.0.json"
_IIP0031_PARETO_SHA256 = "460ebc1939eb98b38627eaa7d6603c086e5a75c127fc1ddeced0d5a325305f40"
_IIP0031_HUMAN_22_REFSEQ_PINS: Dict[str, Tuple[str, int, int, str]] = {
    "CD46": ("NM_002389.4", 176, 1354, "5aaa0dc3b47b8378f2ee4b4c8a922314bb3d37bb8d2accfa4e6da3d31bc8ada7"),
    "CD47": ("NM_001777.4", 124, 1095, "4d0d4e7bb124fdc6a86d7cc09af5c601b3e59421a93bec2ebc026d8c4e857b58"),
    "CD55": ("NM_000574.5", 89, 1234, "69097f6406a43daeb14a3881a0b6d9c77629dd8b7eb2be579249d624a4933878"),
    "CD59": ("NM_203330.2", 278, 664, "9c93b1a9a67a85140769f2c09feb37725355a6066357cd54d177228a3fe1eaa7"),
    "CDH5": ("NM_001795.5", 88, 2442, "eca8977b9a0dd1164c16c9c2fd1dabced73e0a23d6f664ac5b23fe696f46bce6"),
    "CLEC16A": ("NM_015226.3", 155, 3316, "52b6a9f414e692606e5a6bf9ecdb32f3cc595e222a65182cad2d893931cf2fc0"),
    "DEXI": ("NM_014015.4", 464, 751, "127c13310e13ad969cf980f2aa6e016c45063b3023489035aafdf8e412382f78"),
    "GCG": ("NM_002054.5", 100, 642, "7e3860e8bf5ea697b2a2326a9a83dba62ee07439ba59b412034aa413a4e1199d"),
    "GCK": ("NM_000162.5", 487, 1884, "5d1a3f2f9bbc6b7f34e16e908406674a236ec2eff99d2169ea7fd22ccb2bd288"),
    "HLA-E": ("NM_005516.6", 24, 1100, "3bee2f46b3ee02931fac10809ad9423e5c59b155e79599a31d1b083a5a376869"),
    "INS": ("NM_000207.3", 60, 392, "2132509911c26572e7dfcaea140a3c893ab2cb6ec1d71cfe23b91fcf09ae4ff1"),
    "KDR": ("NM_002253.4", 303, 4373, "d073a219056b5d5a6ee14429142e863cb27e56e62b0fbd01856891f609c713e2"),
    "MAFA": ("NM_201589.4", 327, 1388, "f68563d4331e22ad4242bb8506b47a5d54ea2c68dffb03e5d07d2ef42fd6036e"),
    "NEUROD1": ("NM_002500.5", 100, 1170, "c2833f3f23f9c9c41d5c72e990d552264989a9de721b4b814ff69220007d61c4"),
    "NKX6-1": ("NM_006168.3", 1065, 2168, "d55a510ebcb2ab18806e881622a00b31ef6d6e94a2914df027761a6af42f2272"),
    "PCSK1": ("NM_000439.5", 207, 2468, "62593e784df126a9cdc48df003712b5f32b83213eaadb7e8a77b6b1c6d6b4df9"),
    "PDX1": ("NM_000209.4", 140, 991, "f08b47ded18ecba68fd30c0691895c5db3aa07db12eb172c30bc237c077150d5"),
    "PECAM1": ("NM_000442.5", 196, 2412, "f21e1e198379e7a6c99c567907319eb977e6c3679f8043e2e0a64607f509bada"),
    "PIGA": ("NM_002641.4", 86, 1540, "6fb573d0f9d3a1ef61c4435a223183faffc6bbd15a5c3f4c9b52520661dba6f4"),
    "PIGK": ("NM_005482.3", 29, 1216, "9e239db10fe98d3d7ca9050d16ace8e67f3dba57c6e08bb293bf72a4e5df23e4"),
    "SLC30A8": ("NM_173851.3", 334, 1443, "dfa4694f334ea6cade8390837f58735f5e49c5934fae93f33dc422e5c173c173"),
    "SOCS1": ("NM_003745.2", 177, 812, "a406261ebdfb581e9f57a897cc53137e63e3918755c85f5a21047cf47a33725a"),
}


def _verified_refseq_panel(bundle: dict, key: str) -> Dict[str, str]:
    expected = _IIP0031_TRANSCRIPT_PINS[key]
    records = bundle.get(key)
    if not isinstance(records, dict) or records.keys() != expected.keys():
        raise ValueError(f"{key} requires the exact {len(expected)} pinned accessions")

    verified = {}
    for accession, digest in expected.items():
        row = records[accession]
        sequence = row.get("mrna_sequence") if isinstance(row, dict) else None
        if not isinstance(sequence, str) or not sequence.strip():
            raise ValueError(f"{key} accession {accession} has no transcript sequence")
        sequence = sequence.upper()
        if row.get("mrna_sha256") != digest or sha256_str(sequence) != digest:
            raise ValueError(f"{key} accession {accession} SHA-256 mismatch")
        verified[accession] = sequence
    return verified


def _verified_22gene_refseq_panel(
    bundle: dict,
) -> Tuple[Dict[str, str], Dict[str, str], Dict[str, str], Dict[str, str]]:
    """
    Validate all 22 curated human RefSeq transcripts against pinned gene symbols,
    accessions, CDS start/end coordinates, SHA-256 digests, valid ORF structure
    (ATG..STOP with zero internal stops), and strictly nonempty 3'-UTR & CDS slices.
    Returns (utr3_by_gene, cds_by_gene, utr5_by_gene, full_mrna_by_gene).
    """
    raw_panel = bundle.get("human_22_gene_refseq_panel")
    if not isinstance(raw_panel, dict) or set(raw_panel.keys()) != set(_IIP0031_HUMAN_22_REFSEQ_PINS.keys()):
        raise ValueError("human_22_gene_refseq_panel requires the exact 22 pinned human gene entries")
    utr3_map: Dict[str, str] = {}
    cds_map: Dict[str, str] = {}
    utr5_map: Dict[str, str] = {}
    full_map: Dict[str, str] = {}
    for gsym, (exp_acc, exp_cs, exp_ce, exp_sha) in _IIP0031_HUMAN_22_REFSEQ_PINS.items():
        uobj = raw_panel[gsym]
        if not isinstance(uobj, dict):
            raise ValueError(f"22-gene panel entry {gsym} must be a dict")
        if uobj.get("accession") != exp_acc:
            raise ValueError(f"22-gene panel {gsym} accession mismatch: expected {exp_acc}, got {uobj.get('accession')!r}")
        raw_seq = uobj.get("mrna_sequence")
        if not isinstance(raw_seq, str) or not raw_seq.strip():
            raise ValueError(f"22-gene panel {gsym} missing mrna_sequence")
        m_seq = raw_seq.upper()
        if not set(m_seq).issubset({"A", "C", "G", "T"}):
            raise ValueError(f"22-gene panel {gsym} contains non-ACGT bases")
        if uobj.get("mrna_sha256") != exp_sha or sha256_str(m_seq) != exp_sha:
            raise ValueError(f"22-gene panel RefSeq {gsym} ({exp_acc}) SHA-256 mismatch")
        if "cds_start_1based" not in uobj or "cds_end_1based" not in uobj:
            raise ValueError(f"22-gene panel {gsym} ({exp_acc}) missing explicit cds_start_1based or cds_end_1based")
        cs_raw = uobj["cds_start_1based"]
        ce_raw = uobj["cds_end_1based"]
        if (
            type(cs_raw) is not int
            or type(ce_raw) is not int
            or cs_raw != exp_cs
            or ce_raw != exp_ce
            or not (1 <= cs_raw < ce_raw < len(m_seq))
            or (ce_raw - cs_raw + 1) % 3 != 0
        ):
            raise ValueError(f"22-gene panel {gsym} ({exp_acc}) invalid or out-of-range CDS coordinates ({cs_raw}, {ce_raw}) for length {len(m_seq)}")
        cds_slice = m_seq[cs_raw - 1 : ce_raw]
        utr3_slice = m_seq[ce_raw:]
        utr5_slice = m_seq[: cs_raw - 1]
        if len(cds_slice) < 6 or len(utr3_slice) < 1:
            raise ValueError(f"22-gene panel {gsym} ({exp_acc}) produced an empty CDS or 3'-UTR slice")
        if cds_slice[:3] != "ATG" or cds_slice[-3:] not in ("TAA", "TAG", "TGA"):
            raise ValueError(f"22-gene panel {gsym} ({exp_acc}) CDS does not start with ATG and end with a stop codon")
        if any(cds_slice[i : i + 3] in ("TAA", "TAG", "TGA") for i in range(0, len(cds_slice) - 3, 3)):
            raise ValueError(f"22-gene panel {gsym} ({exp_acc}) CDS contains an internal in-frame stop codon")
        utr3_map[gsym] = utr3_slice
        cds_map[gsym] = cds_slice
        utr5_map[gsym] = utr5_slice
        full_map[gsym] = m_seq
    return utr3_map, cds_map, utr5_map, full_map


def _parse_fa_bytes(raw_bytes: bytes, label: str = "FASTA") -> Dict[str, str]:
    try:
        fasta_text = raw_bytes.decode("utf-8")
    except UnicodeDecodeError as exc:
        raise ValueError(f"{label} is not valid UTF-8") from exc
    out_fa: Dict[str, str] = {}
    cid_cur: Optional[str] = None
    buf_cur: List[str] = []
    for ln in fasta_text.splitlines():
        s = ln.strip()
        if not s:
            continue
        if s.startswith(">"):
            if cid_cur is not None:
                raw_seq = "".join(buf_cur)
                if not raw_seq or not all(ch in "ACGTacgt" for ch in raw_seq):
                    raise ValueError(f"Empty or non-ACGT sequence in {label} record {cid_cur!r}")
                out_fa[cid_cur] = raw_seq.upper()
            tokens = s[1:].split()
            if not tokens:
                raise ValueError(f"Empty FASTA header in {label}")
            cid_cur = tokens[0]
            if cid_cur in out_fa:
                raise ValueError(f"Duplicate FASTA record header {cid_cur!r} in {label}")
            buf_cur = []
        else:
            if cid_cur is None:
                raise ValueError(f"Sequence data before first header in {label}")
            buf_cur.append(s)
    if cid_cur is not None:
        raw_seq = "".join(buf_cur)
        if not raw_seq or not all(ch in "ACGTacgt" for ch in raw_seq):
            raise ValueError(f"Empty or non-ACGT sequence in {label} record {cid_cur!r}")
        out_fa[cid_cur] = raw_seq.upper()
    if not out_fa:
        raise ValueError(f"Empty FASTA file: {label}")
    return out_fa


def _max_disjoint_dr(seq: str, max_k: int = 80) -> Tuple[int, Optional[Dict[str, Any]]]:
    n = len(seq)
    for k in range(min(max_k, n // 2), 0, -1):
        seen: Dict[str, int] = {}
        for i in range(n - k + 1):
            sub = seq[i : i + k]
            if sub in seen and seen[sub] + k <= i:
                return k, {"length_bp": k, "pos1_a": seen[sub] + 1, "pos1_b": i + 1, "sequence": sub}
            if sub not in seen:
                seen[sub] = i
    return 0, None


def _max_overlapping_dr(
    seq: str,
    max_k: int = 80,
    excluded_spans_0based: Tuple[Tuple[int, int], ...] = (),
) -> Tuple[int, Optional[Dict[str, Any]]]:
    n = len(seq)
    for k in range(min(max_k, n - 1), 0, -1):
        seen: Dict[str, List[int]] = {}
        for i in range(n - k + 1):
            sub = seq[i : i + k]
            for j0 in seen.get(sub, ()):
                if not any(
                    j0 >= lo and (j0 + k) <= hi and i >= lo and (i + k) <= hi
                    for (lo, hi) in excluded_spans_0based
                ):
                    return k, {"length_bp": k, "pos1_a": j0 + 1, "pos1_b": i + 1, "sequence": sub}
            seen.setdefault(sub, []).append(i)
    return 0, None


def _max_disjoint_ir(seq: str, max_k: int = 80) -> Tuple[int, Optional[Dict[str, Any]]]:
    n = len(seq)
    for k in range(min(max_k, n // 2), 0, -1):
        seen: Dict[str, int] = {}
        for i in range(n - k + 1):
            sub = seq[i : i + k]
            rc = revcomp(sub)
            if rc in seen and seen[rc] + k <= i:
                return k, {"length_bp": k, "pos1_a": seen[rc] + 1, "pos1_b": i + 1, "seq_a": rc, "seq_b": sub}
            if sub not in seen:
                seen[sub] = i
    return 0, None


def _count_disjoint_ir_ge_k(seq: str, min_k: int = 16) -> int:
    n = len(seq)
    if min_k < 1 or n < 2 * min_k:
        return 0
    pos: Dict[str, List[int]] = {}
    for i in range(n - min_k + 1):
        pos.setdefault(seq[i : i + min_k], []).append(i)
    cnt = 0
    for i in range(n - 2 * min_k + 1):
        rc_sub = revcomp(seq[i : i + min_k])
        if rc_sub in pos:
            cnt += sum(1 for j in pos[rc_sub] if j - i >= min_k)
    return cnt


def _scan_seeds(strand_s: str, targets: Dict[str, str]) -> Dict[str, Dict[str, int]]:
    if not isinstance(strand_s, str) or len(strand_s) < 8 or not all(ch in "ACGTacgt" for ch in strand_s):
        raise ValueError(f"Invalid RNAi strand sequence for seed scan: {strand_s!r}")
    strand_u = strand_s.upper()
    s7m8 = revcomp(strand_u[1:8])
    s8m = s7m8 + "A"
    s7a1 = revcomp(strand_u[1:7]) + "A"
    hits_d: Dict[str, Dict[str, int]] = {}
    for tk, ts in targets.items():
        if not isinstance(ts, str) or not all(ch in "ACGTacgt" for ch in ts):
            raise ValueError(f"Invalid target sequence for seed scan ({tk!r})")
        ts_u = ts.upper()
        nt = len(ts_u)
        c8 = sum(1 for i in range(max(0, nt - 7)) if ts_u[i : i + 8] == s8m)
        c7m8 = sum(1 for i in range(max(0, nt - 6)) if ts_u[i : i + 7] == s7m8)
        c7a1 = sum(1 for i in range(max(0, nt - 6)) if ts_u[i : i + 7] == s7a1)
        if c8 or c7m8 or c7a1:
            hits_d[tk] = {"8mer": c8, "7mer_m8": c7m8, "7mer_A1": c7a1}
    return hits_d


def build_locus2_ciita_modeb_comparators_v3_manifest(
    ref: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
    """
    Build and verify the Stage-0 Locus-2 CIITA Exon-5 Mode-B v3 research comparator manifest
    100% dynamically from data/constructs/islet1_locus2_ciita_modeb_comparators_v0.8.0.fasta,
    local OpenIslet construct FASTAs, and hash-pinned GRCh38/RefSeq reference sequences in
    data/raw/layer2_genomic_and_jaspar_reference.json (IIP-0031; DEC-110).
    """
    if ref is None:
        ref = json.loads(REF_PATH.read_text(encoding="utf-8"))
    ref_bundle = ref.get("iip0031_locus2_modeb_v3_reference_bundle") if isinstance(ref, dict) else None
    if not isinstance(ref_bundle, dict):
        raise ValueError("Missing iip0031_locus2_modeb_v3_reference_bundle in layer2_genomic_and_jaspar_reference.json")
    pvr_iso_map = _verified_refseq_panel(ref_bundle, "pvr_refseq_isoforms_4")
    cd276_iso_map = _verified_refseq_panel(ref_bundle, "cd276_refseq_isoforms_4")

    fasta_rel = "data/constructs/islet1_locus2_ciita_modeb_comparators_v0.8.0.fasta"
    fasta_path = REPO_ROOT / fasta_rel
    if not fasta_path.is_file():
        raise FileNotFoundError(f"Missing pinned Locus-2 v3 comparator FASTA: {fasta_path}")
    raw_bytes = fasta_path.read_bytes()
    file_sha256 = hashlib.sha256(raw_bytes).hexdigest()
    expected_file_sha256 = "25ffcb10e2bad77a4b34725c7eff0532990ebf7b80864cf7217d33f5ccbe5b6d"
    if file_sha256 != expected_file_sha256:
        raise ValueError(f"Locus-2 v3 FASTA SHA-256 mismatch: {file_sha256} != {expected_file_sha256}")

    records = _parse_fa_bytes(raw_bytes, fasta_rel)
    expected_order = (
        "L2_V3_CO_PRIMARY_CD200",
        "L2_V3_CO_PRIMARY_MANF",
        "L2_V3_DESIGN_B_CD200",
        "L2_V3_DESIGN_B_MANF",
        "L2_V3_ALT2_CCL22",
        "L2_V3_CTRL_NT_SCRAMBLE",
        "L2_V3_BARRIER_CHS4_250",
        "L2_V3_CD274P_ZERO_TATATA",
    )
    if tuple(records.keys()) != expected_order:
        raise ValueError(f"Unexpected Locus-2 v3 FASTA record order: {list(records.keys())}")

    # 1. Authenticate full 2,001-bp GRCh38 chr16 window & cross-verify 200/200 against canonical 200-bp window:
    chr16_obj = ref_bundle.get("grch38_chr16_ciita_exon5_2001bp")
    if not isinstance(chr16_obj, dict) or not isinstance(chr16_obj.get("sequence"), str):
        raise ValueError("Missing grch38_chr16_ciita_exon5_2001bp sequence")
    chr16_seq_raw = chr16_obj["sequence"]
    if not all(ch in "ACGTacgt" for ch in chr16_seq_raw):
        raise ValueError("GRCh38 chr16 2001-bp reference contains non-ACGT bases")
    chr16_seq = chr16_seq_raw.upper()
    if (
        len(chr16_seq) != 2001
        or chr16_obj.get("chrom") != "chr16"
        or type(chr16_obj.get("start_1based")) is not int
        or chr16_obj.get("start_1based") != 10898000
        or type(chr16_obj.get("end_1based")) is not int
        or chr16_obj.get("end_1based") != 10900000
        or type(chr16_obj.get("strand")) is not int
        or chr16_obj.get("strand") != 1
        or type(chr16_obj.get("length_bp")) is not int
        or chr16_obj.get("length_bp") != 2001
        or chr16_obj.get("region") != "GRCh38.p14:chr16:10898000-10900000:strand=+1"
        or chr16_obj.get("sha256") != _IIP0031_CHR16_2001BP_SHA256
        or sha256_str(chr16_seq) != _IIP0031_CHR16_2001BP_SHA256
    ):
        raise ValueError("GRCh38 chr16 2001-bp reference SHA-256, length, or coordinate metadata mismatch")

    outer_elems = ref.get("ensembl_verified_homology_arms_and_elements") if isinstance(ref, dict) else None
    w200_obj = outer_elems.get("CIITA_pan_isoform_exon5_window_200bp") if isinstance(outer_elems, dict) else None
    if not isinstance(w200_obj, dict) or not isinstance(w200_obj.get("sequence"), str):
        raise ValueError("Missing or malformed CIITA_pan_isoform_exon5_window_200bp in ensembl_verified_homology_arms_and_elements")
    w200_raw = w200_obj["sequence"]
    if not all(ch in "ACGTacgt" for ch in w200_raw):
        raise ValueError("CIITA_pan_isoform_exon5_window_200bp contains non-ACGT bases")
    w200_pinned = w200_raw.upper()
    if (
        len(w200_pinned) != 200
        or w200_obj.get("chrom") != "chr16"
        or type(w200_obj.get("start_1based")) is not int
        or w200_obj.get("start_1based") != 10898880
        or type(w200_obj.get("end_1based")) is not int
        or w200_obj.get("end_1based") != 10899079
        or type(w200_obj.get("strand")) is not int
        or w200_obj.get("strand") != 1
        or type(w200_obj.get("length_bp")) is not int
        or w200_obj.get("length_bp") != 200
        or w200_obj.get("sha256") != _IIP0031_CIITA_EXON5_200BP_SHA256
        or sha256_str(w200_pinned) != _IIP0031_CIITA_EXON5_200BP_SHA256
    ):
        raise ValueError("CIITA_pan_isoform_exon5_window_200bp SHA-256 or coordinate metadata mismatch")
    if chr16_seq[10898880 - 10898000 : 10899079 - 10898000 + 1] != w200_pinned:
        raise ValueError("GRCh38 chr16 2001-bp slice disagrees with pinned CIITA_pan_isoform_exon5_window_200bp")

    dm1_obj = ref_bundle.get("grch38_chr19_dm1_ctcf1_80bp")
    if not isinstance(dm1_obj, dict) or not isinstance(dm1_obj.get("sequence"), str):
        raise ValueError("Missing grch38_chr19_dm1_ctcf1_80bp sequence")
    dm1_raw = dm1_obj["sequence"]
    if not all(ch in "ACGTacgt" for ch in dm1_raw):
        raise ValueError("GRCh38 chr19 DM1 CTCF1 80-bp reference contains non-ACGT bases")
    dm1_seq = dm1_raw.upper()
    if (
        len(dm1_seq) != 80
        or dm1_obj.get("chrom") != "chr19"
        or type(dm1_obj.get("start_1based")) is not int
        or dm1_obj.get("start_1based") != 45770299
        or type(dm1_obj.get("end_1based")) is not int
        or dm1_obj.get("end_1based") != 45770378
        or type(dm1_obj.get("strand")) is not int
        or dm1_obj.get("strand") != 1
        or type(dm1_obj.get("length_bp")) is not int
        or dm1_obj.get("length_bp") != 80
        or dm1_obj.get("region") != "GRCh38.p14:chr19:45770299-45770378:strand=+1"
        or dm1_obj.get("sha256") != _IIP0031_DM1_80BP_SHA256
        or sha256_str(dm1_seq) != _IIP0031_DM1_80BP_SHA256
    ):
        raise ValueError("GRCh38 chr19 DM1 CTCF1 80-bp reference SHA-256 or coordinate metadata mismatch")

    v3_ha_bp = 375
    ha_l_ref = chr16_seq[(10898967 - 10898000 + 1) - v3_ha_bp : 10898967 - 10898000 + 1]
    ha_r_wt_ref = chr16_seq[10898968 - 10898000 : (10898968 - 10898000) + v3_ha_bp]
    flank_up_300 = chr16_seq[(10898967 - 10898000 + 1) - v3_ha_bp - 300 : (10898967 - 10898000 + 1) - v3_ha_bp]
    flank_dn_300 = chr16_seq[(10898968 - 10898000) + v3_ha_bp : (10898968 - 10898000) + v3_ha_bp + 300]
    native_ir_18bp_excluded = chr16_seq[10898566 - 10898000 : 10898583 - 10898000 + 1]
    if revcomp(native_ir_18bp_excluded) not in ha_l_ref:
        raise ValueError("Expected native 18-bp HA_L inverted-repeat partner verification failed")

    canonical_shield_154 = (
        "AATAAAAGATCTTTATTTTCATTAGATCTGTGTGTTGGTTTTTTGTGTG"
        + "CTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCA"
        + "CTGGAGGGGCTGGAGGGGCTGGAGGGGCTGGAGGGGCACTGGAGGGGCTGGAGGGGCTGGAGGGG"
    )

    def _kmers_aa(prot: str, sizes: Tuple[int, ...]) -> set[str]:
        out_k: set[str] = set()
        for sz in sizes:
            for idx_k in range(max(0, len(prot) - sz + 1)):
                out_k.add(prot[idx_k : idx_k + sz])
        return out_k

    # 2. Authenticate all 8 curated human CIITA NM_* RefSeq transcripts from reference bundle:
    ex5_78bp = chr16_seq[10898925 - 10898000 : 10899002 - 10898000 + 1]
    cut_off_ex5 = 10898967 - 10898925 + 1  # 43 nt of constitutive 78-bp Exon-5 core in HA_L
    expected_ciita_accs = (
        "NM_001286402.1",
        "NM_000246.4",
        "NM_001286403.2",
        "NM_001379330.1",
        "NM_001379331.1",
        "NM_001379332.1",
        "NM_001379333.1",
        "NM_001379334.1",
    )
    ciita_iso_bundle = ref_bundle.get("ciita_refseq_isoforms_8")
    if (
        not isinstance(ciita_iso_bundle, dict)
        or len(ciita_iso_bundle) != 8
        or set(ciita_iso_bundle.keys()) != set(expected_ciita_accs)
    ):
        got_n = len(ciita_iso_bundle) if isinstance(ciita_iso_bundle, dict) else 0
        raise ValueError(
            f"Expected exact 8 curated human CIITA RefSeq isoforms ({list(expected_ciita_accs)}), got {got_n}"
        )
    ciita_iso_verified: Dict[str, Dict[str, Any]] = {}
    for acc_c, rec_c in ciita_iso_bundle.items():
        if not isinstance(rec_c, dict) or not isinstance(rec_c.get("mrna_sequence"), str):
            raise ValueError(f"CIITA RefSeq {acc_c} missing mrna_sequence")
        mrna_raw_c = rec_c["mrna_sequence"]
        if not mrna_raw_c or not all(ch in "ACGTacgt" for ch in mrna_raw_c):
            raise ValueError(f"CIITA RefSeq {acc_c} empty or non-ACGT mrna_sequence")
        mrna_c = mrna_raw_c.upper()
        exp_cs_c, exp_ce_c, exp_sha_c, exp_exons_c, exp_iso_key_c, exp_prom_map_c = _IIP0031_CIITA_REFSEQ_PINS[acc_c]
        if rec_c.get("mrna_sha256") != exp_sha_c or sha256_str(mrna_c) != exp_sha_c:
            raise ValueError(f"CIITA RefSeq {acc_c} SHA-256 mismatch")
        cs_c, ce_c = rec_c.get("cds_start_1based"), rec_c.get("cds_end_1based")
        if type(cs_c) is not int or type(ce_c) is not int or cs_c != exp_cs_c or ce_c != exp_ce_c:
            raise ValueError(f"CIITA RefSeq {acc_c} CDS coordinate mismatch")
        iso_key_c = rec_c.get("iso_key")
        prom_map_c = rec_c.get("promoter_first_exon_mapping")
        if (
            not isinstance(iso_key_c, str)
            or iso_key_c != exp_iso_key_c
            or not isinstance(prom_map_c, str)
            or prom_map_c != exp_prom_map_c
        ):
            raise ValueError(f"CIITA RefSeq {acc_c} iso_key or promoter_first_exon_mapping mismatch")
        exons_raw_c = rec_c.get("exons_1based")
        if not isinstance(exons_raw_c, list) or not exons_raw_c:
            raise ValueError(f"CIITA RefSeq {acc_c} missing or empty exons_1based")
        parsed_exons_c: List[Tuple[int, int]] = []
        expected_next_start = 1
        for pair_ex in exons_raw_c:
            if (
                not isinstance(pair_ex, (list, tuple))
                or len(pair_ex) != 2
                or type(pair_ex[0]) is not int
                or type(pair_ex[1]) is not int
            ):
                raise ValueError(f"CIITA RefSeq {acc_c} malformed exon interval {pair_ex!r}")
            es_i, ee_i = pair_ex[0], pair_ex[1]
            if es_i != expected_next_start or ee_i < es_i or ee_i > len(mrna_c):
                raise ValueError(f"CIITA RefSeq {acc_c} non-contiguous or out-of-range exon interval [{es_i}, {ee_i}]")
            parsed_exons_c.append((es_i, ee_i))
            expected_next_start = ee_i + 1
        if expected_next_start - 1 != len(mrna_c) or tuple(parsed_exons_c) != exp_exons_c:
            raise ValueError(f"CIITA RefSeq {acc_c} exons_1based mismatch against pinned RefSeq exon coordinates")
        ex5_pos1 = mrna_c.find(ex5_78bp) + 1
        if ex5_pos1 <= 0:
            raise ValueError(f"Constitutive Exon-5 78-bp core not found in {acc_c}")
        ex5_end1 = ex5_pos1 + len(ex5_78bp) - 1
        matching_exons = [
            (ei, es_i, ee_i, ee_i - es_i + 1)
            for ei, (es_i, ee_i) in enumerate(parsed_exons_c, 1)
            if es_i <= ex5_pos1 and ex5_end1 <= ee_i
        ]
        if len(matching_exons) != 1:
            raise ValueError(f"CIITA RefSeq {acc_c} Exon-5 core [{ex5_pos1}, {ex5_end1}] not wholly contained in a single exon")
        ex_hit = matching_exons[0]
        sp_start = (ex_hit[1] - cs_c) % 3
        sp_end = (ex_hit[2] - cs_c + 1) % 3
        if sp_start != 1 or sp_end != 1:
            raise ValueError(f"Unexpected Exon-5 splice phase on {acc_c}: {sp_start}->{sp_end}")
        cds_seq_c = mrna_c[cs_c - 1 : ce_c]
        native_aa_c = translate_dna(cds_seq_c)
        if native_aa_c.endswith("*"):
            native_aa_c = native_aa_c[:-1]
        ciita_iso_verified[acc_c] = {
            "iso_key": iso_key_c,
            "promoter_first_exon_mapping": prom_map_c,
            "exon5_index_in_transcript": ex_hit[0],
            "exon5_length_bp": ex_hit[3],
            "exon5_splice_phase": f"{sp_start}->{sp_end}",
            "cds_before_ex5_core": mrna_c[cs_c - 1 : ex5_pos1 - 1],
            "native_aa": native_aa_c,
        }

    # Verify canonical cHS4-80 vs cHS4-250 combined length-and-sequence diff directly on disk:
    chs4_80_slice = records["L2_V3_CO_PRIMARY_CD200"][1685:1765]
    chs4_250_slice = records["L2_V3_BARRIER_CHS4_250"][1685:1935]
    best_mm, best_off = min(
        ((sum(a != b for a, b in zip(chs4_80_slice, chs4_250_slice[i : i + 80])), i) for i in range(len(chs4_250_slice) - 79))
    )
    chs4_diffs = [
        {
            "chs4_250_pos_1based": best_off + j + 1,
            "chs4_80_pos_1based": j + 1,
            "u78775_2_pos_1based": best_off + j + 8,
            "base_in_80bp": chs4_80_slice[j],
            "base_in_250bp": chs4_250_slice[best_off + j],
        }
        for j in range(80)
        if chs4_80_slice[j] != chs4_250_slice[best_off + j]
    ]
    if best_mm != 2 or len(chs4_diffs) != 2:
        raise ValueError(f"Expected 2-bp U78775.2 C79T/C80A diff between cHS4-80 and cHS4-250, got {chs4_diffs}")

    sv40_sig = "AACTTGTTTATTGCAGCTTATAATGGTTACAAATAAAGCAATAGCATCACAAATTTCACAAATAAAGCATTTTTTTCACTGC"
    bgh_sig = "CGACTGTGCCTTCTAGTTGCCAGCCATCTGTTGTTTGCCCCTCCCCCGTGCCTTCCTTGACCCTGGAAGGTGCCACTCCCAC"
    two_a_sig = "GGAAGCGGAGCTACTAACTTCAGCCTGCTGAAGCAGGCTGGAGACGTGGAGGAGAACCCTGGACCT"

    pwms_map = ref.get("jaspar_pwms") if isinstance(ref, dict) else None
    if not isinstance(pwms_map, dict) or set(pwms_map.keys()) != set(_IIP0031_JASPAR_6PWM_PINS.keys()):
        raise ValueError(
            f"Missing, incomplete, or unpinned 6-PWM JASPAR reference map in layer2_genomic_and_jaspar_reference.json "
            f"(expected exact keys {sorted(_IIP0031_JASPAR_6PWM_PINS.keys())}, got {sorted(pwms_map.keys()) if isinstance(pwms_map, dict) else None})"
        )
    for _mid_chk, (_exp_tf, _exp_len, _exp_pwm_sha, _exp_pfm_sha) in _IIP0031_JASPAR_6PWM_PINS.items():
        _ment_chk = pwms_map[_mid_chk]
        if not isinstance(_ment_chk, dict):
            raise ValueError(f"Malformed JASPAR PWM entry for {_mid_chk}")
        _l2p = _ment_chk.get("log2_odds_pwm")
        _pfm = _ment_chk.get("pfm_counts")
        _mlen = _ment_chk.get("length")
        if (
            _ment_chk.get("matrix_id") != _mid_chk
            or _ment_chk.get("tf_name") != _exp_tf
            or type(_mlen) is not int
            or _mlen != _exp_len
            or not isinstance(_l2p, dict)
            or set(_l2p.keys()) != {"A", "C", "G", "T"}
            or any(
                not isinstance(_l2p[_b], list)
                or len(_l2p[_b]) != _exp_len
                or any(not _is_finite_real(_v) for _v in _l2p[_b])
                for _b in ("A", "C", "G", "T")
            )
            or not isinstance(_pfm, dict)
            or set(_pfm.keys()) != {"A", "C", "G", "T"}
            or any(
                not isinstance(_pfm[_b], list)
                or len(_pfm[_b]) != _exp_len
                or any(not _is_finite_real(_v) or float(_v) < 0.0 for _v in _pfm[_b])
                for _b in ("A", "C", "G", "T")
            )
        ):
            raise ValueError(f"Corrupted, unauthenticated, or non-finite JASPAR PWM/PFM entry for {_mid_chk}")
        _obs_pwm_sha = sha256_str(json.dumps(_l2p, sort_keys=True, separators=(",", ":")))
        _obs_pfm_sha = sha256_str(json.dumps(_pfm, sort_keys=True))
        if (
            _ment_chk.get("pwm_matrix_sha256") != _exp_pwm_sha
            or _obs_pwm_sha != _exp_pwm_sha
            or _ment_chk.get("pfm_counts_sha256") != _exp_pfm_sha
            or _obs_pfm_sha != _exp_pfm_sha
        ):
            raise ValueError(f"JASPAR PWM/PFM SHA-256 digest mismatch against pinned reference for {_mid_chk}")
    n_pwms = len(pwms_map)
    utr22_3utrs, utr22_cds, utr22_5utrs, utr22_full = _verified_22gene_refseq_panel(ref_bundle)

    verified_preexisting_fastas: Dict[str, str] = {}
    parsed_proxy_fastas: Dict[str, Dict[str, str]] = {}
    for rel_fa, exp_fa_sha in _IIP0031_PREEXISTING_6_FASTA_SHA256.items():
        fa_p = REPO_ROOT / rel_fa
        is_required_proxy = rel_fa in _IIP0031_PROXY_4_FASTAS
        if is_required_proxy and not fa_p.is_file():
            raise ValueError(f"Missing or non-regular required canonical proxy FASTA: {fa_p}")
        if fa_p.exists():
            if not fa_p.is_file():
                raise ValueError(f"Non-regular canonical FASTA path: {fa_p}")
            fa_bytes = fa_p.read_bytes()
            obs_fa_sha = hashlib.sha256(fa_bytes).hexdigest()
            if obs_fa_sha != exp_fa_sha:
                raise ValueError(f"Canonical FASTA SHA-256 mismatch for {rel_fa}: {obs_fa_sha} != {exp_fa_sha}")
            parsed_map = _parse_fa_bytes(fa_bytes, rel_fa)
            verified_preexisting_fastas[rel_fa] = obs_fa_sha
            if is_required_proxy:
                parsed_proxy_fastas[rel_fa] = parsed_map

    canonical_fastas_untouched = len(verified_preexisting_fastas) == len(_IIP0031_PREEXISTING_6_FASTA_SHA256)

    pareto_path = REPO_ROOT / _IIP0031_PARETO_REL
    layer1_pareto_verified = False
    layer1_pareto_sha256: Optional[str] = None
    layer1_score_delta_pp: Optional[float] = None
    if pareto_path.exists():
        if not pareto_path.is_file():
            raise ValueError(f"Non-regular Layer-1 Pareto artifact path: {pareto_path}")
        pareto_bytes = pareto_path.read_bytes()
        obs_pareto_sha = hashlib.sha256(pareto_bytes).hexdigest()
        if obs_pareto_sha != _IIP0031_PARETO_SHA256:
            raise ValueError(
                f"Layer-1 Pareto artifact SHA-256 mismatch for {_IIP0031_PARETO_REL}: "
                f"{obs_pareto_sha} != {_IIP0031_PARETO_SHA256}"
            )
        layer1_pareto_verified = True
        layer1_pareto_sha256 = obs_pareto_sha
        layer1_score_delta_pp = 0.0

    construct_entries: List[Dict[str, Any]] = []
    ciita_isoform_summary_by_acc: Dict[str, Dict[str, Any]] = {}
    extracted_unit2_cds: Dict[str, str] = {}
    extracted_cfh_cds: Optional[str] = None

    for cid in expected_order:
        seq = records[cid]
        dlen = len(seq)
        # Dynamic full 2x375-bp arm alignment & PAM-shield verification against GRCh38 chr16:
        ha_l_obs = seq[:v3_ha_bp]
        ha_r_obs = seq[-v3_ha_bp:]
        ha_l_mm = sum(a != b for a, b in zip(ha_l_obs, ha_l_ref))
        ha_r_diffs = [
            {"offset0_in_ha_r": j, "chr16_pos_1based": 10898968 + j, "ref_base": ha_r_wt_ref[j], "donor_base": ha_r_obs[j]}
            for j in range(v3_ha_bp)
            if ha_r_obs[j] != ha_r_wt_ref[j]
        ]
        if ha_l_mm != 0 or [d["chr16_pos_1based"] for d in ha_r_diffs] != [10898988, 10898989] or [d["donor_base"] for d in ha_r_diffs] != ["C", "C"]:
            raise ValueError(f"Full 375-bp arm GRCh38 alignment failed on {cid}: ha_l_mm={ha_l_mm}, ha_r_diffs={ha_r_diffs}")
        if seq[v3_ha_bp + 12 : v3_ha_bp + 166] != canonical_shield_154:
            raise ValueError(f"Canonical 154-bp shield mismatch on {cid}")
        if revcomp(seq[-v3_ha_bp - 80 : -v3_ha_bp]) != dm1_seq:
            raise ValueError(f"Right-hand 80-bp DM1 CTCF1 mismatch on {cid}")

        has_intron = cid not in ("L2_V3_DESIGN_B_CD200", "L2_V3_DESIGN_B_MANF")
        prom2_len = 250 if cid == "L2_V3_CD274P_ZERO_TATATA" else 148
        mid_ins_len = 250 if cid == "L2_V3_BARRIER_CHS4_250" else 80
        cfh_cds_slice = seq[dlen - 1688 : dlen - 605]
        if extracted_cfh_cds is None:
            extracted_cfh_cds = cfh_cds_slice
        elif extracted_cfh_cds != cfh_cds_slice:
            raise ValueError(f"CFH-STP-GPI CDS mismatch across donors on {cid}")
        eef_start0 = (dlen - 2247) if has_intron else (dlen - 1927)
        u2_cds_start0 = 550 + prom2_len
        u2_cds_end0 = eef_start0 - mid_ins_len - 150
        u2_cds_slice = seq[u2_cds_start0:u2_cds_end0]
        if "CD200" in cid or cid in ("L2_V3_CTRL_NT_SCRAMBLE", "L2_V3_BARRIER_CHS4_250", "L2_V3_CD274P_ZERO_TATATA"):
            extracted_unit2_cds["CD200"] = u2_cds_slice
        elif "MANF" in cid:
            extracted_unit2_cds["MANF"] = u2_cds_slice
        elif "CCL22" in cid:
            extracted_unit2_cds["CCL22"] = u2_cds_slice

        # Dynamic repeat/IR scans (including max overlapping DR outside canonical shield & Syn_5xISRE tandems):
        disj_dr_bp, disj_dr_info = _max_disjoint_dr(seq)
        ov_dr_bp, ov_dr_info = _max_overlapping_dr(seq)
        canonical_tandem_spans = ((387, 541), (541, 541 + prom2_len)) if cid != "L2_V3_CD274P_ZERO_TATATA" else ((387, 541),)
        ov_outside_bp, _ = _max_overlapping_dr(seq, excluded_spans_0based=canonical_tandem_spans)
        disj_ir_bp, disj_ir_info = _max_disjoint_ir(seq)
        ir_ge16_cnt = _count_disjoint_ir_ge_k(seq, min_k=16)
        near_ir_hits = scan_disjoint_inverted_repeats_with_mismatches(seq, min_k=20, max_mismatches=1)
        if disj_dr_bp >= 30 or disj_ir_bp >= 16 or ir_ge16_cnt != 0 or len(near_ir_hits) != 0:
            raise ValueError(
                f"Locus-2 v3 repeat invariant failed on {cid}: disj_dr={disj_dr_bp}, disj_ir={disj_ir_bp}, "
                f"ir_ge16={ir_ge16_cnt}, near_ir_ge20_le1mm={len(near_ir_hits)}"
            )
        t20_cnt = seq.count("T" * 20)
        sv40_cnt = seq.count(sv40_sig)
        bgh_cnt = seq.count(bgh_sig)
        two_a_cnt = seq.count(two_a_sig)
        if t20_cnt or sv40_cnt or bgh_cnt or two_a_cnt:
            raise ValueError(f"Forbidden motif (T20/SV40pA/bGH/2A) found in {cid}")

        # Dynamic isolated vs integrated (chr16 + 2x300-bp flanks) two-strand splice parity:
        sp_iso = scan_donors_and_acceptors_both_strands(seq, cargo_bounds_1based=(v3_ha_bp + 1, dlen - v3_ha_bp))
        sp_int = scan_donors_and_acceptors_both_strands(
            flank_up_300 + seq + flank_dn_300,
            cargo_bounds_1based=(300 + v3_ha_bp + 1, 300 + dlen - v3_ha_bp),
        )
        iso_sp_counts = {
            "plus_donors": int(sp_iso["cargo_donors_plus_strand"]),
            "minus_donors": int(sp_iso["cargo_donors_minus_strand"]),
            "plus_acceptors": sum(1 for a in sp_iso["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "+"),
            "minus_acceptors": sum(1 for a in sp_iso["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "-"),
        }
        int_sp_counts = {
            "plus_donors": int(sp_int["cargo_donors_plus_strand"]),
            "minus_donors": int(sp_int["cargo_donors_minus_strand"]),
            "plus_acceptors": sum(1 for a in sp_int["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "+"),
            "minus_acceptors": sum(1 for a in sp_int["acceptors"] if a["in_cargo"] and a["strand_relative_to_input"] == "-"),
        }
        if iso_sp_counts != int_sp_counts:
            raise ValueError(f"Donor vs integrated chr16 splice parity failed on {cid}: {iso_sp_counts} != {int_sp_counts}")

        # Dynamic 8-isoform CIITA Exon-5 knock-in translation & chimeric k-mer census:
        for acc_c, irec in ciita_iso_verified.items():
            chim_dna = irec["cds_before_ex5_core"] + seq[v3_ha_bp - cut_off_ex5 :]
            aas_c: List[str] = []
            stop_cod = ""
            stop_pos1 = -1
            for i_cod in range(0, len(chim_dna) - 2, 3):
                cod = chim_dna[i_cod : i_cod + 3]
                aa_c = GENETIC_CODE[cod]
                if aa_c == "*":
                    stop_cod = cod
                    stop_pos1 = v3_ha_bp - cut_off_ex5 + (i_cod + 3 - len(irec["cds_before_ex5_core"]))
                    break
                aas_c.append(aa_c)
            trunc_aa_c = "".join(aas_c)
            nat_aa_c = irec["native_aa"]
            ki_nov_8_11 = len(_kmers_aa(trunc_aa_c, (8, 9, 10, 11)) - _kmers_aa(nat_aa_c, (8, 9, 10, 11)))
            ki_nov_15 = len(_kmers_aa(trunc_aa_c, (15,)) - _kmers_aa(nat_aa_c, (15,)))
            if trunc_aa_c != nat_aa_c[: len(trunc_aa_c)] or stop_cod != "TGA" or stop_pos1 != (v3_ha_bp + 4) or ki_nov_8_11 != 0 or ki_nov_15 != 0:
                raise ValueError(f"CIITA isoform {acc_c} junction translation failed on {cid}")
            if cid == "L2_V3_CO_PRIMARY_CD200":
                ciita_isoform_summary_by_acc[acc_c] = {
                    "iso_key": irec["iso_key"],
                    "promoter_first_exon_mapping": irec["promoter_first_exon_mapping"],
                    "exon5_index_in_transcript": irec["exon5_index_in_transcript"],
                    "exon5_length_bp": irec["exon5_length_bp"],
                    "exon5_splice_phase": irec["exon5_splice_phase"],
                    "native_aa_len": len(nat_aa_c),
                    "truncated_aa_len": len(trunc_aa_c),
                    "stop_codon": stop_cod,
                    "stop_donor_pos_1based": stop_pos1,
                    "knockin_created_non_native_8_11mers": ki_nov_8_11,
                    "knockin_created_non_native_15mers": ki_nov_15,
                }

        homos_ge7 = [len(m.group(0)) for m in re.finditer(r"(A{7,}|C{7,}|G{7,}|T{7,})", seq)]
        u2_prom_slice = seq[541 : 541 + prom2_len]
        tatata_cnt = u2_prom_slice.count("TATATAATGG")

        pwm_summary: Dict[str, Any] = {}
        if pwms_map:
            total_win = 0
            total_merged = 0
            total_reg6 = 0
            u2_prom_span = (542, 541 + prom2_len)
            eef_prom_span = (eef_start0 + 1, eef_start0 + 230)
            chs4_span = (eef_start0 - mid_ins_len + 1, eef_start0)
            dm1_span = (dlen - v3_ha_bp - 80 + 1, dlen - v3_ha_bp)
            wholly_non_prom_6pwm = 0
            boundary_irf1_hits: List[Dict[str, Any]] = []
            ctcf_ins_hits: Dict[str, Dict[str, Any]] = {}
            exact_family_tests = sum(max(0, 2 * (dlen - int(m["length"]) + 1)) for m in pwms_map.values())
            for mid, pentry in pwms_map.items():
                sc = scan_jaspar_pwm(
                    seq,
                    pentry,
                    top_k=30,
                    n_matrices_in_scan=n_pwms,
                    actual_family_total_tests=exact_family_tests,
                )
                total_win += int(sc["significant_window_hits_rel0p80_bonferroni_0p05"])
                total_merged += int(sc["distinct_non_overlapping_merged_sites_rel0p80_bonferroni_0p05"])
                total_reg6 += int(sc["significant_hits_rel0p80_region_wide_bonferroni_0p05"])
                for h_p in sc["all_significant_hits"]:
                    s1 = int(h_p["start_1based_in_window"])
                    e1 = int(h_p["end_1based_in_window"])
                    ov_u2 = not (e1 < u2_prom_span[0] or s1 > u2_prom_span[1])
                    in_u2 = (s1 >= u2_prom_span[0] and e1 <= u2_prom_span[1])
                    ov_eef = not (e1 < eef_prom_span[0] or s1 > eef_prom_span[1])
                    if h_p["passes_region_wide_bonferroni_0p05"] and not ov_u2 and not ov_eef:
                        wholly_non_prom_6pwm += 1
                    if mid == "MA0050.2" and ov_u2 and not in_u2 and (h_p["passes_rel_score_0p80_and_p_le_0p05"] or h_p["passes_region_wide_bonferroni_0p05"]):
                        boundary_irf1_hits.append({
                            "matrix_id": mid,
                            "tf_name": str(h_p["tf_name"]),
                            "start_1based": s1,
                            "end_1based": e1,
                            "strand": str(h_p["strand"]),
                            "relative_score_0_to_1": float(h_p["relative_score_0_to_1"]),
                            "p_adj_1pwm": float(h_p["bonferroni_window_p_value"]),
                            "p_adj_6pwm": float(h_p["bonferroni_region_across_all_matrices_p_value"]),
                            "passes_1pwm_0p05": bool(h_p["passes_rel_score_0p80_and_p_le_0p05"]),
                            "passes_6pwm_0p05": bool(h_p["passes_region_wide_bonferroni_0p05"]),
                        })
                    if mid == "MA0139.1" and (h_p["passes_rel_score_0p80_and_p_le_0p05"] or h_p["passes_region_wide_bonferroni_0p05"]):
                        if not (e1 < chs4_span[0] or s1 > chs4_span[1]):
                            ctcf_ins_hits["cHS4"] = {
                                "matrix_id": mid,
                                "start_1based": s1,
                                "end_1based": e1,
                                "strand": str(h_p["strand"]),
                                "relative_score_0_to_1": float(h_p["relative_score_0_to_1"]),
                                "p_adj_1pwm": float(h_p["bonferroni_window_p_value"]),
                                "p_adj_6pwm": float(h_p["bonferroni_region_across_all_matrices_p_value"]),
                            }
                        elif not (e1 < dm1_span[0] or s1 > dm1_span[1]):
                            ctcf_ins_hits["DM1"] = {
                                "matrix_id": mid,
                                "start_1based": s1,
                                "end_1based": e1,
                                "strand": str(h_p["strand"]),
                                "relative_score_0_to_1": float(h_p["relative_score_0_to_1"]),
                                "p_adj_1pwm": float(h_p["bonferroni_window_p_value"]),
                                "p_adj_6pwm": float(h_p["bonferroni_region_across_all_matrices_p_value"]),
                            }
            if wholly_non_prom_6pwm != 0:
                raise ValueError(f"Unexpected wholly non-promoter 6-PWM hit on {cid}: {wholly_non_prom_6pwm}")
            pwm_summary = {
                "counts_window_merged_region6_total": [total_win, total_merged, total_reg6],
                "exact_family_total_tests": exact_family_tests,
                "wholly_non_promoter_6pwm_hits": wholly_non_prom_6pwm,
                "promoter_boundary_irf1_hits": boundary_irf1_hits,
                "ctcf_insulator_hits": ctcf_ins_hits,
                "scope_note": "Descriptive part-resolved 6-PWM JASPAR annotation only (IIP-0027 / DEC-107; never a motif-count stopping rule).",
            }

        entry: Dict[str, Any] = {
            "construct_id": cid,
            "donor_length_bp": dlen,
            "itr_pair_nominal_bp": 290,
            "nominal_aav6_packaged_bp": dlen + 290,
            "nominal_aav6_headroom_bp": 4700 - (dlen + 290),
            "fits_nominal_single_aav6_le_4700bp": (dlen + 290) <= 4700,
            "donor_sha256": sha256_str(seq),
            "gc_pct": round(100.0 * (seq.count("G") + seq.count("C")) / float(dlen), 2),
            "homology_arms_bp": [len(ha_l_obs), len(ha_r_obs)],
            "ha_l_grch38_1based": "chr16:10,898,593-10,898,967 (+)",
            "ha_l_exact_matches_bp": v3_ha_bp - ha_l_mm,
            "ha_r_grch38_1based": "chr16:10,898,968-10,899,342 (+)",
            "ha_r_pam_shield_diffs_verified": ha_r_diffs,
            "pam_shield_applied": "chr16:10,898,988_10,898,989AA>CC (+ GAAA->GACC / - TTTC->GGTC; 0 neo-splice sites)",
            "two_a_count": two_a_cnt,
            "sv40pa_count": sv40_cnt,
            "bgh_polya_count": bgh_cnt,
            "poly_t20_count": t20_cnt,
            "homopolymers_ge_7nt_count": len(homos_ge7),
            "unit2_upstream_tatataatgg_count": tatata_cnt,
            "cargo_splice_counts_isolated": iso_sp_counts,
            "cargo_splice_counts_integrated_chr16_flanks": int_sp_counts,
            "donor_vs_integrated_chr16_splice_parity": iso_sp_counts == int_sp_counts,
            "max_disjoint_direct_repeat_bp": disj_dr_bp,
            "max_disjoint_direct_repeat_info": disj_dr_info,
            "max_overlapping_direct_repeat_bp": ov_dr_bp,
            "max_overlapping_direct_repeat_info": ov_dr_info,
            "max_overlapping_direct_repeat_outside_canonical_tandems_bp": ov_outside_bp,
            "max_disjoint_inverted_repeat_bp": disj_ir_bp,
            "max_disjoint_inverted_repeat_info": disj_ir_info,
            "disjoint_inverted_repeats_ge_16bp_count": ir_ge16_cnt,
            "disjoint_inverted_repeats_ge_20bp_le_1mm_count": len(near_ir_hits),
            "disjoint_inverted_repeats_ge_20bp_le_1mm_hits": near_ir_hits,
            "execution_supported": False,
            **({"descriptive_6pwm_jaspar_summary": pwm_summary} if pwm_summary else {}),
        }
        if cid == "L2_V3_BARRIER_CHS4_250":
            entry["barrier_intervention_classification"] = "COMBINED_LENGTH_AND_SEQUENCE_CHANGE_250BP_PLUS_U78775_2_C79T_C80A"
            entry["barrier_shared_80bp_alignment_offset_1based"] = [best_off + 1, best_off + 80]
            entry["barrier_shared_80bp_sequence_diffs"] = chs4_diffs
        construct_entries.append(entry)

    # 3. Authenticate canonical proxy FASTAs from immutable single-read byte snapshots & replay 296-pair screen:
    if extracted_cfh_cds is None:
        raise ValueError("Missing extracted CFH-STP-GPI CDS from Locus-2 v3 FASTA")
    intron_active = records["L2_V3_CO_PRIMARY_CD200"][len(records["L2_V3_CO_PRIMARY_CD200"]) - 2017 : len(records["L2_V3_CO_PRIMARY_CD200"]) - 1697]
    intron_nt = records["L2_V3_CTRL_NT_SCRAMBLE"][len(records["L2_V3_CTRL_NT_SCRAMBLE"]) - 2017 : len(records["L2_V3_CTRL_NT_SCRAMBLE"]) - 1697]
    hairpin_4 = (
        ("CD276_v3_g1", intron_active[82:104], intron_active[41:62]),
        ("PVR_v3_g1", intron_active[232:254], intron_active[193:214]),
        ("NT1_v3", intron_nt[82:104], intron_nt[41:62]),
        ("NT2_v3", intron_nt[232:254], intron_nt[193:214]),
    )

    scen_a_fa = parsed_proxy_fastas["data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta"]
    db_fa = parsed_proxy_fastas["data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta"]
    l3_fa = parsed_proxy_fastas["data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta"]
    s10_fa = parsed_proxy_fastas["data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta"]
    for req_map, req_key in (
        (scen_a_fa, "ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp"),
        (scen_a_fa, "ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp"),
        (scen_a_fa, "ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp"),
        (scen_a_fa, "ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp"),
        (db_fa, "DESIGNB_L5A_CXCL10_BFB_SYN6_ACC_4078bp"),
        (db_fa, "DESIGNB_L5A_CXCL10_HUMAN_DUAL_SYN6_ACC_3772bp"),
        (db_fa, "DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_HUMAN_ACC_4172bp"),
        (l3_fa, "ARM5_L3_V2_INTRON_DUPLEX_IL1R1_FAS_WT_SB9_4398"),
        (s10_fa, "S10_CTRL_WT_VMAPRTLVL_ASTAR_4143"),
    ):
        if req_key not in req_map:
            raise ValueError(f"Missing required canonical construct record {req_key!r} for RNAi proxy extraction")
    arm1b_s = scen_a_fa["ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp"]
    oi_15_proxies: Dict[str, str] = {
        "DesignA_L3_SERPINB9_PDL1_WPRE_bGH": scen_a_fa["ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp"][600:3490],
        "DesignA_L1_ARM1A_HLAE_CD47_WPRE_bGH": scen_a_fa["ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp"][1172:4080],
        "DesignA_L1_ARM1B_HLAE_bGH": arm1b_s[1637:3374],
        "DesignA_L1_ARM1B_CD47_SV40": revcomp(arm1b_s[600:1259]),
        "DesignA_L4_iCasp9_SV40": scen_a_fa["ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp"][1535:2857],
        "DesignB_c1_L5A_BFB_SYN6": db_fa["DESIGNB_L5A_CXCL10_BFB_SYN6_ACC_4078bp"][879:3478],
        "DesignB_c3_L5A_HUMAN": db_fa["DESIGNB_L5A_CXCL10_HUMAN_DUAL_SYN6_ACC_3772bp"][600:3172],
        "DesignB_c5_L6_iCasp9": db_fa["DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_HUMAN_ACC_4172bp"][2222:3572],
        "DesignB_c5_L6_CD47": revcomp(db_fa["DESIGNB_L6_AAVS1_CD47_ICASP9_2AFREE_HUMAN_ACC_4172bp"][600:1287]),
        "L3_ARM5_MultiMiR_SB9_PDL1": l3_fa["ARM5_L3_V2_INTRON_DUPLEX_IL1R1_FAS_WT_SB9_4398"][879:3798],
        "S10_ASTAR_HLAE": s10_fa["S10_CTRL_WT_VMAPRTLVL_ASTAR_4143"][1791:3543],
        "L2_V3_CFH_STP_GPI_CDS": extracted_cfh_cds,
        "L2_V3_CD200_CDS": extracted_unit2_cds["CD200"],
        "L2_V3_MANF_CDS": extracted_unit2_cds["MANF"],
        "L2_V3_CCL22_CDS": extracted_unit2_cds["CCL22"],
    }
    if oi_15_proxies.keys() != _IIP0031_OI_15_PROXY_LENGTHS.keys():
        raise ValueError("OpenIslet 15-proxy target key set mismatch")
    for _pk, _pseq in oi_15_proxies.items():
        _exp_plen = _IIP0031_OI_15_PROXY_LENGTHS[_pk]
        if not _pseq or len(_pseq) != _exp_plen or not set(_pseq).issubset({"A", "C", "G", "T"}):
            raise ValueError(f"OpenIslet proxy {_pk} length or alphabet mismatch: got len={len(_pseq)}, expected {_exp_plen}")

    total_strands_screened = len(hairpin_4) * 2
    total_targets_screened = len(oi_15_proxies) + len(utr22_3utrs)
    replayed_pair_count = total_strands_screened * total_targets_screened
    total_8mer_hits = 0
    total_7m8_hits = 0
    hits_7a1_disclosed: List[Dict[str, Any]] = []
    cds_7m8_genes: set[str] = set()
    utr5_7m8_genes: set[str] = set()
    full_mrna_7m8_genes: set[str] = set()
    for hname, g22, p21 in hairpin_4:
        for role_lbl, st_seq in (("guide", g22), ("passenger", p21)):
            for scope_lbl, tmap in (("openislet_15_proxies", oi_15_proxies), ("human_22_refseq_3utrs", utr22_3utrs)):
                res_s = _scan_seeds(st_seq, tmap)
                for tname, hdict in res_s.items():
                    total_8mer_hits += hdict["8mer"]
                    total_7m8_hits += hdict["7mer_m8"]
                    if hdict["7mer_A1"] > 0:
                        hits_7a1_disclosed.append({"hairpin": hname, "strand": role_lbl, "scope": scope_lbl, "target": tname, "count": hdict["7mer_A1"]})
            cds_res = _scan_seeds(st_seq, utr22_cds)
            for tname, hdict in cds_res.items():
                if hdict["7mer_m8"] > 0:
                    cds_7m8_genes.add(tname)
            utr5_res = _scan_seeds(st_seq, utr22_5utrs)
            for tname, hdict in utr5_res.items():
                if hdict["7mer_m8"] > 0:
                    utr5_7m8_genes.add(tname)
            full_res = _scan_seeds(st_seq, utr22_full)
            for tname, hdict in full_res.items():
                if hdict["7mer_m8"] > 0:
                    full_mrna_7m8_genes.add(tname)
    if replayed_pair_count != 296 or total_8mer_hits != 0 or total_7m8_hits != 0:
        raise ValueError(f"Dynamic 296-pair RNAi replay failed: pairs={replayed_pair_count}, 8mer={total_8mer_hits}, 7m8={total_7m8_hits}")

    # All 10 guides (1 lead + 4 clean backups per gene) screened unconditionally across ALL 15 OpenIslet proxies
    # (including the 4 new L2_V3 cargo CDSs) + all 22 RefSeq 3'-UTRs + all 4/4 RefSeq isoforms:
    pvr_5panel = (
        ("PVR_v3_g1_LEAD", "LEAD", "TGGCCGTCTTCCACCAAACGCA", "TGCGTTTGGTGGAAGACGGCCA", "TGGCCGTTTTGCACCAAACGC"),
        ("PVR_v3_g2_BKUP", "BACKUP", "CAGCTGAGGTTCAGAAGGTCCA", "TGGACCTTCTGAACCTCAGCTG", "CAGCGGAGGTGCAGAAGGTCC"),
        ("PVR_v3_g3_BKUP", "BACKUP", "CGTCCTGTGGACAAACCAATCA", "TGATTGGTTTGTCCACAGGACG", "CGTCGTGTGGCCAAACCAATC"),
        ("PVR_v3_g4_BKUP", "BACKUP", "AAACGGCTGGAATTCGTGGCAG", "TTGCCACGAATTCCAGCCGTTT", "AAACGGCGGGCATTCGTGGCA"),
        ("PVR_v3_g5_BKUP", "BACKUP", "CACCTGCCTGTTCGTCACGTTC", "TAACGTGACGAACAGGCAGGTG", "CACCGGCCTGCTCGTCACGTT"),
    )
    cd276_5panel = (
        ("CD276_v3_g1_LEAD_DUAL_IG", "LEAD", "GTGGCCGCTCCCTACTCGAAGC", "TCTTCGAGTAGGGAGCGGCCAC", "GTGGCCGTTCGCTACTCGAAG"),
        ("CD276_v3_g2_BKUP_CDS", "BACKUP", "CAGGACCAGGGCAGCGCCTATG", "TATAGGCGCTGCCCTGGTCCTG", "CAGGACCGGGCCAGCGCCTAT"),
        ("CD276_v3_g3_BKUP_3UTR", "BACKUP", "TGCACGTGCTGGAACACGTGTG", "TACACGTGTTCCAGCACGTGCA", "TGCGCGTGCTCGAACACGTGT"),
        ("CD276_v3_g4_BKUP_CDS", "BACKUP", "CGGGTGGTGCTGGGTGCGAATG", "TATTCGCACCCAGCACCACCCG", "CGGGTCGTGCCGGGTGCGAAT"),
        ("CD276_v3_g5_BKUP_3UTR", "BACKUP", "TGGGAGACAGACAACTAACTAC", "TTAGTTAGTTGTCTGTCTCCCA", "TGGGATACAGCCAACTAACTA"),
    )
    backup_guide_screen_ledger: List[Dict[str, Any]] = []
    verified_pvr_guides = 0
    verified_pvr_leads = 0
    verified_pvr_backups = 0
    for gid, grole, tgt22, g22, p21 in pvr_5panel:
        matched = sum(tgt22 in sequence for sequence in pvr_iso_map.values())
        if matched != len(pvr_iso_map):
            raise ValueError(f"PVR guide {gid} matched {matched}/{len(pvr_iso_map)} RefSeq isoforms")
        oi_8_7m8 = 0
        utr_8_7m8 = 0
        for st_seq in (g22, p21):
            oi_res = _scan_seeds(st_seq, oi_15_proxies)
            utr_res = _scan_seeds(st_seq, utr22_3utrs)
            oi_8_7m8 += sum(v["8mer"] + v["7mer_m8"] for v in oi_res.values())
            utr_8_7m8 += sum(v["8mer"] + v["7mer_m8"] for v in utr_res.values())
        if oi_8_7m8 != 0 or utr_8_7m8 != 0:
            raise ValueError(f"PVR guide {gid} failed full 15-OI/22-UTR off-target check: oi={oi_8_7m8}, utr={utr_8_7m8}")
        backup_guide_screen_ledger.append({
            "gene": "PVR",
            "guide_id": gid,
            "role": grole,
            "target_22nt": tgt22,
            "guide_22nt": g22,
            "passenger_21nt": p21,
            "refseq_isoforms_matched": f"{matched}/{len(pvr_iso_map)}",
            "openislet_15_proxies_8mer_or_7mer_m8_hits": oi_8_7m8,
            "human_22_refseq_3utrs_8mer_or_7mer_m8_hits": utr_8_7m8,
        })
        verified_pvr_guides += 1
        if grole == "LEAD":
            verified_pvr_leads += 1
        else:
            verified_pvr_backups += 1
    verified_cd276_guides = 0
    verified_cd276_leads = 0
    verified_cd276_backups = 0
    for gid, grole, tgt22, g22, p21 in cd276_5panel:
        matched = sum(tgt22 in sequence for sequence in cd276_iso_map.values())
        if matched != len(cd276_iso_map):
            raise ValueError(f"CD276 guide {gid} matched {matched}/{len(cd276_iso_map)} RefSeq isoforms")
        oi_8_7m8 = 0
        utr_8_7m8 = 0
        for st_seq in (g22, p21):
            oi_res = _scan_seeds(st_seq, oi_15_proxies)
            utr_res = _scan_seeds(st_seq, utr22_3utrs)
            oi_8_7m8 += sum(v["8mer"] + v["7mer_m8"] for v in oi_res.values())
            utr_8_7m8 += sum(v["8mer"] + v["7mer_m8"] for v in utr_res.values())
        if oi_8_7m8 != 0 or utr_8_7m8 != 0:
            raise ValueError(f"CD276 guide {gid} failed full 15-OI/22-UTR off-target check: oi={oi_8_7m8}, utr={utr_8_7m8}")
        backup_guide_screen_ledger.append({
            "gene": "CD276",
            "guide_id": gid,
            "role": grole,
            "target_22nt": tgt22,
            "guide_22nt": g22,
            "passenger_21nt": p21,
            "refseq_isoforms_matched": f"{matched}/{len(cd276_iso_map)}",
            "openislet_15_proxies_8mer_or_7mer_m8_hits": oi_8_7m8,
            "human_22_refseq_3utrs_8mer_or_7mer_m8_hits": utr_8_7m8,
        })
        verified_cd276_guides += 1
        if grole == "LEAD":
            verified_cd276_leads += 1
        else:
            verified_cd276_backups += 1

    if verified_pvr_leads != 1 or verified_pvr_backups != 4 or verified_cd276_leads != 1 or verified_cd276_backups != 4:
        raise ValueError("Unexpected lead/backup guide counts in 10-guide RNAi screen")

    wholly_non_prom_total = sum(
        int(c.get("descriptive_6pwm_jaspar_summary", {}).get("wholly_non_promoter_6pwm_hits", 0))
        for c in construct_entries
    )
    boundary_irf1_6pwm_donors = [
        {
            "construct_id": c["construct_id"],
            **h_b,
        }
        for c in construct_entries
        for h_b in c.get("descriptive_6pwm_jaspar_summary", {}).get("promoter_boundary_irf1_hits", [])
        if h_b.get("passes_6pwm_0p05")
    ]
    boundary_irf1_1pwm_donors = [
        {
            "construct_id": c["construct_id"],
            **h_b,
        }
        for c in construct_entries
        for h_b in c.get("descriptive_6pwm_jaspar_summary", {}).get("promoter_boundary_irf1_hits", [])
        if h_b.get("passes_1pwm_0p05")
    ]
    co_cd200_ctcf = next(
        c.get("descriptive_6pwm_jaspar_summary", {}).get("ctcf_insulator_hits", {})
        for c in construct_entries
        if c["construct_id"] == "L2_V3_CO_PRIMARY_CD200"
    )
    if (
        wholly_non_prom_total != 0
        or len(boundary_irf1_6pwm_donors) != 3
        or len(boundary_irf1_1pwm_donors) != 7
        or not {"cHS4", "DM1"}.issubset(co_cd200_ctcf.keys())
    ):
        raise ValueError(
            f"Unexpected 6-PWM spatial audit counts: wholly_non_prom={wholly_non_prom_total}, "
            f"boundary_irf1_6pwm={len(boundary_irf1_6pwm_donors)}, boundary_irf1_1pwm={len(boundary_irf1_1pwm_donors)}, "
            f"ctcf_keys={sorted(co_cd200_ctcf.keys())}"
        )

    syn_ov_bp = max(c["max_overlapping_direct_repeat_bp"] for c in construct_entries if c["construct_id"] != "L2_V3_CD274P_ZERO_TATATA")
    cd274p_ov_bp = next(c["max_overlapping_direct_repeat_bp"] for c in construct_entries if c["construct_id"] == "L2_V3_CD274P_ZERO_TATATA")
    max_outside_bp = max(c["max_overlapping_direct_repeat_outside_canonical_tandems_bp"] for c in construct_entries)
    total_ki_8_11 = sum(v["knockin_created_non_native_8_11mers"] for v in ciita_isoform_summary_by_acc.values())
    total_ki_15 = sum(v["knockin_created_non_native_15mers"] for v in ciita_isoform_summary_by_acc.values())

    return {
        "proposal_id": "IIP-0031",
        "decision_id": "DEC-110",
        "rule_id": "S11_Locus2_CIITA_ModeB_Vascular_Complement_and_Efferocytosis_Gate",
        "graveyard_card_id": "GY-025",
        "provenance_computation_mode": "DYNAMICALLY_RECOMPUTED_END_TO_END_FROM_BUNDLED_FASTA_AND_REFERENCE_JSON",
        "mode_b_comparator_fasta": fasta_rel,
        "mode_b_comparator_fasta_sha256": file_sha256,
        "grch38_chr16_2001bp_reference_sha256": chr16_obj["sha256"],
        "record_count": len(construct_entries),
        "execution_supported": False,
        "layer1_pareto_artifact_verified": layer1_pareto_verified,
        "layer1_pareto_artifact_sha256": layer1_pareto_sha256,
        "layer1_and_oq016_score_delta_pp": layer1_score_delta_pp,
        "canonical_fastas_verified_count": len(verified_preexisting_fastas),
        "canonical_fastas_untouched": canonical_fastas_untouched,
        "descriptive_6pwm_jaspar_spatial_audit": {
            "wholly_non_promoter_6pwm_hits": wholly_non_prom_total,
            "promoter_boundary_irf1_nt538_558_6pwm_hits_count": len(boundary_irf1_6pwm_donors),
            "promoter_boundary_irf1_nt538_558_1pwm_hits_count": len(boundary_irf1_1pwm_donors),
            "promoter_boundary_irf1_6pwm_hits": boundary_irf1_6pwm_donors,
            "promoter_boundary_irf1_1pwm_hits": boundary_irf1_1pwm_donors,
            "co_primary_cd200_ctcf_insulator_hits": co_cd200_ctcf,
        },
        "repeat_summary": {
            "max_disjoint_dr_across_8_bp": max(c["max_disjoint_direct_repeat_bp"] for c in construct_entries),
            "overlapping_dr_syn5xisre_bp": syn_ov_bp,
            "overlapping_dr_cd274p_maz4_bp": cd274p_ov_bp,
            "max_dr_outside_canonical_tandems_bp": max_outside_bp,
            "max_disjoint_ir_range_bp": [
                min(c["max_disjoint_inverted_repeat_bp"] for c in construct_entries),
                max(c["max_disjoint_inverted_repeat_bp"] for c in construct_entries),
            ],
            "disjoint_ir_ge_16bp_total_across_8": sum(c["disjoint_inverted_repeats_ge_16bp_count"] for c in construct_entries),
            "disjoint_ir_ge_20bp_le_1mm_total_across_8": sum(c["disjoint_inverted_repeats_ge_20bp_le_1mm_count"] for c in construct_entries),
        },
        "barrier_chs4_250_disclosure": {
            "construct_id": "L2_V3_BARRIER_CHS4_250",
            "classification": "COMBINED_LENGTH_AND_SEQUENCE_CHANGE_250BP_PLUS_U78775_2_C79T_C80A",
            "shared_80bp_alignment_1based_in_250bp": [best_off + 1, best_off + 80],
            "shared_80bp_diffs": chs4_diffs,
            "interpretation_note": (
                "L2_V3_BARRIER_CHS4_250 replaces the 80-bp FII element with the 250-bp cHS4 core carrying U78775.2 C79T/C80A "
                "(cHS4 core positions 72..73, differing at 2 bases inside the shared 80-bp FII region as well as length); "
                "therefore any difference vs L2_V3_CO_PRIMARY_CD200 is a combined length-and-sequence effect, not a pure length contrast."
            ),
        },
        "ciita_all_8_refseq_isoforms_audit": {
            "isoforms_audited_count": len(ciita_isoform_summary_by_acc),
            "refseq_accessions": list(ciita_isoform_summary_by_acc.keys()),
            "knockin_created_non_native_8_11mers": total_ki_8_11,
            "knockin_created_non_native_15mers": total_ki_15,
            "by_refseq_accession": ciita_isoform_summary_by_acc,
            "mandatory_stage0_controls": [
                "Informative transcript recovery of both CIITA alleles (KI and KO)",
                "Cis sentinels SOCS1, DEXI, and CLEC16A equivalence",
                "Demonstrated HLA-DR/DP/DQ inducibility in lineage-matched wild-type Stage-7 controls",
            ],
        },
        "intronic_mir_and_rnai_attribution_scope": {
            "candidate_seed_pairs_screened": replayed_pair_count,
            "strands_screened_count": total_strands_screened,
            "targets_screened_count": total_targets_screened,
            "openislet_proxy_targets_count": len(oi_15_proxies),
            "bundled_refseq_3utr_targets_count": len(utr22_3utrs),
            "replayed_8mer_hits_total": total_8mer_hits,
            "replayed_7mer_m8_hits_total": total_7m8_hits,
            "disclosed_7mer_a1_hits": hits_7a1_disclosed,
            "disclosed_22gene_cds_7mer_m8_genes": sorted(cds_7m8_genes),
            "disclosed_22gene_5utr_7mer_m8_genes": sorted(utr5_7m8_genes),
            "disclosed_22gene_full_mrna_7mer_m8_genes": sorted(full_mrna_7m8_genes),
            "lead_guides_per_target": min(verified_pvr_leads, verified_cd276_leads),
            "backup_guides_per_target": min(verified_pvr_backups, verified_cd276_backups),
            "total_screened_guides_per_target": min(verified_pvr_guides, verified_cd276_guides),
            "verified_pvr_guides_4of4_isoforms": verified_pvr_guides,
            "verified_cd276_guides_4of4_isoforms": verified_cd276_guides,
            "backup_guides_screened_against_all_15_openislet_proxies_and_22_utrs": True,
            "backup_guide_screen_ledger_15oi_22utr": backup_guide_screen_ledger,
            "active_mir_targets": ["CD276", "PVR"],
            "design_b_active_mir_policy": "BARRED_ON_DESIGN_B_HLAC_INTACT",
            "attribution_rule": (
                "Claiming an RNAi-specific benefit requires same-background intronless and scramble controls linked to the tested cargo; "
                "within the staged 8-donor FASTA, RNAi-specific attribution is therefore restricted to the matched CD200 comparison "
                "(L2_V3_CO_PRIMARY_CD200 vs L2_V3_CTRL_NT_SCRAMBLE, paired with same-background intronless CD200 when RNAi benefit is claimed)."
            ),
        },
        "constructs": construct_entries,
        "primary_citations": [
            "PMID:19503104",
            "PMID:28671664",
            "PMID:21266852",
            "PMID:19549636",
            "PMID:21989056",
            "PMID:12011446",
            "PMID:15544620",
            "PMID:28723575",
            "PMID:24332856",
            "PMID:35880017",
            "PMID:28462820",
            "PMID:32775498",
            "PMID:36055241",
            "PMID:37996616",
            "PMID:40251154",
            "PMID:2570734",
            "PMID:34050011",
            "PMID:30010673",
        ],
    }


def main() -> None:
    with REF_PATH.open("r", encoding="utf-8") as f:
        ref = json.load(f)

    promoters = ref["ensembl_promoter_sequences"]
    pwms = ref["jaspar_pwms"]
    n_pwms = len(pwms)

    # 1. Scan JASPAR PWMs with background null calibration across endogenous regulatory windows
    motif_scans: Dict[str, Any] = {}
    for region_key, region_obj in promoters.items():
        seq = region_obj["sequence"]
        region_hits = {}
        for mid, pwm_entry in pwms.items():
            region_hits[f"{mid}_{pwm_entry['tf_name']}"] = scan_jaspar_pwm(seq, pwm_entry, top_k=2, n_matrices_in_scan=n_pwms)
        cpg_cnt, gc_pct, oe_ratio = count_cpg(seq)
        motif_scans[region_key] = {
            "length_bp": len(seq),
            "cpg_dinucleotide_count": cpg_cnt,
            "gc_percent": gc_pct,
            "cpg_observed_over_expected": oe_ratio,
            "top_jaspar_pwm_hits": region_hits,
        }

    # 2. Publish only honest quarantine metadata; unverified scores are not model inputs
    avi_summary = recompute_avi_summaries_from_full_archive()

    # 3. Assemble and audit authentic HDR donor constructs
    construct_verification = build_constructs(ref, avi_summary)
    construct_verification["hlae_0101_vs_0103_gly107arg_and_cd47_daf_omega_site_sequence_audit_sonnet55_r5"] = {
        "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
        "decision_id": "DEC-047",
        "primary_citations": ["PMID:12411439", "PMID:38508139", "PMID:11504275", "PMID:22047558"],
        "hlae_0101_gly107_vs_0103_arg107_audit": {
            "crystal_template_origin": "PDB:3CDG Chain A (Petrie et al. 2008 PMID:18332182; and PDB:3BZE / PDB:1MHE) resolves HLA-E*01:01 (Arg107 at mature heavy-chain residue 107 in CELGPDRRFLRGY), whereas the engineered OpenIslet SCT donors encode HLA-E*01:03 (Gly107 at mature heavy-chain residue 107 in CELGPDGRFLRGY, codon GGC; mature cleaved SCT residue 250 [15-aa L1] or 255 [20-aa L1], precursor SCT residue 270 [500-aa canonical_arm1b_3974bp] or 275 [505-aa embodiment_a_star_4143bp]).",
            "hlae_0103_canonical_substitution": "HLA-E*01:03 (HLA-E^G) differs from HLA-E*01:01 (HLA-E^R) by a single heavy-chain amino acid substitution at mature residue 107: Arg107Gly (R107G, codon CGG/CGC -> GGC; Strong et al. 2003 J Biol Chem PMID:12411439; UniProt P13747), which relieves unfavorable electrostatic/steric packing in the alpha2-domain loop (GPD-G107-R108-FLR vs GPD-R107-R108-FLR) and increases thermal stability (Tm +4.5 C) and steady-state cell-surface density.",
            "backward_compatible_pinned_donors": "Both pinned donors — canonical_arm1b_3974bp (SHA-256 f74728767987c18b...) and embodiment_a_star_4143bp (SHA-256 0995f8e35791d219...) — already encode the true HLA-E*01:03 Gly107 (codon GGC) allele at precursor SCT residue 270 / 275 (mature cleaved SCT residue 250 / 255), while Stage-0 Gate 0A includes the PDB:3CDG-matched HLA-E*01:01 (Arg107, codon CGC) crystal-reference comparator to verify the +4.5 C Tm and steady-state surface-density advantage in the covalent SCT format.",
        },
        "hlae_0101_arg107_vs_0103_gly107_audit": {
            "crystal_template_allele": "HLA-E*01:01 (Arg107, codon CGC/CGG in PDB:3CDG / 1MHE / 3BZE)",
            "engineered_donor_allele": "HLA-E*01:03 (Gly107, codon GGC in canonical_arm1b_3974bp and embodiment_a_star_4143bp)",
            "canonical_substitution": "Arg107Gly (R107G, mature heavy-chain residue 107; Strong et al. 2003 PMID:12411439)",
        },
        "cd47_igv_daf_175aa_omega_site_numbering_reconciliation": {
            "precursor_length_aa": 175,
            "signal_peptide_1_to_18": "MWPLVAALLLGSACCGSA",
            "mature_cd47_igv_ectodomain_19_to_138_120aa": "QLLFNKTKSVEFTFCNDTVVIPCFVTNMEAQNTTEVYVKWKFKGRDIYTFDGALNKSTVPTDFSSAKIEVSQLLKGDASLKMDKSDAVSHTGNYTCEVTELTREGETIIELKYRVVSWFS",
            "daf_cd55_retained_stalk_139_to_147_9aa": "PNKGSGTTS",
            "daf_cd55_cleaved_gpi_propeptide_148_to_175_28aa": "GTTRLLSGHTCFTLTGLLGTLVTMGLLT",
            "daf_cd55_c_terminal_gpi_signal_139_to_175_37aa": "PNKGSGTTSGTTRLLSGHTCFTLTGLLGTLVTMGLLT",
            "omega_cleavage_site_residue": "Precursor Ser147 (native CD55/DAF Ser353 at the C-terminus of the 9-aa retained stalk PNKGSGTTS^GTTR...; Moran et al. 1991 J Biol Chem PMID:1824699; Xu et al. 2024 PMID:38508139), NOT Ser141 and NOT Ser152.",
            "cleaved_mature_gpi_anchored_polypeptide_length_aa": 129,
            "uncleaved_gpi_signal_retention_assay": "Gate 0A/0E Triton X-114 phase partitioning + PI-PLC release (>= 90% surface MFI release by PI-PLC confirms complete Ser147 [native CD55 Ser353] omega-site transamidation without ER retention of the 28-aa hydrophobic propeptide 148..175).",
        },
        "pulsed_human_pk_mimetic_ap1903_qualification_protocol": {
            "clinical_pk_reference": "Human 0.4 mg/kg 2-h IV infusion of AP1903 (rimiducid; Iuliucci et al. 2001 J Clin Pharmacol PMID:11504275; Di Stasi et al. 2011 NEJM PMID:22047558) reaches plasma Cmax ~250-500 nM (~10-50 nM free drug in interstitial tissue) and decays to ~18%, 7%, and 1% of Cmax at 0.5, 2, and 10 h post-infusion.",
            "stage0_gate_0s_pulsed_washout_regimen": (
                "Replace static 24-72 h 10 nM bath as the sole primary Gate 0S readout with a human-PK-mimetic pulsed washout regimen: two 2-h pulses of 10-50 nM free AP1903 spaced 48 h apart (with drug-free media washout between pulses) under combined 2% O2 hypoxia + 0.5 uM thapsigargin, "
                "requiring >= 4-log10 bulk kill and 0/299,573,228 clonogenic survivors with clinical-grade AP1903 monotherapy alone (obs_ap1903_monotherapy_pulsed_pk_log10_kill >= 4.0 and obs_ap1903_pulsed_pk_log10_kill >= 4.0; "
                "100 nM birinapant SMAC mimetic is evaluated strictly as an exploratory in vitro mechanistic XIAP-depletion control and preclinical salvage comparator, not assumed in the human clinical monotherapy release gate; AUDIT-REF [DEC-050])."
            ),
        },
    }

    # 4. Run data-linked Stage 0->7 perturbation simulator
    perturbation_plane = simulate_stage0_to_stage7_perturbation_plane(ref, construct_verification, motif_scans)

    ucoe_overlap_bp = int(
        construct_verification["regulatory_element_audits"]["CBX3_A2UCOE_core_455bp_R17"]["avi_coordinate_overlap_bp"]
    )
    all_ha_non_overlapping = all(
        int(c.get("homology_arm_overlap_bp", 0)) == 0 for c in construct_verification["constructs"]
    )
    all_orfs_clean = all(
        int(c.get("internal_stop_codons", 0)) == 0
        and int(c.get("internal_cryptic_splice_donors_GTAAGT_GTGAGT", 0)) == 0
        for c in construct_verification["constructs"]
    )

    _canonical_fasta = {
        blk.splitlines()[0].split()[0]: "".join(blk.splitlines()[1:]).strip().upper()
        for blk in FASTA_OUT.read_text(encoding="utf-8").strip().split(">")[1:]
    }

    atlas = {
        "schema_version": "0.8.0",
        "layer": "Layer 2 — Single-Cell Perturbation & Regulatory Sequence Plane",
        "status": "COMPUTATIONALLY_VERIFIED_REFERENCE_DESIGNS_AND_PRIOR_PERTURBATION_PLANE",
        "summary": {
            "ensembl_grch38_loci_mapped": len(ref["ensembl_grch38_loci"]),
            "jaspar_pwms_scanned": len(pwms),
            "ucsc_encode_chip_seq_regions_verified": len(ref["ucsc_encode_tfbs_summary"]),
            "alphagenome_avi_snvs_archived_and_recomputed": None,
            "archival_table_supplied_rows_private_quarantine": 3118,
            "avi_model_predictions_available": False,
            "alphagenome_avi_26_seed_anchors_verified": None,
            "archival_highlighted_rows_count": 26,
            "perturbation_profiles_total": len(perturbation_plane["perturbation_profiles"]),
            "construct_cassettes_synthesized_and_audited": len(construct_verification["constructs"]),
            "cbx3_a2ucoe_455bp_avi_coordinate_overlap_bp": ucoe_overlap_bp,
            "all_homology_arms_non_overlapping_grch38_verified": all_ha_non_overlapping,
            "all_construct_orfs_in_frame_and_canonical_donor_free": all_orfs_clean,
        },
        "ensembl_gencode_release_pairing": ref.get("ensembl_gencode_release_pairing", "Ensembl release 112 / GENCODE v46 (GRCh38.p14, 1-based closed coordinates; ENST00000309268.11 reconciled)"),
        "ensembl_grch38_target_loci": ref["ensembl_grch38_loci"],
        "gtex_v8_v10_human_tissue_expression": ref.get("gtex_v8_v10_human_tissue_expression", {}),
        "human_protein_atlas_subcellular_localization": ref.get("human_protein_atlas_subcellular_localization", {}),
        "encode_screen_2456_biosample_expression": ref.get("encode_screen_2456_biosample_expression", {}),
        "encode_primary_human_islet_epigenomic_experiments": ref.get("encode_primary_human_islet_epigenomic_experiments", []),
        "alphagenome_avi_saturation_mutagenesis_and_variants": avi_summary,
        "alphagenome_atlas_locus_and_variant_deep_links": {
            "B2M_locus1_promoter_and_exon1": "https://deepmind.google.com/science/alphagenome/atlas?q=chr15%3A44711000-44713000&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "CIITA_locus2_exons": "https://deepmind.google.com/science/alphagenome/atlas?q=chr16%3A10876500-10879000&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "CIITA_locus2_pan_isoform_exon5": "https://deepmind.google.com/science/alphagenome/atlas?q=chr16%3A10898500-10899500&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "CXCL10_locus3_isre_nfkb_promoter": "https://deepmind.google.com/science/alphagenome/atlas?q=chr4%3A76022500-76024500&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "AAVS1_PPP1R12C_locus4_intron1": "https://deepmind.google.com/science/alphagenome/atlas?q=chr19%3A55115000-55117000&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "HNRNPA2B1_CBX3_455bp_A2UCOE_insulator": "https://deepmind.google.com/science/alphagenome/atlas?q=chr7%3A26200580-26201034&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "CBX3_HNRNPA2B1_455bp_A2UCOE_insulator": "https://deepmind.google.com/science/alphagenome/atlas?q=chr7%3A26200580-26201034&m=locus&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
            "TYK2_rs34536443_P1104A_protective_missense": "https://deepmind.google.com/science/alphagenome/atlas?q=chr19%3A10352442%3AG%3EC&m=variant&lItems=avi%2Csection%3ARNA_SEQ%2Csection%3ADNASE%2Csection%3ACHIP_TF",
        },
        "ucsc_encode_chip_seq_tf_clusters": ref["ucsc_encode_tfbs_summary"],
        "ucsc_phylop100way_and_phastcons100way_conservation": ref["ucsc_conservation_summary"],
        "jaspar_pwm_regulatory_motif_scans": motif_scans,
        "construct_sequence_and_grammar_verification": construct_verification,
        "stage0_to_stage7_perturbation_plane": perturbation_plane,
        "stage0_core_construct_and_secretion_guardrails_iip_0011": {
            "decision_id": "DEC-090",
            "proposal_id": "IIP-0011",
            "donor_slc30a8_znt8_precautionary_hold": {
                "status": "EXCLUDED_FROM_LEAN_CORE_HOLD_FOR_ALLELE_AND_PROTOCOL_SPECIFIC_CHALLENGER_QUALIFICATION",
                "context_stratified_evidence_summary": [
                    {
                        "citation": "Lamarche et al. 2025 PMID:41020949",
                        "biological_context": "Adult human population genetics (germline natural SLC30A8 loss-of-function heterozygotes and homozygotes)",
                        "finding_scope": "Lower adult type 2 diabetes risk in natural LoF carriers; argues against universal adult knockout harm without certifying in-vitro hPSC-to-beta differentiation yield.",
                    },
                    {
                        "citation": "Dwivedi et al. 2019 PMID:31676859",
                        "biological_context": "Human stem-cell beta-like differentiation in clones with premature stop codons in SLC30A8 alongside adult/physiological assays",
                        "finding_scope": "Reduced INS- and SLC30A8-transcript-expressing cell formation in particular premature-stop differentiation experiments alongside beneficial physiological insulin-secretion effects.",
                    },
                    {
                        "citation": "Balke et al. 2018 PMID:29679103",
                        "biological_context": "Recipient rs13266634 genotyping in n = 40 immunosuppressed clinical islet transplant recipients (not donor SLC30A8 knockout)",
                        "finding_scope": "Recipient CT/TT genotypes associated with failure to achieve insulin independence in multivariate analysis; does not test donor SC-islet knockout.",
                    },
                    {
                        "citation": "Gasser et al. 2026 PMID:42078397 (non-peer-reviewed medRxiv preprint)",
                        "biological_context": "R138X human SC-islet differentiation preprint",
                        "finding_scope": "Reports normal differentiation and some improved identity/function measures in R138X SC-islets; as a non-peer-reviewed preprint, it qualifies Dwivedi 2019 rather than providing definitive product reassurance.",
                    },
                ],
                "proposed_challenger_study_advancement_conditions": (
                    "Any optional donor SLC30A8 challenger study (distinct from established Blueprint A/X release thresholds) must predeclare: "
                    "(1) absolute viable Stage-7 INS+/NKX6-1+ cell yield per starting hPSC across independent differentiation blocks (never percentage among survivors alone), "
                    "(2) the 12-week in-vivo stimulated human C-peptide model, implanted starting-cell/IEQ dose denominator, justified non-inferiority margin, and one-sided confidence criterion "
                    "(never a pilot point estimate >= 90% or non-significant p-value), and "
                    "(3) full retention of Readout 2 dynamic low-glucose shut-off (t50 and t90), basal secretion, glucagon counterregulation, and cellular OCR headroom gates (GY-003, GY-004, GY-007)."
                ),
            },
            "endogenous_intracellular_cd59_iris_secretion_cross_reference": {
                "status": "PRESERVED_IN_CANONICAL_DESIGNS_SEPARATE_SECRETION_AND_COMPLEMENT_READOUTS",
                "primary_citation": "Golec et al. 2022 PMID:35666870",
                "blueprint_anchor": "ISLET-1-BLUEPRINT.md Section 8 Row 3",
                "qualification_scope": (
                    "Endogenous CD59 remains unedited so non-GPI-anchored intracellular isoforms (IRIS-1/IRIS-2) required for SNARE-mediated "
                    "insulin granule exocytosis are preserved and verified via Readout 2 dynamic GSIS/C-peptide perifusion separately from "
                    "Readout 3C cell-surface GPI-anchored complement (C3b/C5b-9) lysis attribution."
                ),
            },
        },
        "stage0_post_adjunct_and_held_challenger_falsifier_gates_iip_0012": {
            "decision_id": "DEC-091",
            "contribution_id": "IIP-0012",
            "core_scoring_impact": "ZERO_LAYER1_SCORE_CHANGE",
            "post_adjunct_depletion_three_history_qualification_scope": {
                "primary_citations": [
                    "Headen et al. 2018 PMID:29867165",
                    "Lei et al. 2022 PMID:35559682",
                    "Turan et al. 2024 PMID:38709159",
                    "Kazmi et al. 2026 PMID:41842939",
                ],
                "protocol_summary": (
                    "Blocked sibling-aliquot three-history Stage-0 rechallenge on existing exact Stage-7 preparations without new genomic edits: "
                    "ARM1_NEVER_CONDITIONED vs ARM2_CONDITIONED_DEPLETED (verified carrier-bound + cell-free supernatant SA-FasL and SA-THBD bioactivity "
                    "depleted below predeclared assay LLOD/depletion limits, matched contemporaneous sham/age handling, declared adjunct_sa_fhl1_status "
                    "preventing active SA-FHL-1 lots from being misclassified as complete adjunct depletion, non-pooled NATURAL_AGING_DECAY vs PHYSICAL_WASHOUT "
                    "depletion modes, and explicit RETAINED_CONDITIONED_RESPONDERS vs FRESH_RECIPIENT_RESPONDERS / MHC-II CD4+ vs MHC-I CD8+ cross-presentation "
                    "separation) vs ARM3_CONTINUOUSLY_ACTIVE (directly verified ongoing functional bioactivity; noting Headen 2018 PMID:29867165 reported "
                    "3.0 +/- 0.8 d fluorescent SA-FasL retention rather than functional bioactivity half-life and used transient systemic rapamycin)."
                ),
            },
            "ectopic_cd55_scr14_unconfounded_satellite_scope": {
                "status": "SEPARATE_EXPERIMENTAL_SATELLITE_NOT_CORE_CONSTRUCT",
                "primary_citations": [
                    "Golec et al. 2022 PMID:35666870",
                    "van der Torren et al. 2017 PMID:27787618",
                    "Xu et al. 2024 PMID:38508139",
                ],
                "primary_causal_contrast": (
                    "Exact same edited graft background + ectopic CD55(SCR1-4) (with declared GPI vs TM anchor, surface localization, QuantiBRITE density, "
                    "and PIGK GPI-biosynthesis non-competition against CD47-IgV-GPI and endogenous CD59) vs exact same edited graft background without "
                    "ectopic CD55 under matched delivery/mock treatment and intact endogenous CD59; unedited WT (already complement-resistant in mature "
                    "endocrine cells per van der Torren 2017 PMID:27787618) and CD59 loss-of-function (confounded by IRIS-1/2 SNARE secretion loss per "
                    "Golec 2022 PMID:35666870) serve strictly as supplementary references alongside the existing Layer-3 CD47-CD55 / 2A-free CD55+CD59 challenger."
                ),
            },
            "held_challenger_state_machine": {
                "initial_state": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                "on_falsifier_breach": "DISQUALIFIED_AT_FALSIFIER",
                "on_missing_or_underpowered_data": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                "on_independent_clearance": "ELIGIBLE_FOR_INDEPENDENT_D2_CONFIRMATION_PROPOSAL",
                "promotion_guard": "Never triggers automatic or silent promotion into Scenario A, Scenario B, or Challenger X; requires independent multi-clone, multi-differentiation-block, and multi-donor confirmation plus a separate follow-on IIP.",
            },
            "held_challenger_families": [
                {
                    "family_id": "TYMS_AUXOTROPHIC_DIVIDING_CELL_CONTAINMENT",
                    "status": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                    "transcript_and_locus_reconciliation": (
                        "Reconciles live Ensembl ENST00000323274.15 vs .9 (Exon 1 chr18:657653-657947, CDS start chr18:657743, antisense ENOSF1 "
                        "ENSG00000132199 start chr18:667671; chr18:657600-658000 spans noncoding sequence and is a target window rather than an exact KO allele; "
                        "Tummala et al. 2022 PMID:35931051 established ENOSF1-to-TYMS suppression rather than proving exon-5 KO damages ENOSF1). "
                        "Nuclease TYMS KO adds a K chromosomal cut rather than a B base edit under GY-006; biallelic pan-lineage AAVS1 iCasp9 remains mandatory "
                        "and functionally verified (GY-002); arrest across 0.1-20 uM supplemented 2'-deoxythymidine (dThd) is framed as an aggressive "
                        "salvage-vulnerability falsifier (Sartori-Maldonado et al. 2024 PMID:38867450 rescued KO proliferation at 20 uM dThd and noted dying-cell "
                        "salvage and 3D residual growth), paired with dTTP/dUTP balance, >=63,000x duplex-seq/CAST-seq, and shared iEC/iPericyte vascular bank checks."
                    ),
                },
                {
                    "family_id": "DESIGN_B_NLRC5_ISRE_CIS_EDIT",
                    "status": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                    "candidate_allele_grch38": "chr16:56989556:C>G",
                    "qualification_requirements": (
                        "Must name the exact Design-B background modified (scored 6-locus ISLET1_CHASSIS_B_HLA_C_RETAINED_6LOCUS_HYPOTHESIS vs unscored "
                        "B'-SCT molecular hypotheses), quantify HLA-A, HLA-B, and retained HLA-C separately alongside trans HLA-E, PD-L1, and cis CETP, "
                        "and test matched KIR-defined (NKG2A+, NKG2C+, KIR2DL1/2/3+, KIR3DL1+) primary NK subsets under Playbook absolute lysis ceilings "
                        "(never generic CD56+ survival; GY-001, GY-005); notes >=75% HLA-A/B reduction with >=80% HLA-C/HLA-E/PD-L1 retention is an "
                        "aspirational engineering gate given ~50% HLA-I reduction under near-complete NLRC5 knockdown in Szymczak et al. 2022 PMID:36103539."
                    ),
                },
                {
                    "family_id": "ENDOGENOUS_CD274_SPLICE_DONOR_PLUS6_EDIT",
                    "status": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                    "candidate_allele_grch38": "chr9:5457426:A>T (ENST00000381577.4 exon 3 end 5457420, ATG|GTAAGA donor +6)",
                    "qualification_requirements": (
                        "Notes Rao et al. 2026 PMID:42856285 is a non-peer-reviewed September 2026 bioRxiv preprint and neither Rao 2026 PMID:42856285 nor Yan et al. "
                        "2023 PMID:37175900 tested +6A>T (which could impair protective PD-L1). Requires isoform-specific junction assays distinguishing "
                        "endogenous Ex3-included vs Ex2->Ex4 skipped transcripts and endogenous surface/secreted PD-L1 contribution from the intronless "
                        "Locus-3 PD-L1 cDNA cassette, undisturbed cis PDCD1LG2, and functional PD-1 engagement (GY-001, GY-006, GY-008)."
                    ),
                },
                {
                    "family_id": "TXNIP_CHORE_SINGLE_ALLELE_HYPOXIA_CHALLENGERS",
                    "status": "HOLD_FOR_PROSPECTIVE_FALSIFIER",
                    "candidate_alleles_grch38": [
                        "chr1:145996652:T>A",
                        "chr1:145996656:G>C",
                        "chr1:145996667:G>T",
                    ],
                    "qualification_requirements": (
                        "Tested strictly as individual B = 1 single-allele experiments (never multiplexed B >= 3; GY-006), noting Bradley et al. 2026 "
                        "PMID:42120510 studied 48-h 1% O2 dysfunction in larger SC-islets without TXNIP editing or reoxygenation. Requires matched "
                        "cluster-size controls across 48-h 1% O2 plus reoxygenation recovery, absolute viable INS+NKX6-1+ beta-cell recovery per starting "
                        "input, alpha/delta survival, basal insulin secretion, dynamic GSIS, low-glucose shut-off (t50 and t90), and OCR without waiving "
                        "G6PC2/RNLS or Layer-4 oxygen-budget gates (GY-003, GY-004)."
                    ),
                },
            ],
        },
        "stage0_two_strand_splice_census_and_challenger_manifest_iip_0015": (
            _iip_0015_manifest := _build_two_strand_splice_census_and_challenger_manifest_iip_0015(
                ref=ref,
                construct_verification=construct_verification,
                arm1a_can=_canonical_fasta["ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp"],
                arm1b_can=_canonical_fasta["ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp"],
                l3_can=_canonical_fasta["ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp"],
                l4_can=_canonical_fasta["ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp"],
            )
        ),
        "stage0_s10_hlae_comparator_panel_manifest_iip_0016": _build_s10_hlae_comparator_panel_manifest_iip_0016(
            iip_0015_manifest=_iip_0015_manifest,
            arm1b_can=_canonical_fasta["ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp"],
        ),
        "species_separated_proteome_subtracted_peptide_census_iip_0017": _build_species_separated_proteome_census_iip_0017(),
        "stage0_locus3_multimir_and_cbe_needle_manifest_iip_0018": _build_locus3_multimir_and_cbe_needle_manifest_iip_0018(
            iip_0015_manifest=_iip_0015_manifest,
        ),
        "extracellular_biomaterial_foreign_peptide_census_iip_0020": _build_extracellular_biomaterial_census_iip_0020(),
        "stage0_design_y_wildcard_manifest_iip_0023": _build_design_y_wildcard_manifest_iip_0023(),
        "stage0_design_b_comparator_provenance_and_ins_retirement_manifest_iip_0026": (
            _iip_0026_manifest := _build_design_b_comparator_provenance_and_ins_retirement_manifest_iip_0026(
                ref=ref,
                construct_verification=construct_verification,
                arm1a_can=_canonical_fasta["ISLET1_LOCUS1_ARM1A_B2M_HLAE_SCT_GSGP2A_CD47_IGV_GPI_4880bp"],
                arm1b_can=_canonical_fasta["ISLET1_LOCUS1_ARM1B_B2M_BIDIR_2AFREE_CD47_IGV_GPI_HLAE_SCT_3974bp"],
                l3_can=_canonical_fasta["ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp"],
                l4_can=_canonical_fasta["ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp"],
            )
        ),
        "stage0_locus3_initiation_6pwm_and_aav_itr_audit_iip_0027": _build_locus3_initiation_6pwm_and_aav_itr_audit_iip_0027(
            ref=ref,
            construct_verification=construct_verification,
            iip_0015_manifest=_iip_0015_manifest,
            iip_0026_manifest=_iip_0026_manifest,
        ),
        "stage0_p2_itm2b_nm021999_reserve_and_brichos_audit_iip_0028": _build_itm2b_nm021999_reserve_and_brichos_comparator_audit_iip_0028(
            ref=ref,
            l3_can=_canonical_fasta["ISLET1_LOCUS3_CXCL10_SERPINB9_GSGP2A_PDL1_NO_FURIN_4090bp"],
            l4_can=_canonical_fasta["ISLET1_LOCUS4_AAVS1_CHS4_455BP_CBX3_A2UCOE_EEF1A1_ICASP9_3457bp"],
        ),
        "stage0_locus2_ciita_modeb_comparators_v3_manifest_iip_0031": build_locus2_ciita_modeb_comparators_v3_manifest(
            ref=ref,
        ),
    }

    if (REPO_ROOT / ".openislet_public_bundle").is_file() and ATLAS_OUT.is_file():
        try:
            prev_atlas = json.loads(ATLAS_OUT.read_text(encoding="utf-8"))
            if "public_effects_provenance_rebinding" in prev_atlas:
                atlas["public_effects_provenance_rebinding"] = prev_atlas["public_effects_provenance_rebinding"]
        except Exception:
            pass

    ATLAS_OUT.parent.mkdir(parents=True, exist_ok=True)
    with ATLAS_OUT.open("w", encoding="utf-8") as f:
        json.dump(atlas, f, indent=2, ensure_ascii=not (REPO_ROOT / ".openislet_public_bundle").is_file())
        f.write("\n")

    print(f"[Layer 2 v0.8.0] Wrote {FASTA_OUT.relative_to(REPO_ROOT)} and {ATLAS_OUT.relative_to(REPO_ROOT)}")
    for c in construct_verification["constructs"]:
        print(
            f"  {c['construct_id']}: donor={c['total_length_bp']} bp, "
            f"with_2xITRs={c['packaged_aav6_genome_with_2x145bp_itrs_bp']} bp "
            f"(AAV6<=4.7kb={c['aav6_single_capsid_compatible_le_4700bp']}, headroom={c['aav6_packaging_headroom_including_itrs_bp']:+d} bp)"
        )


if __name__ == "__main__":
    main()
