OpenIslet

scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py

OpenIslet Wave-6 W6-C1 (Provisional IIP-0055 / DEC-136 / GATE-34 / GY-033;

script Release v0.8.0 gen-eb955f8266035aba 417 KB · 30 sections

Use this file in any AI chat (paste-only or attachment-capable):

Download as text (.txt) Download section (.txt)

Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py · SHA-256: d5b98e2ba1310333…

        require_cond(seg_before is not None and len(seg_before) == 180, f"Missing authentic 180-bp T20 segment for {row['record']}")
        require_cond(sha256_str(seg_before) == row["before_sha256"], f"T20 before_sha256 recompute mismatch on {row['record']}")
        require_cond(("T" * 20) in seg_before, f"T20 motif missing in before segment of {row['record']}")
        seg_after = seg_before.replace("T" * 20, "TTGTGTTTGTTGTTGTGTTG").replace("GGGGGGG", "GGCGGCG")
        recomp_after = sha256_str(seg_after)
        require_cond(recomp_after == row["after_sha256"], f"T20 after_sha256 recompute mismatch on {row['record']}")
        seg_after_h = audit_dna_hygiene(seg_after)
        require_cond(seg_after_h["passes_synthetic_v090_gates"] and "AATAAA" in seg_after, f"T20 post-patch hygiene fail on {row['record']}")
        t20_recomputed_rows.append({
            **row,
            "dynamically_recomputed": True,
            "after_max_homopolymer_nt": seg_after_h["max_homopolymer_nt"],
            "after_passes_synthetic_v090_gates": seg_after_h["passes_synthetic_v090_gates"],
        })

    arm5_before_full = rep["arm5_before_full"]
    require_cond(sha256_str(arm5_before_full) == rep["arm5_before_sha256"], "ARM5 legacy full-donor SHA-256 mismatch")
    arm5_before_pkg_bp = len(arm5_before_full) + AAV6_ITR_OVERHEAD_BP
    arm5_full_anti_before = max_antisense_m_orf(arm5_before_full)
    require_cond(arm5_before_pkg_bp == 4688 and arm5_full_anti_before == 400, f"ARM5 legacy dynamic recompute mismatch: pkg={arm5_before_pkg_bp}, anti={arm5_full_anti_before}")

    arm5_mir_old = rep["arm5_before_mir_320"]
    arm5_pdl1_old = rep["arm5_before_pdl1_873"]
    arm5_new = rep["arm5_repaired"]
    arm5_mir_old_h = audit_dna_hygiene(arm5_mir_old)
    arm5_payload_h = audit_dna_hygiene(arm5_new[425 : len(arm5_new) - 425])
    arm5_full_h = audit_dna_hygiene(arm5_new)
    require_cond(arm5_mir_old_h["disjoint_ir_ge20_count"] == 2 and arm5_mir_old_h["max_disjoint_ir_bp"] == 22, "ARM5 BEFORE IR check failed")
    require_cond(arm5_payload_h["passes_synthetic_v090_gates"] and arm5_full_h["disjoint_ir_ge20_count"] == 0 and arm5_full_h["disjoint_dr_ge20_count"] == 0, "ARM5 repair failed")
    require_cond("ATCTTTGACTCCACTAAAGTGT" in arm5_new and "CAATTCCAATCCCTTGGAGTTG" in arm5_new, "ARM5 mature 3p guides lost")
    require_cond(len(arm5_new) + AAV6_ITR_OVERHEAD_BP == 4538 <= AAV6_MAX_PACKAGED_BP, "ARM5 AAV6 arithmetic ceiling failed")
    pdl1_new_cds = arm5_new[2625:3498]
    require_cond(translate(pdl1_new_cds, 0) == pro["PDL1_Q9NZQ7"] + "*", "ARM5 PD-L1 SYN6+ AA mismatch")
    pdl1_anti_before = max_antisense_m_orf(arm5_pdl1_old)
    pdl1_anti_after = max_antisense_m_orf(pdl1_new_cds)
    arm5_full_anti_after = max_antisense_m_orf(arm5_new)
    require_cond(pdl1_anti_before == 286 and pdl1_anti_after == 19, f"PD-L1 CDS antisense ORF mismatch: {pdl1_anti_before}->{pdl1_anti_after}")
    require_cond(arm5_full_anti_after == 134, f"ARM5 full-donor antisense ORF expected 134 aa, got {arm5_full_anti_after}")

    # Verify SERPINB9 (UniProt P50453) 100% exact frame & redox RCL audit inside ARM5
    sb9_wt = pro["SERPINB9_P50453"]
    require_cond(len(sb9_wt) == 376 and sb9_wt[339] == "E" and sb9_wt[329:350] == "AAASSCFVVAECCMESGPRFC", "SERPINB9 P50453 RCL mismatch")
    arm5_sb9_ok = any((sb9_wt + "*") in translate(arm5_new, fr) for fr in range(3))
    require_cond(arm5_sb9_ok, "SERPINB9 exact WT P50453 frame not found in ARM5")

    # Verify authentic human Catalase (UniProt P04040, 527 aa)
    cat_wt = pro["CAT_P04040"]
    require_cond(len(cat_wt) == 527 and cat_wt[74] == "H" and cat_wt[147] == "N" and cat_wt[357] == "Y" and cat_wt.count("C") == 4, "CAT P04040 verification failed")

    # 4. Cross-verify shipped FASTA file on disk (26 records, byte-exact SHA-256, 0 T20, 0 disjoint repeats)
    require_cond(fasta_path.is_file(), f"Missing v0.9.0 FASTA file: {fasta_path}")
    fasta_bytes = fasta_path.read_bytes()
    fasta_sha = sha256_bytes(fasta_bytes)
    require_cond(fasta_sha == EMBEDDED_AUTHENTIC_ASSETS["fasta_sha256"], f"FASTA SHA-256 mismatch: {fasta_sha}")
    fasta_recs = parse_fasta_text(fasta_bytes.decode("utf-8"))
    require_cond(len(fasta_recs) == EMBEDDED_AUTHENTIC_ASSETS["fasta_record_count"] == 26, "FASTA record count mismatch")
    by_id: Dict[str, Tuple[str, str]] = {hdr.split()[0]: (hdr, sq) for hdr, sq in fasta_recs}
    require_cond(by_id["V090_REG_CHS4_0C9_U78775_2_250bp"][1] == chs4, "FASTA cHS4 record mismatch with contiguous U78775.2:1-250(+)")

    dna_full_repeat_audit: Dict[str, Dict[str, int]] = {}
    for hdr, sq in fasta_recs:
        rec_id = hdr.split()[0]
        if "| DNA |" in hdr:
            dh = audit_dna_hygiene(sq)
            require_cond(dh["t20_count"] == 0, f"FASTA DNA record contains T20: {hdr}")
            require_cond(dh["disjoint_dr_ge20_count"] == 0 and dh["disjoint_ir_ge20_count"] == 0, f"FASTA DNA record has disjoint >=20 bp repeat: {hdr}")
            dna_full_repeat_audit[rec_id] = {
                "length_bp": dh["length_bp"],
                "max_homopolymer_nt": dh["max_homopolymer_nt"],
                "disjoint_dr_ge20": dh["disjoint_dr_ge20_count"],
                "disjoint_ir_ge20": dh["disjoint_ir_ge20_count"],
            }
            if "AAV6_pkg=" in hdr:
                m_pkg = re.search(r"AAV6_pkg=(\d+)bp", hdr)
                require_cond(
                    m_pkg is not None and int(m_pkg.group(1)) == len(sq) + AAV6_ITR_OVERHEAD_BP <= AAV6_MAX_PACKAGED_BP,
                    f"FASTA AAV6 arithmetic ceiling mismatch: {hdr}",
                )

    # Explicit native vs synthetic segment provenance map across all 26 FASTA records
    provenance_manifest = [
        {"record_id": "V090_REG_CHS4_0C9_U78775_2_250bp", "kind": "DNA", "accession": "ENA:U78775.2", "coords_1based": "1-250", "strand": "+", "native_intervals": ["1-250 (246/250 bp)"], "engineered_edits": ["C20T (FI VEZF1)", "C21A (FI VEZF1)", "C79T", "C80A"], "qualification_status": "FUNCTIONALLY_UNQUALIFIED_PENDING_VARIANT_BARRIER_ASSAY"},
        {"record_id": "V090_REG_EEF1A1_CORE_GRCh38_230bp", "kind": "DNA", "accession": "GRCh38:ENST00000309268", "coords_1based": "chr6:73521000-73521229", "strand": "-", "native_intervals": ["1-230 (100% native; TATATAA at 168-174)"], "engineered_edits": []},
        {"record_id": "V090_REG_CBX3_A2UCOE_GRCh38_700bp", "kind": "DNA", "accession": "GRCh38:ENST00000396386", "coords_1based": "chr7:26201745-26202444", "strand": "+", "native_intervals": ["1-700 (100% native; 700-bp TSS interval vs 674-bp Muller-Kuller 2015 fragment)"], "engineered_edits": [], "qualification_status": "FUNCTIONALLY_UNQUALIFIED_PENDING_ARCHIVED_BARRIER_AND_SPLICING_ASSAY"},
        {"record_id": "V090_REG_CXCL10_NFKB_ISRE_GRCh38_260bp", "kind": "DNA", "accession": "GRCh38:ENST00000306602", "coords_1based": "chr4:76023478-76023737", "strand": "-", "native_intervals": ["1-260 (259/260 bp)"], "engineered_edits": ["A50C outside TFBS"]},
        {"record_id": "V090_REG_EMCV_IRES_M81861_1_567bp", "kind": "DNA", "accession": "GenBank:M81861.1", "coords_1based": "282-848", "strand": "+", "native_intervals": ["1-567 (100% native, past viral C10)"], "engineered_edits": []},
        {"record_id": "V090_REG_BGH_POLYA_M57764_1_225bp", "kind": "DNA", "accession": "GenBank:M57764.1", "coords_1based": "2326-2550", "strand": "+", "native_intervals": ["1-225 (100% native)"], "engineered_edits": []},
        {"record_id": "V090_REPAIR1_LOCUS1_B2M_ARM1B_3974bp", "kind": "DNA", "accession": "GRCh38:chr15_B2M + engineered_payload", "coords_1based": "1-3974", "strand": "+", "native_intervals": ["1-500 (native B2M LHA, GC50<=78%)", "3475-3974 (native B2M RHA, GC50=82%)"], "engineered_edits": ["501-3474 synthetic HLA-E SCT + CD47 payload (passes synthetic v0.9.0 caps)"]},
        {"record_id": "V090_REPAIR2_UBC_PA_0T20_180bp", "kind": "DNA", "accession": "Repaired_UBC_pA_segment", "coords_1based": "1-180", "strand": "+", "native_intervals": ["AATAAA PAS retained"], "engineered_edits": ["G7->GGCGGCG", "T20->TTGTGTTTGTTGTTGTGTTG (1 representative segment in FASTA; 9 full donors pending fold-in)"]},
        {"record_id": "V090_REPAIR3_LOCUS3_CXCL10_ARM5_MULTIMIR_PDL1SYN6PLUS_4248bp", "kind": "DNA", "accession": "GRCh38:chr4_CXCL10 + engineered_payload", "coords_1based": "1-4248", "strand": "+", "native_intervals": ["1-425 (native CXCL10 LHA, max_h=7)", "3824-4248 (native CXCL10 RHA)"], "engineered_edits": ["426-3823 synthetic miR-E 5p-bulge + SERPINB9(P50453) + PD-L1[SYN6+](Q9NZQ7, CDS antiORF 286->19 aa; full-donor antiORF 400->134 aa)"]},
        {"record_id": "V090_SAFECELL_TBP_CHR6_3UTR_IRES_ICASP9_WT_3380bp", "kind": "DNA", "accession": "GRCh38:chr6:170571563-170572965 + M81861.1 + M57764.1", "coords_1based": "1-3380", "strand": "+", "native_intervals": ["1-700 (TBP LHA)", "701-703 (stop TAA)", "704-1267 (EMCV IRES)", "2456-2680 (bGH pA)", "2681-3380 (TBP RHA, native T13)"], "engineered_edits": ["1268-2455 codon-engineered iCasp9(WT) CDS"]},
        {"record_id": "V090_SAFECELL_TBP_CHR6_3UTR_IRES_ICASP9_D315A_COMPARATOR_3380bp", "kind": "DNA", "accession": "GRCh38:chr6:170571563-170572965 + M81861.1 + M57764.1", "coords_1based": "1-3380", "strand": "+", "native_intervals": ["1-700 (TBP LHA)", "701-703 (stop TAA)", "704-1267 (EMCV IRES)", "2456-2680 (bGH pA)", "2681-3380 (TBP RHA, native T13)"], "engineered_edits": ["1268-2455 codon-engineered iCasp9(D315A) CDS"]},
        {"record_id": "V090_SAFECELL_ACTB_CHR7_3UTR_IRES_ICASP8_3323bp", "kind": "DNA", "accession": "GRCh38:chr7:5527048-5528450 + M81861.1 + M57764.1", "coords_1based": "1-3323", "strand": "-", "native_intervals": ["1-700 (ACTB LHA)", "701-703 (stop TAG)", "704-1267 (EMCV IRES)", "2399-2623 (bGH pA)", "2624-3323 (ACTB RHA, native T16)"], "engineered_edits": ["1268-2398 codon-engineered iCasp8 CDS"]},
        {"record_id": "V090_SAFECELL_CDK1_CHR10_3UTR_IRES_HSVTK_3323bp", "kind": "DNA", "accession": "GRCh38:chr10:60793273-60794675 + M81861.1 + M57764.1", "coords_1based": "1-3323", "strand": "+", "native_intervals": ["1-700 (CDK1 LHA)", "701-703 (stop TAG)", "704-1267 (EMCV IRES)", "2399-2623 (bGH pA)", "2624-3323 (CDK1 RHA)"], "engineered_edits": ["1268-2398 codon-engineered HSV1-TK(Q9QNF7) CDS"]},
        {"record_id": "V090_D1B_LEAN_K2_LOCUS2_CXCL10_SERPINB9_PDL1SYN6PLUS_3928bp", "kind": "DNA", "accession": "GRCh38:chr4_CXCL10 + engineered_payload", "coords_1based": "1-3928", "strand": "+", "native_intervals": ["1-425 (native CXCL10 LHA, max_h=7)", "3504-3928 (native CXCL10 RHA)"], "engineered_edits": ["426-3503 synthetic SERPINB9(P50453) + PD-L1[SYN6+](Q9NZQ7)"]},
        {"record_id": "V090_DESIGN_Y_V3_TM_MINIFH_MONO_V2_PDGFRB_SHORTSTALK_CDS_1371bp", "kind": "DNA", "accession": "Engineered_CDS(UniProt:P08603+P09619)", "coords_1based": "1-1371", "strand": "+", "native_intervals": [], "engineered_edits": ["1-1371 codon-engineered TM-mini-FH-mono-v2 PDGFRB short-stalk CDS"]},
        {"record_id": "V090_DESIGN_Y_V3_TM_MINIFH_MONO_V2_CD8A_C164S_C181S_CDS_1440bp", "kind": "DNA", "accession": "Engineered_CDS(UniProt:P08603+P01732)", "coords_1based": "1-1440", "strand": "+", "native_intervals": [], "engineered_edits": ["1-1440 codon-engineered TM-mini-FH-mono-v2 CD8A(C164S,C181S) CDS"]},
        {"record_id": "V090_DESIGN_Y_V3_CD59_TERMINAL_MAC_CDS_387bp", "kind": "DNA", "accession": "Engineered_CDS(UniProt:P13987)", "coords_1based": "1-387", "strand": "+", "native_intervals": [], "engineered_edits": ["1-387 codon-engineered CD59 CDS"]},
        {"record_id": "V090_PROT_TM_MINIFH_MONO_V2_PDGFRB_MATURE_438aa", "kind": "PROTEIN", "accession": "UniProt:P08603[19..265,1107..1231]+P09619[531..561]", "coords_1based": "1-438", "strand": "N/A", "native_intervals": ["CFH SCR1-4+K265", "CFH SCR19-20", "PDGFRB TM"], "engineered_edits": ["(G4S)4 inter-domain linker", "(G4S)3 stalk linker"]},
        {"record_id": "V090_PROT_TM_MINIFH_MONO_V2_CD8A_MATURE_461aa", "kind": "PROTEIN", "accession": "UniProt:P08603[19..265,1107..1231]+P01732[138..206]", "coords_1based": "1-461", "strand": "N/A", "native_intervals": ["CFH SCR1-4+K265", "CFH SCR19-20", "CD8A hinge-TM"], "engineered_edits": ["(G4S)4 linker", "CD8A C164S, C181S"]},
        {"record_id": "V090_PROT_CD59_MATURE_77aa", "kind": "PROTEIN", "accession": "UniProt:P13987", "coords_1based": "26-102", "strand": "N/A", "native_intervals": ["100% native mature CD59"], "engineered_edits": []},
        {"record_id": "V090_PROT_ICASP9_WT_395aa", "kind": "PROTEIN", "accession": "UniProt:P62942+P55211[135..416]", "coords_1based": "1-395", "strand": "N/A", "native_intervals": ["FKBP12", "CASP9 catalytic"], "engineered_edits": ["FKBP12 F36V", "SGGGS linker"]},
        {"record_id": "V090_PROT_ICASP9_D315A_395aa", "kind": "PROTEIN", "accession": "UniProt:P62942+P55211[135..416]", "coords_1based": "1-395", "strand": "N/A", "native_intervals": ["FKBP12", "CASP9 catalytic"], "engineered_edits": ["FKBP12 F36V", "SGGGS linker", "CASP9 D315A"]},
        {"record_id": "V090_PROT_ICASP8_WT_CAT_376aa", "kind": "PROTEIN", "accession": "UniProt:P62942+Q14790[217..479]", "coords_1based": "1-376", "strand": "N/A", "native_intervals": ["FKBP12", "CASP8 catalytic"], "engineered_edits": ["FKBP12 F36V", "SGGGS linker"]},
        {"record_id": "V090_PROT_HSV1_TK_376aa", "kind": "PROTEIN", "accession": "UniProt:Q9QNF7", "coords_1based": "1-376", "strand": "N/A", "native_intervals": ["100% native HSV1-TK"], "engineered_edits": []},
        {"record_id": "V090_PROT_SERPINB9_WT_376aa", "kind": "PROTEIN", "accession": "UniProt:P50453", "coords_1based": "1-376", "strand": "N/A", "native_intervals": ["100% native human SERPINB9"], "engineered_edits": []},
        {"record_id": "V090_PROT_CATALASE_WT_527aa", "kind": "PROTEIN", "accession": "UniProt:P04040", "coords_1based": "1-527", "strand": "N/A", "native_intervals": ["100% native human Catalase"], "engineered_edits": []},
    ]
    require_cond(len(provenance_manifest) == 26 and {x["record_id"] for x in provenance_manifest} == set(by_id.keys()), "26-record provenance manifest mismatch")

    return {
        "zero_fabricated_or_rng_dna_verified": True,
        "retrieval_date_utc": EMBEDDED_AUTHENTIC_ASSETS["retrieval_date_utc"],
        "fasta_file": fasta_path.name,
        "fasta_sha256": fasta_sha,
        "fasta_record_count": len(fasta_recs),
        "aav6_packaging_scope_note": "All reported single-AAV6 sizes (donor + 290 bp ITR allowance <= 4,700 bp) are arithmetic headroom calculations ONLY, NOT wet-lab AAV6 packaging or full-genome homogeneity assays (which remain prospective Stage-0 G34-01 readouts).",
        "native_vs_synthetic_hygiene_scope": {
            "synthetic_caps_scope": "GC100 <= 72%, GC50 <= 78%, max_homopolymer <= 6 nt apply strictly to engineered/synthetic payload intervals (ARM1B[501..3474], ARM5[426..3823], D1bK2[426..3503], internal essential-locus cassettes, and engineered CDSs).",
            "full_record_universal_invariants": "0 T20 and 0 disjoint DR/IR >= 20 bp hold across ALL 17 full-length DNA records (native + synthetic combined).",
            "disclosed_native_genomic_outliers": {
                "TBP_RHA_700bp_native_homopolymer": 13,
                "ACTB_RHA_700bp_native_homopolymer": 16,
                "CXCL10_LHA_425bp_native_homopolymer": 7,
                "B2M_RHA_500bp_native_max_gc50_pct": 82,
                "cHS4_U78775_1_250_native_gc100_gc50_pct": [81, 86],
                "CBX3_700bp_native_gc100_gc50_pct": [84, 88],
            },
            "dna_17_records_full_repeat_audit": dna_full_repeat_audit,
        },
        "authentic_regulatory_modules": {
            "cHS4_0C9_U78775_2": {
                "provenance": reg["cHS4_0C9_v090"]["accession"],
                "contiguous_accession": "ENA:U78775.2:1-250(+)",
                "native_bases_matched": 246,
                "unresolved_flanking_bases": 0,
                "edits_applied": "U78775.2 C20T/C21A (breaks C9 pos 17..25 inside Footprint I VEZF1 site) + IIP-0026/0031 C79T/C80A",
                "footprint_i_vezf1_altered": True,
                "vezf1_primary_reference": "Dickson et al. 2010 PLoS Genet (PMID:20062523, Figs. 4 & 6): Footprint I binds VEZF1 which mediates anti-silencing DNA-methylation protection independently of CTCF FII and USF1/2 FIV.",
                "functional_qualification_status": "FUNCTIONALLY_UNQUALIFIED_PENDING_VARIANT_BARRIER_ASSAY",
                "inherited_anti_silencing_credit_withdrawn": True,
                "ctcf_fii_sequence_intact": True,
                "usf1_2_fiv_sequence_intact": True,
                "hygiene": chs4_h,
            },
            "EEF1A1_core_GRCh38_230bp": {
                "coords": reg["EEF1A1_core_GRCh38_230bp"]["coords"],
                "transcript": reg["EEF1A1_core_GRCh38_230bp"]["transcript"],
                "tata_motif_observed": "TATATAA (pos 168..174, GTATATAAG); literal TATAAA hexamer is absent",
                "hygiene": eef_h,
            },
            "CBX3_A2UCOE_GRCh38_700bp": {
                "coords": reg["CBX3_A2UCOE_GRCh38_700bp"]["coords"],
                "transcript": reg["CBX3_A2UCOE_GRCh38_700bp"]["transcript"],
                "reference_pmid": "25605798",
                "functional_qualification_status": "FUNCTIONALLY_UNQUALIFIED_PENDING_ARCHIVED_BARRIER_AND_SPLICING_ASSAY",
                "inherited_anti_silencing_credit_withdrawn": True,
                "interval_vs_literature_disclosure": "Authentic GRCh38 700-bp interval starting at ENST00000396386 TSS differs from the exact 674-bp fragment tested in Muller-Kuller et al. 2015 (PMID:25605798), which also documented promoter-originating transcription and aberrant splicing in some vector contexts; Gate 34 enforces construct-hash-bound archived long-term expression stability plus absence of aberrant splicing/promoter leakage (else HOLD).",
                "replaces_shipped_hnrnpa2b1_455_coords": reg["CBX3_A2UCOE_GRCh38_700bp"]["replaces_hnrnpa2b1_455_coords"],
                "hygiene": cbx3_h,
            },
            "CXCL10_NFkB_ISRE_GRCh38_260bp": {
                "coords": reg["CXCL10_NFkB_ISRE_GRCh38_260bp"]["coords"],
                "transcript": reg["CXCL10_NFkB_ISRE_GRCh38_260bp"]["transcript"],
                "hygiene": cxcl10_h,
            },
            "EMCV_IRES_M81861_1_567bp": {
                "accession": reg["EMCV_IRES_M81861_1_567bp"]["accession"],