{
  "filename": "plot_4.png",
  "iteration": 4,
  "description": "RAC2 p.Trp56Ter NMD prediction and domain loss, plus a 10-feature differential-diagnosis comparison of IMD73C with CGD, LAD-I, DOCK2, DOCK8, WAS, CVID, SCN and the two dominant RAC2 disorders",
  "timestamp": "2026-11-19 04:47:02",
  "code": "\nimport numpy as np, pandas as pd\nimport matplotlib.pyplot as plt\nfrom matplotlib.patches import Rectangle\n\n# RefSeq NM_002872.5 (fetched this iteration): CDS 122..700, 7 exons in cDNA coordinates\nexons=[(1,156),(157,228),(229,346),(347,409),(410,569),(570,702),(703,1472)]\ncds_s,cds_e=122,700\nprint(f\"CDS {cds_e-cds_s+1} nt -> {(cds_e-cds_s+1)//3 - 1} aa + stop (UniProt P15153 = 192 aa)\")\nptc_c = cds_s + 56*3 - 1                      # last nt of codon 56 in cDNA coords\nptc_exon=[i for i,(a,b) in enumerate(exons,1) if a<=ptc_c<=b][0]\nlast_junction=exons[-2][1]\nprint(f\"p.Trp56Ter PTC at cDNA nt {ptc_c-2}-{ptc_c} (CDS nt {56*3-2}-{56*3}), in exon {ptc_exon} of 7\")\nprint(f\"final exon-exon junction at cDNA nt {last_junction}; PTC is {last_junction-ptc_c} nt upstream\")\nprint(f\"50-nt rule: {last_junction-ptc_c} > 50 -> nonsense-mediated decay PREDICTED (computational)\")\nprint(f\"Any escaping protein would retain 55/192 = {55/192*100:.1f}% of RAC2\\n\")\n\ndom={\"G1 P-loop\":(10,17),\"Switch I / G2\":(30,40),\"Switch II / G3\":(57,75),\n     \"G4 NKxD\":(115,118),\"insert region\":(124,135),\"G5 SAK\":(158,160),\n     \"polybasic region\":(183,188),\"CAAX motif\":(189,192)}\nfull={\"G1 P-loop\":\"G1 P-loop GxxxxGK[S/T], GTP phosphate binding\",\n      \"Switch I / G2\":\"Switch I / G2 effector loop, p67phox and PAK contact\",\n      \"Switch II / G3\":\"Switch II / G3 DTAGQE, nucleotide-state switch and effector contact\",\n      \"G4 NKxD\":\"G4 NKxD, guanine base specificity\",\n      \"insert region\":\"insert region 124-135, required for NADPH oxidase activation\",\n      \"G5 SAK\":\"G5 SAK, guanine base contact\",\n      \"polybasic region\":\"C-terminal polybasic region, membrane targeting and RhoGDI binding\",\n      \"CAAX motif\":\"CAAX geranylgeranylation motif, membrane anchor\"}\nprint(\"Functional elements relative to the truncation point (residue 55 is the last translated):\")\nfor k,(a,b) in dom.items():\n    print(f\"  {full[k]:72s} {a:3d}-{b:3d}  {'LOST' if a>55 else 'retained'}\")\n\nfeat=[\"Impaired respiratory burst\",\"Impaired neutrophil chemotaxis\",\"T-cell lymphopenia / low TRECs\",\n      \"B-cell defect, hypogammaglobulinemia\",\"Peripheral neutrophilia\",\"Neutrophil granule abnormality\",\n      \"Autoimmunity / glomerulonephritis\",\"Severe eczema / high IgE\",\"Autosomal recessive inheritance\",\n      \"Poor wound healing / delayed cord separation\"]\ndz={\"IMD73C (RAC2 biallelic LOF, W56X)\":[1,1,1,1,1,1,1,0,1,1],\n    \"IMD73A (RAC2 dominant-negative D57N)\":[1,1,0,0,1,1,0,0,0,1],\n    \"IMD73B (RAC2 dominant-activating E62K/N92T)\":[1,1,1,1,0,1,0,0,0,0],\n    \"Chronic granulomatous disease (CYBB, NCF1)\":[1,0,0,0,0,0,1,0,1,0],\n    \"Leukocyte adhesion deficiency I (ITGB2)\":[0,1,0,0,1,0,0,0,1,1],\n    \"DOCK2 deficiency\":[1,1,1,1,0,0,0,0,1,0],\n    \"DOCK8 deficiency\":[0,1,1,1,0,0,1,1,1,0],\n    \"Wiskott-Aldrich syndrome (WAS)\":[0,1,1,1,0,0,1,1,0,0],\n    \"Common variable immunodeficiency\":[0,0,0,1,0,0,1,0,0,0],\n    \"Severe congenital neutropenia (ELANE)\":[0,0,0,0,0,1,0,0,0,1]}\nM=pd.DataFrame(dz, index=feat).T\nref=M.iloc[0].values.astype(int)\nM[\"shared\"]=[(r.values.astype(int)*ref).sum() for _,r in M.iterrows()]\nM[\"Jaccard\"]=[(r.values.astype(int)*ref).sum()/(((r.values.astype(int)+ref)>0).sum()) for _,r in M[feat].iterrows()]\nprint(\"\\nOverlap with IMD73C across 10 discriminating features:\")\nprint(M[[\"shared\",\"Jaccard\"]].sort_values(\"Jaccard\",ascending=False).round(3).to_string())\nuniq=[f for f in feat if M.loc[\"IMD73C (RAC2 biallelic LOF, W56X)\",f]==1 and M[f].iloc[1:].sum()<=2]\nprint(\"\\nFeatures that are rare among the differentials and so carry discriminating weight:\", uniq)\n\nfig=plt.figure(figsize=(15.5,9.8))\nax=fig.add_axes([0.055,0.70,0.90,0.235])\nax.add_patch(Rectangle((1,0.35),192,0.3, fc=\"#eceff4\", ec=\"#888\", lw=0.8))\ncols={\"G1 P-loop\":\"#4C78A8\",\"Switch I / G2\":\"#54A24B\",\"Switch II / G3\":\"#F58518\",\"G4 NKxD\":\"#72B7B2\",\n      \"insert region\":\"#B279A2\",\"G5 SAK\":\"#9D755D\",\"polybasic region\":\"#E45756\",\"CAAX motif\":\"#111111\"}\nfor k,(a,b) in dom.items():\n    ax.add_patch(Rectangle((a,0.35),max(b-a+1,2.5),0.3, fc=cols[k], ec=\"none\"))\n    ax.text((a+b)/2, 0.055, k, ha=\"center\", va=\"bottom\", fontsize=7.6, rotation=38, color=cols[k])\nax.add_patch(Rectangle((56,0.325),137,0.35, fc=\"#C03221\", alpha=0.16, ec=\"#C03221\", ls=\"--\", lw=1.3))\nax.text(126,0.72,\"deleted by p.Trp56Ter: 137 of 192 residues (71%)\", ha=\"center\", fontsize=9.3, color=\"#C03221\", weight=\"bold\")\nax.annotate(\"p.Trp56Ter\", xy=(56,0.35), xytext=(44,-0.20), ha=\"center\", fontsize=9.2, color=\"#C03221\", weight=\"bold\",\n            arrowprops=dict(arrowstyle=\"-|>\", color=\"#C03221\", lw=1.5))\nfor pos,lab,col in [(34,\"P34H\",\"#2b6cb0\"),(57,\"D57N\",\"#2b6cb0\"),(62,\"E62K\",\"#7b341e\"),(68,\"R68W\",\"#555555\"),(92,\"N92T\",\"#7b341e\")]:\n    ax.plot([pos,pos],[0.66,0.84], color=col, lw=1.2)\n    ax.text(pos,0.855,lab, ha=\"center\", va=\"bottom\", fontsize=7.6, color=col)\nax.text(34,0.99,\"dominant-negative (IMD73A)\", fontsize=7.4, color=\"#2b6cb0\", ha=\"center\")\nax.text(80,0.99,\"dominant-activating (IMD73B)\", fontsize=7.4, color=\"#7b341e\", ha=\"center\")\nax.set_xlim(-8,206); ax.set_ylim(-0.30,1.18); ax.axis(\"off\")\nax.text(-6,1.15,\"A  RAC2 (UniProt P15153, 192 aa): p.Trp56Ter removes Switch II, both guanine-specificity motifs, the oxidase insert region and the CAAX membrane anchor\",\n        fontsize=10.2, weight=\"bold\", va=\"top\")\nax.text(-6,-0.21,f\"PTC at cDNA nt {ptc_c-2}-{ptc_c} of NM_002872.5, exon {ptc_exon} of 7, {last_junction-ptc_c} nt upstream of the final exon-exon junction, so nonsense-mediated decay is predicted\",\n        fontsize=8.3, color=\"#444\", va=\"top\")\n\nax2=fig.add_axes([0.285,0.085,0.455,0.525])\norder=M.sort_values(\"Jaccard\",ascending=False).index.tolist()\nD=M.loc[order,feat]\nax2.imshow(D.values.astype(float), cmap=\"Blues\", vmin=0, vmax=1.35, aspect=\"auto\")\nax2.set_xticks(range(len(feat))); ax2.set_xticklabels(feat, rotation=40, ha=\"right\", fontsize=8)\nax2.set_yticks(range(len(order))); ax2.set_yticklabels(order, fontsize=8.3)\nax2.get_yticklabels()[0].set_color(\"#C03221\"); ax2.get_yticklabels()[0].set_weight(\"bold\")\nfor i in range(len(order)):\n    for j in range(len(feat)):\n        if D.values[i,j]: ax2.text(j,i,\"+\", ha=\"center\", va=\"center\", fontsize=9, color=\"w\", weight=\"bold\")\nax2.set_xticks(np.arange(-.5,len(feat),1), minor=True); ax2.set_yticks(np.arange(-.5,len(order),1), minor=True)\nax2.grid(which=\"minor\", color=\"w\", lw=1.2); ax2.tick_params(which=\"minor\", length=0)\nax2.set_title(\"B  IMD73C against its differential diagnoses\", fontsize=10.2, weight=\"bold\", loc=\"left\", pad=8)\n\nax3=fig.add_axes([0.79,0.085,0.165,0.525])\nj=M.loc[order,\"Jaccard\"].values\nax3.barh(np.arange(len(order))[::-1], j, color=[\"#C03221\"]+[\"#4C78A8\"]*(len(order)-1))\nax3.set_yticks([]); ax3.set_xlabel(\"Jaccard similarity to IMD73C\", fontsize=8.5)\nfor i,v in enumerate(j): ax3.text(v+0.018, len(order)-1-i, f\"{v:.2f}\", va=\"center\", fontsize=7.8)\nax3.set_xlim(0,1.08); ax3.set_title(\"C  nearest mimics\", fontsize=10.2, weight=\"bold\", loc=\"left\", pad=8)\nfor s in [\"top\",\"right\"]: ax3.spines[s].set_visible(False)\nplt.show()\n",
  "plot_number": 4
}