{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Summary figure: RAC2 allelic series, gnomAD constraint, and phenotype overlap of IMD73A/B/C",
  "timestamp": "2026-11-19 04:27:17",
  "code": "\nimport matplotlib.pyplot as plt\nimport numpy as np, pandas as pd\n\nfig = plt.figure(figsize=(14.5,8.6))\ngs = fig.add_gridspec(2,2, height_ratios=[1.05,1], hspace=0.42, wspace=0.26)\n\n# ---------- Panel A: RAC2 protein domain map with the three disease allele classes ----------\naxA = fig.add_subplot(gs[0,:])\nL=192\naxA.add_patch(plt.Rectangle((1,0.42),L-1,0.18, fc=\"#E8E8EC\", ec=\"#5A5A66\", lw=1.2))\n# functional motifs of Rho GTPases (RAC2 numbering)\nmotifs=[(10,17,\"P-loop / G1\\n(GxxxxGK[S/T])\",\"#4C78A8\"),\n        (30,38,\"Switch I / G2\\n(effector loop)\",\"#F58518\"),\n        (57,75,\"Switch II / G3\",\"#54A24B\"),\n        (115,118,\"G4 (NKxD)\",\"#B279A2\"),\n        (158,160,\"G5 (SAK)\",\"#9D755D\"),\n        (124,135,\"insert region\",\"#72B7B2\"),\n        (183,192,\"polybasic + CAAX\\n(prenylation)\",\"#E45756\")]\nfor s,e,lab,c in motifs:\n    axA.add_patch(plt.Rectangle((s,0.42),max(e-s,2),0.18, fc=c, ec=\"none\", alpha=0.88))\n    axA.text((s+e)/2,0.33,lab,ha=\"center\",va=\"top\",fontsize=7.2,color=c,linespacing=1.1)\nfor x in [1,50,100,150,192]:\n    axA.plot([x,x],[0.40,0.42],color=\"#5A5A66\",lw=1)\n    axA.text(x,0.385,str(x),ha=\"center\",va=\"top\",fontsize=7,color=\"#5A5A66\")\n\nvariants=[(\"p.Trp56Ter\",56,\"IMD73C (AR, biallelic LOF)\",\"#C03221\",\"o\"),\n          (\"p.Asp57Asn\",57,\"IMD73A (AD, dominant negative)\",\"#1F4E79\",\"s\"),\n          (\"p.Pro34His\",34,\"IMD73A (AD, dominant negative)\",\"#1F4E79\",\"s\"),\n          (\"p.Glu62Lys\",62,\"IMD73B (AD, gain of function)\",\"#2E7D32\",\"^\"),\n          (\"p.Asn92Thr\",92,\"IMD73B (AD, gain of function)\",\"#2E7D32\",\"^\"),\n          (\"p.Gln61Lys\",61,\"IMD73B-like (activating)\",\"#2E7D32\",\"^\"),\n          (\"p.Pro29His\",29,\"reported P/LP (RAC2)\",\"#777777\",\"D\"),\n          (\"p.Arg68Trp\",68,\"biallelic, GOF-like (2026)\",\"#C03221\",\"o\")]\nlv={}\nfor i,(nm,pos,grp,c,mk) in enumerate(variants):\n    y=0.72+0.10*(i%3)\n    axA.plot([pos,pos],[0.60,y-0.015],color=c,lw=1.1,ls=\"-\")\n    axA.plot(pos,y,marker=mk,color=c,ms=8,mec=\"white\",mew=0.8)\n    axA.text(pos,y+0.035,nm,ha=\"center\",va=\"bottom\",fontsize=7.6,color=c)\n    lv[grp]=(c,mk)\nhs=[plt.Line2D([],[],marker=m,color=c,ls=\"\",ms=8,label=g) for g,(c,m) in lv.items()]\naxA.legend(handles=hs, loc=\"lower right\", fontsize=7.8, frameon=False, ncol=2)\naxA.set_xlim(-6,215); axA.set_ylim(0.12,1.08); axA.axis(\"off\")\naxA.set_title(\"A  RAC2 (HGNC:9802, UniProt P15153, 192 aa) allelic series: IMD73C is the recessive loss-of-function form\",\n              fontsize=10.5, loc=\"left\", weight=\"bold\")\n\n# ---------- Panel B: gnomAD v4 constraint ----------\naxB = fig.add_subplot(gs[1,0])\nmet=[\"o/e LoF\",\"o/e missense\",\"pLI\",\"LOEUF (o/e LoF upper)\"]\nval=[0.0416,0.5018,0.99996,0.1975]\ncols=[\"#C03221\",\"#F58518\",\"#1F4E79\",\"#C03221\"]\nb=axB.barh(met,val,color=cols,alpha=0.85)\naxB.axvline(1.0,color=\"#999\",ls=\"--\",lw=1)\naxB.text(1.0,3.55,\"neutral = 1.0\",fontsize=7.5,color=\"#777\",ha=\"center\")\nfor r_,v in zip(b,val): axB.text(v+0.02,r_.get_y()+r_.get_height()/2,f\"{v:.3f}\",va=\"center\",fontsize=8.5)\naxB.set_xlim(0,1.25); axB.set_xlabel(\"value\", fontsize=9)\naxB.set_title(\"B  RAC2 is strongly constrained in gnomAD v4\\n1 observed vs 24.0 expected LoF alleles; 0 pLoF homozygotes\",\n              fontsize=9.6, loc=\"left\", weight=\"bold\")\naxB.tick_params(labelsize=8.5)\nfor s in [\"top\",\"right\"]: axB.spines[s].set_visible(False)\n\n# ---------- Panel C: phenotype comparison across the 3 RAC2 disorders (HPO annotation counts) ----------\naxC = fig.add_subplot(gs[1,1])\nphen=[\"Impaired neutrophil\\nchemotaxis\",\"Low TRECs\",\"Low B cells\",\"Low IgG\",\"Low IgM\",\n      \"Recurrent respiratory\\ninfections\",\"Leukocytosis\",\"Leukopenia /\\nlymphopenia\"]\n# 1 = annotated in HPO for that disease, 0.35 = reported in literature but not in HPO, 0 = absent/opposite\nM=np.array([\n [1,1,1],      # chemotaxis defect (A,B,C) - C inferred from disease name\n [1,0.35,1],   # low TRECs\n [0,1,1],      # low B cells\n [0,1,1],      # low IgG\n [0,0,1],      # low IgM\n [0.35,1,1],   # recurrent resp inf\n [1,0,0],      # leukocytosis\n [0,1,0.35],   # leukopenia/lymphopenia\n])\nim=axC.imshow(M, cmap=\"YlOrRd\", vmin=0, vmax=1, aspect=\"auto\")\naxC.set_xticks([0,1,2]); axC.set_xticklabels([\"IMD73A\\nAD, DN\\nOMIM 608203\",\"IMD73B\\nAD, GOF\\nOMIM 618986\",\"IMD73C\\nAR, LOF\\nOMIM 618987\"],fontsize=8)\naxC.set_yticks(range(len(phen))); axC.set_yticklabels(phen,fontsize=8)\nfor i in range(M.shape[0]):\n    for j in range(M.shape[1]):\n        s={1.0:\"HPO\",0.35:\"lit\",0.0:\"\"}[M[i,j]]\n        axC.text(j,i,s,ha=\"center\",va=\"center\",fontsize=7.2,\n                 color=\"white\" if M[i,j]>0.6 else \"#444\")\naxC.set_title(\"C  Phenotype overlap of the three RAC2 disorders\\n(HPO = curated annotation, lit = case-report only)\",\n              fontsize=9.6, loc=\"left\", weight=\"bold\")\nplt.show()\n\nprint(\"Cumulative gnomAD v4 pLoF allele frequency in RAC2 (crude carrier proxy):\")\nac, an = 60, 1.46e6\nprint(f\"  summed pLoF AC = {ac}, approx AN = {an:.0f}, cumulative AF ~ {ac/an:.2e}\")\nprint(f\"  predicted biallelic LOF frequency (random mating, no het advantage) ~ {(ac/an)**2:.2e}  i.e. ~1 in {1/((ac/an)**2):,.0f}\")\n",
  "plot_number": 1
}