{
  "filename": "plot_6.png",
  "iteration": 4,
  "description": "Retrieve RCSB PDB structures mapped to RIG-I (O95786), confirm gnomAD absence of the SMS2 variants, and draw the mechanistic causal chain for Singleton-Merten syndrome 2",
  "timestamp": "2026-11-28 22:10:52",
  "code": "\nimport requests, json\nimport matplotlib.pyplot as plt\nfrom matplotlib.patches import FancyBboxPatch, FancyArrowPatch\n\n# ---------- 1. PDB structures for RIG-I ----------\nprint(\"=\"*70,\"\\nRCSB PDB entries mapped to UniProt O95786\")\nq={\"query\":{\"type\":\"group\",\"logical_operator\":\"and\",\"nodes\":[\n     {\"type\":\"terminal\",\"service\":\"text\",\n      \"parameters\":{\"attribute\":\"rcsb_polymer_entity_container_identifiers.reference_sequence_identifiers.database_accession\",\n                    \"operator\":\"exact_match\",\"value\":\"O95786\"}},\n     {\"type\":\"terminal\",\"service\":\"text\",\n      \"parameters\":{\"attribute\":\"rcsb_polymer_entity_container_identifiers.reference_sequence_identifiers.database_name\",\n                    \"operator\":\"exact_match\",\"value\":\"UniProt\"}}]},\n   \"return_type\":\"entry\",\"request_options\":{\"paginate\":{\"start\":0,\"rows\":100}}}\ntry:\n    r=requests.post(\"https://search.rcsb.org/rcsbsearch/v2/query\",json=q,timeout=90)\n    js=r.json(); ids=[x[\"identifier\"] for x in js[\"result_set\"]]\n    print(\"total entries:\",js[\"total_count\"]); print(ids)\nexcept Exception as e:\n    print(\"ERR\",e); ids=[]\n\n# ---------- 2. gnomAD v4 allele frequency for the SMS2 variants ----------\nprint(\"\\n\"+\"=\"*70,\"\\ngnomAD v4 for RIGI SMS2 variants\")\ngq=\"\"\"query($v: String!){ variant(variantId: $v, dataset: gnomad_r4){\n        variant_id rsid genome { ac an af } exome { ac an af } } }\"\"\"\n# GRCh38 chr9 coordinates (1-based) for the three reported missense changes\ncands={\"p.Cys268Phe\":\"9-32477199-C-A\",\"p.Glu373Ala\":\"9-32470056-T-G\",\"p.Glu510Val\":\"9-32464277-T-A\"}\nfor name,vid in cands.items():\n    try:\n        rr=requests.post(\"https://gnomad.broadinstitute.org/api\",json={\"query\":gq,\"variables\":{\"v\":vid}},timeout=60).json()\n        v=rr.get(\"data\",{}).get(\"variant\")\n        if v is None:\n            print(f\"  {name:14s} {vid:22s} -> ABSENT from gnomAD v4 (no record)\")\n        else:\n            print(f\"  {name:14s} {vid:22s} -> rsid={v['rsid']} exome={v['exome']} genome={v['genome']}\")\n    except Exception as e:\n        print(f\"  {name} ERR {e}\")\n\n# ---------- 3. causal chain figure ----------\nsteps=[\n (\"1. Heterozygous missense in RIGI\\nATPase module (C268F, E373A,\\nE510V, D550A)\",\"#1a365d\"),\n (\"2. ATP binds but is not hydrolysed:\\nkinetic proofreading fails\",\"#2b6cb0\"),\n (\"3. CARD2:HEL2i autoinhibition released\\nwithout viral 5'ppp RNA\",\"#2c7a7b\"),\n (\"4. Constitutive CARD signalling\\nto MAVS on mitochondria\",\"#2f855a\"),\n (\"5. TBK1/IKKe phosphorylate IRF3/IRF7\\n-> IFN-beta transcription\",\"#68813c\"),\n (\"6. IFNAR1/2 -> JAK1/TYK2 -> ISGF3\\n-> systemic ISG signature\",\"#b7791f\"),\n]\nbranches=[\n (\"7a. Trabecular meshwork:\\nIFN-beta -> RSAD2 -> autophagy\\n-> cell loss -> raised IOP -> glaucoma\\n(demonstrated, PMID 38752537)\",\"#2b6cb0\"),\n (\"7b. Skin: keratinocyte/fibroblast ISGs\\n-> IL-23/IL-17A axis -> psoriasiform\\nplaques (demonstrated, PMID 33119735)\",\"#b7791f\"),\n (\"7c. Vessel and valve: ISG/IFN-lambda\\n-> JAK2/STAT3/BMP2 -> RUNX2\\n-> osteogenic switch -> calcification\\n(INFERRED, PMID 36537334)\",\"#c0392b\"),\n (\"7d. Bone: type I IFN -> reduced\\nosteoclast number and bone formation\\n-> osteopenia, phalangeal osteolysis\\n(model organism, PMID 31366715)\",\"#6b46c1\"),\n]\n\nfig,ax=plt.subplots(figsize=(13,10))\ny=1.0\nfor txt,c in steps:\n    ax.add_patch(FancyBboxPatch((0.30,y-0.055),0.40,0.075,boxstyle=\"round,pad=0.012\",\n                                facecolor=c,edgecolor=\"none\"))\n    ax.text(0.50,y-0.018,txt,ha=\"center\",va=\"center\",color=\"white\",fontsize=9,fontweight=\"bold\")\n    if y>0.50:\n        ax.annotate(\"\",xy=(0.50,y-0.072),xytext=(0.50,y-0.056),\n                    arrowprops=dict(arrowstyle=\"-|>\",lw=2,color=\"#444\"))\n    y-=0.105\n# branch fan\nytop=y+0.045\nfor i,(txt,c) in enumerate(branches):\n    bx=0.02+i*0.25\n    ax.annotate(\"\",xy=(bx+0.105,ytop-0.10),xytext=(0.50,ytop),\n                arrowprops=dict(arrowstyle=\"-|>\",lw=1.8,color=c))\n    ax.add_patch(FancyBboxPatch((bx,ytop-0.22),0.21,0.12,boxstyle=\"round,pad=0.012\",\n                                facecolor=c,alpha=0.90,edgecolor=\"none\"))\n    ax.text(bx+0.105,ytop-0.16,txt,ha=\"center\",va=\"center\",color=\"white\",fontsize=7.8)\nax.set_xlim(0,1); ax.set_ylim(ytop-0.27,1.03); ax.axis(\"off\")\nax.set_title(\"Causal chain in Singleton-Merten syndrome 2 (MONDO:0014575, RIGI)\\nsteps 1-6 shared, step 7 branches by tissue\",fontsize=12)\nplt.tight_layout(); plt.show()\n",
  "plot_number": 6
}