scripts/extract_ring1_corpus.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/extract_ring1_corpus.py · SHA-256: eee6ac565ed0fb16…
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "INS",
"ensembl": "ENSG00000254647",
"pattern": r"\b(INS-DRiP|preproinsulin signal peptide|insulin signal peptide|PPI15-24|insulin B9-23)\b",
"region_class": "Signal_Peptide_Leader",
"functional_gate": "Gate2_Autoantigen_or_Neoantigen_Stealth",
"evaded": ["IAA_Insulin_Preproinsulin_Leader", "INS_DRiP_Cryptic_ORF"],
"default_modality": "Signal_Peptide_or_Domain_Swap",
"default_promoter": "Lineage_Locked_INS_G6PC2_PDX1",
},
{
"symbol": "CHGA",
"ensembl": "ENSG00000100604",
"pattern": r"\b(CHGA|chromogranin A|WE14|BDC2\.5|hybrid insulin peptide)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate2_Autoantigen_or_Neoantigen_Stealth",
"evaded": ["ChromograninA_CHGA_WE14", "Hybrid_Insulin_Peptide_HIP"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "TGM2",
"ensembl": "ENSG00000198959",
"pattern": r"\b(TGM2|transglutaminase 2|deamidat)\b",
"region_class": "Catalytic_or_Kinase_Domain",
"functional_gate": "Gate2_Autoantigen_or_Neoantigen_Stealth",
"evaded": ["Hybrid_Insulin_Peptide_HIP"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "IAPP",
"ensembl": "ENSG00000121351",
"pattern": r"\b(IAPP|hIAPP|islet amyloid polypeptide|amylin|pramlintide)\b",
"region_class": "Amyloidogenic_Core_Motif",
"functional_gate": "Gate4_Intrinsic_Amyloid_or_Viral_Receptor_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "CXADR",
"ensembl": "ENSG00000154639",
"pattern": r"\b(CXADR|coxsackievirus and adenovirus receptor|CAR-SIV)\b",
"region_class": "Specific_Exon_or_Splice_Isoform",
"functional_gate": "Gate4_Intrinsic_Amyloid_or_Viral_Receptor_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "IFIH1",
"ensembl": "ENSG00000115267",
"pattern": r"\b(IFIH1|MDA5|rs1990760|A946T)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate4_Intrinsic_IFN_JAK_STAT_NFkB_Block",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "CD55",
"ensembl": "ENSG00000196352",
"pattern": r"\b(CD55)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate3_Complement_ADCC_IBMIR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Viral_or_Synthetic_CAG_EF1a_CMV",
},
{
"symbol": "CD59",
"ensembl": "ENSG00000085063",
"pattern": r"\b(CD59)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate3_Complement_ADCC_IBMIR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Viral_or_Synthetic_CAG_EF1a_CMV",
},
{
"symbol": "ENTPD1",
"ensembl": "ENSG00000138185",
"pattern": r"\b(ENTPD1|CD39)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate3_Complement_ADCC_IBMIR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Viral_or_Synthetic_CAG_EF1a_CMV",
},
{
"symbol": "THBD",
"ensembl": "ENSG00000178726",
"pattern": r"\b(THBD|thrombomodulin)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate3_Complement_ADCC_IBMIR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Viral_or_Synthetic_CAG_EF1a_CMV",
},
{
"symbol": "CASP9",
"ensembl": "ENSG00000132906",
"pattern": r"\b(iCasp9|inducible caspase-9|AP1903|rimiducid|HSV-TK|suicide switch)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate5_Suicide_Safety_Switch",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "SafeHarbor_KI_AAVS1_GAPDH_CLYBL",
"default_promoter": "Housekeeping_GAPDH_ACTB_B2M",
},
{
"symbol": "GLIS3",
"ensembl": "ENSG00000107249",
"pattern": r"\b(GLIS3)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate4_Intrinsic_ER_Stress_UPR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Endogenous_Native_Promoter",
},
{
"symbol": "TET2",
"ensembl": "ENSG00000168769",
"pattern": r"\b(TET2)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate4_Intrinsic_IFN_JAK_STAT_NFkB_Block",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "ISG15",
"ensembl": "ENSG00000187608",
"pattern": r"\b(ISG15)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate4_Intrinsic_Amyloid_or_Viral_Receptor_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Endogenous_Native_Promoter",
},
{
"symbol": "SEC31A",
"ensembl": "ENSG00000138674",
"pattern": r"\b(SEC31A|Sec31A)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate4_Intrinsic_ER_Stress_UPR_Shield",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "PADI4",
"ensembl": "ENSG00000159339",
"pattern": r"\b(PADI4|PAD4|NETosis|cl-amidine)\b",
"region_class": "Catalytic_or_Kinase_Domain",
"functional_gate": "Gate3_Macrophage_DonotEatMe",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "SmallMolecule_Pharmacological_Modulator",
"default_promoter": "Not_Applicable_KO",
},
{
"symbol": "CD200",
"ensembl": "ENSG00000091972",
"pattern": r"\b(CD200|CD99)\b",
"region_class": "Transgene_cDNA_Cassette",
"functional_gate": "Gate3_Macrophage_DonotEatMe",
"evaded": ["None_Not_Antigen_Specific"],
"default_modality": "Lentiviral_or_Transposon_OE",
"default_promoter": "Viral_or_Synthetic_CAG_EF1a_CMV",
},
{
"symbol": "HLA-B",
"ensembl": "ENSG00000234745",
"pattern": r"\b(HLA-B-restricted|HLA-B\s+hyper-expression|HLA-B-/-)\b",
"region_class": "Whole_Gene_Coding_CDS",
"functional_gate": "Gate2_Allo_HLA_ClassI_or_II",
"evaded": ["Allogeneic_HLA_DSA_or_TCR"],
"default_modality": "CRISPR_Cas9_KO",
"default_promoter": "Not_Applicable_KO",
},
]
# Canonical Biological Entity Dictionary for Causal Graph Node Normalization (46 Nodes across Gates 1-5)
CANONICAL_NODE_PATTERNS: list[tuple[str, str, str]] = [
# (Node_ID, Node_Type_Enum, Regex_Pattern)
("HLA_DR3_DR4_T1DE1_T1DE2_Endotype_Architecture", "Lineage_Identity_or_Maturation_State", r"\b(HLA-DR3|HLA-DR4|DR3-DQ2|DR4-DQ8|DR3-T1D|DR4-T1D|T1DE1|T1DE2|IAA-first|GADA-first|endotype)\b"),
("MastCell_Histamine_CPA3_TPSAB1_Axis", "Immune_or_Abiotic_Stressor", r"\b(mast cell|histamine|tryptase|CPA3|TPSAB1|FcεRI|cromolyn|ketotifen|cetirizine)\b"),
("PMN_Neutrophil_NETosis_PAD4_CD99_CD200_Axis", "Immune_or_Abiotic_Stressor", r"\b(polymorphonuclear|\bPMN\b|\bPMNs\b|NETosis|neutrophil extracellular trap|PAD4|PADI4|CD99|CD200|myeloperoxidase)\b"),
("RIPK1_RIPK3_MLKL_Necroptosis_and_Ferroptosis_Axis", "Cell_Survival_or_Death_Pathway", r"\b(RIPK1|RIPK3|MLKL|pMLKL|necroptosis|necrostatin|Nec-1|ferroptosis|GPX4|CXCL16|OxLDL)\b"),
("B2M_HLA_Class_I_Complex", "Surface_Ligand_or_Antigen_Presentation", r"\b(B2M|beta-2-microglobulin|HLA-A|HLA-B|HLA-C|HLA-ABC|MHC class I\b|MHC-I\b)\b"),
("CIITA_HLA_Class_II_Complex", "Surface_Ligand_or_Antigen_Presentation", r"\b(CIITA|HLA-DR|HLA-DQ|HLA-DP|MHC class II\b|MHC-II\b)\b"),
("CD47_SIRPa_DonotEatMe_Axis", "Surface_Ligand_or_Antigen_Presentation", r"\b(CD47|SIRP\s*alpha|SIRPα)\b"),
("HLA_E_NKG2A_Inhibitory_Axis", "Surface_Ligand_or_Antigen_Presentation", r"\b(HLA-E|Qa-1b|NKG2A|VMAPRTLVL)\b"),
("PVR_TIGIT_MICA_MICB_NKG2D_Axis", "Surface_Ligand_or_Antigen_Presentation", r"\b(PVR|CD155|TIGIT|MICA|MICB|ULBP1|ULBP2|NKG2D)\b"),
("PD_L1_CD274_Checkpoint", "Surface_Ligand_or_Antigen_Presentation", r"\b(PD-L1|PDL1|CD274|PD-1)\b"),
("HVEM_CD40_BTN3A1_Costimulation", "Surface_Ligand_or_Antigen_Presentation", r"\b(HVEM|TNFRSF14|CD40|CD80|CD86|BTN3A1|CTLA4|CTLA-4)\b"),
("FasL_FASLG_Treg_Tolerance_Signal", "Surface_Ligand_or_Antigen_Presentation", r"\b(FasL|SA-FasL|FASLG|CD95L)\b"),
("IL2_TGFb_IL10_FOXP3_Treg_Induction", "Secreted_Hormone_or_Chemokine_DAMP", r"\b(FOXP3|FoxP3|Treg|regulatory T cell|IL-10|TGF-beta|TGFB1|IL-2 mutein|2B10)\b"),
("CXCL10_CXCR3_Chemokine_Recruitment", "Secreted_Hormone_or_Chemokine_DAMP", r"\b(CXCL10|IP-10|CXCL9|CXCL11|CCL5|CXCR3)\b"),
("IFNg_IFNa_IL1b_TNFa_Cytokine_Challenge", "Immune_or_Abiotic_Stressor", r"\b(IFN-gamma|IFNγ|IFN-alpha|IFNα|IL-1beta|IL-1β|TNF-alpha|TNFα|pro-inflammatory cytokine)\b"),
("TYK2_JAK1_STAT1_IRF1_Signaling", "Signaling_Kinase_or_TF", r"\b(TYK2|JAK1|JAK2|STAT1|STAT2|IRF1|IRF-1|ruxolitinib|BMS-986165|SOCS1|PSMB8|TAP1)\b"),
("TNFAIP3_A20_NFkB_JNK_Brake", "Signaling_Kinase_or_TF", r"\b(TNFAIP3|\bA20\b|NF-kB|NF-κB)\b"),
("PTPN2_Phosphatase_STAT1_Brake", "Signaling_Kinase_or_TF", r"\b(PTPN2|TC-PTP)\b"),
("RNLS_Glycolytic_NADPH_GSH_Redox_Shield", "Organelle_or_Metabolic_State", r"\b(RNLS|Rnls|renalase|pargyline|NADPH|GSH:GSSG|glutathione)\b"),
("ER_Stress_UPR_IRE1_PERK_CHOP_TXNIP", "Organelle_or_Metabolic_State", r"\b(ER stress|unfolded protein response|UPR|IRE1|XBP1|sXBP1|PERK|ATF4|ATF6|CHOP|DDIT3|TXNIP|BiP|HSPA5|MANF|thapsigargin|tunicamycin|DTT|Akita)\b"),
("SERPINB9_GranzymeB_Perforin_Apoptosis_Axis", "Cell_Survival_or_Death_Pathway", r"\b(SERPINB9|PI-9|granzyme|perforin|caspase-3|cleaved caspase)\b"),
("SLC30A8_ZnT8_Granule_Zinc_Autoantigen", "Gene_or_Protein_Edit", r"\b(SLC30A8|ZnT8|ZnT8A)\b"),
("G6PC2_IGRP_Glycolytic_Autoantigen", "Gene_or_Protein_Edit", r"\b(G6PC2|IGRP)\b"),
("GAD2_GAD65_GABA_Paracrine_Autoantigen", "Gene_or_Protein_Edit", r"\b(GAD2|GAD65|GADA|\bGABA\b)\b"),
("INS_Preproinsulin_Signal_Peptide_DRiP", "Surface_Ligand_or_Antigen_Presentation", r"\b(preproinsulin|insulin signal peptide|PPI15-24|INS-DRiP|insulin B9-23)\b"),
("Hypoimmune_HIP_B2M_CIITA_CD47_Edit", "Gene_or_Protein_Edit", r"\b(hypoimmune|HIP\s+(?:p-islet|pseudoislet|islet|iEC|iPSC|cell|mouse|mice|graft))\b"),
("CHGA_WE14_Hybrid_Insulin_Peptide_HIP", "Surface_Ligand_or_Antigen_Presentation", r"\b(hybrid insulin peptide|WE14|proinsulin[-\s]chromogranin|chromogranin A)\b"),
("IAPP_Amyloid_Oligomer_Inflammasome", "Organelle_or_Metabolic_State", r"\b(IAPP|hIAPP|islet amyloid|amylin|pramlintide|NLRP3)\b"),
("CXADR_IFIH1_Enterovirus_CVB_Infection", "Immune_or_Abiotic_Stressor", r"\b(CXADR|CAR-SIV|Coxsackie|CVB3|CVB4|enterovirus|IFIH1|MDA5)\b"),
("CD55_CD59_THBD_Complement_IBMIR_Axis", "Surface_Ligand_or_Antigen_Presentation", r"\b(CD55|CD59|CD46|CD39|ENTPD1|THBD|thrombomodulin|IBMIR|complement|tissue factor)\b"),
("Stage7_3D_Suspension_Cytoarchitecture", "Biophysical_or_Vascular_Cue", r"\b(Stage 7|3D suspension|3D aggregat|reaggregat|cluster diameter|microwell|AggreWell|organoid)\b"),
("MAFA_NKX6_1_PDX1_BetaCell_Identity", "Lineage_Identity_or_Maturation_State", r"\b(MAFA|NKX6\.1|NKX6-1|PDX1|NEUROG3|NKX2\.2|ISL1|UCN3)\b"),
("WNT4_ESRRG_Mitochondrial_OXPHOS_Switch", "Organelle_or_Metabolic_State", r"\b(WNT4|ESRRG|ERR\s*gamma|ERRγ|OXPHOS|mitochondrial respiration|OCR|ECAR|LDHA|HK2|SLC16A1|MCT1|pyruvate)\b"),
("Biphasic_GSIS_and_Calcium_Coupling", "Secreted_Hormone_or_Chemokine_DAMP", r"\b(GSIS|glucose-stimulated insulin secretion|biphasic|first-phase|perifusion|C-peptide|calcium influx|KATP)\b"),
("Alpha_GCG_Delta_SST_Paracrine_CounterRegulation", "Secreted_Hormone_or_Chemokine_DAMP", r"\b(glucagon|\bGCG\b|somatostatin|\bSST\b|alpha cell|delta cell|paracrine)\b"),
("OffTarget_SLC18A1_Enterochromaffin_Depletion", "Lineage_Identity_or_Maturation_State", r"\b(SLC18A1|enterochromaffin|SC-EC|TPH1|LMX1A)\b"),
("ZM447439_Aurora_G1_CellCycle_Exit", "Small_Molecule_or_Growth_Factor", r"\b(ZM447439|aurora kinase|Ki-67|G0/G1|cell cycle exit|teratoma|iCasp9|HSV-TK)\b"),
("CD31_CD146_Microvessel_Inosculation", "Biophysical_or_Vascular_Cue", r"\b(microvessel|microvascular fragment|CD31|CD146|inosculation|anastomos|revasculariz|endothelial|HUVEC|iEC|VEGFA)\b"),
("Hypoxia_72h_Ischemia_and_O2_Scaffolds", "Biophysical_or_Vascular_Cue", r"\b(hypoxia|ischemi|oxygen tension|pO2|CaO2|calcium peroxide|perfluorocarbon|subcutaneous|omental|intramuscular)\b"),
("Alginate_or_Macrodevice_Encapsulation_FBR", "Biophysical_or_Vascular_Cue", r"\b(alginate|macroencapsul|microencapsul|TheraCyte|PEC-Direct|PEC-Encap|hydrogel|fibrotic|foreign body)\b"),
("Alloreactive_CD8_CD4_TCell_or_DSA_Attack", "Immune_or_Abiotic_Stressor", r"\b(alloreactive|allogeneic T|allograft rejection|PBMC|donor-specific antibod|DSA|CD8\+ T|CD4\+ T|cytotoxic T)\b"),
("Primary_NK_or_Macrophage_Innate_Cytotoxicity", "Immune_or_Abiotic_Stressor", r"\b(NK cell|natural killer|missing-self|missing self|macrophage|phagocytos)\b"),
("BetaCell_Survival_and_Glycemic_Cure", "Cell_Survival_or_Death_Pathway", r"\b(normoglycemi|diabetes reversal|graft survival|beta-cell survival|cell viability|apoptosis|cell death|specific lysis)\b"),
]
def resolve_paper_scoped_hip_label(paper_text: str) -> str | None:
"""Paper-scoped HIP acronym guard (IIP-0039 / DEC-118): resolve bare HIP to
CHGA_WE14_Hybrid_Insulin_Peptide_HIP ONLY when the same paper explicitly expands
'hybrid insulin peptide' (never keyed on author/research group), and to
Hypoimmune_HIP_B2M_CIITA_CD47_Edit when the same paper expands 'hypoimmune'."""
tl = (paper_text or "").lower()
has_hybrid = "hybrid insulin peptide" in tl
has_hypo = "hypoimmune" in tl
if has_hybrid and not has_hypo:
return "CHGA_WE14_Hybrid_Insulin_Peptide_HIP"
if has_hypo and not has_hybrid:
return "Hypoimmune_HIP_B2M_CIITA_CD47_Edit"
return None
def resolve_canonical_node(text: str, default_type: str = "Signaling_Kinase_or_TF") -> tuple[str | None, str | None]:
"""Resolves a clause to its primary canonical biological node ID + schema node type, or (None, None) if none matched."""