{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Map reported pathogenic ATP6AP2 variants onto the protein domain structure, coloured by variant class and clinical entity",
  "timestamp": "2026-11-26 22:21:01",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport pandas as pd\n\n# ATP6AP2 (UniProt O75787), 350 aa, type I transmembrane protein.\n# Domain boundaries from UniProt feature annotation.\nL = 350\ndomains = [\n    (\"Signal peptide\",        1,  16, \"#9aa0a6\"),\n    (\"Luminal / extracellular domain\", 17, 302, \"#4c78a8\"),\n    (\"Transmembrane helix\",  303, 323, \"#e45756\"),\n    (\"Cytoplasmic tail\",     324, 350, \"#72b7b2\"),\n]\n# Exon 4 encodes the 32 residues deleted in the delta-e4 isoform\nexon4 = (94, 125)\n\n# Reported pathogenic variants, grouped by clinical entity\nvariants = pd.DataFrame([\n    # cdna, protein/effect, residue position for plotting, entity, class\n    (\"c.168+6T>A\", \"intron 2 donor, exon 2 skip\", 56,  \"XLID + epilepsy + parkinsonism\", \"splicing\"),\n    (\"c.321C>T\",   \"p.D107D (ESE)\",               107, \"MRXSH (OMIM 300423)\",            \"splicing\"),\n    (\"c.345C>T\",   \"p.S115S\",                     115, \"XPDS (OMIM 300911)\",             \"splicing\"),\n    (\"de novo splice\", \"exon skip, CNS degeneration\", 125, \"Fulminant neurodegeneration\", \"splicing\"),\n    (\"c.185G>A\",   \"p.G62E\",                      62,  \"ATP6AP2-CDG (OMIM 301045)\",      \"missense\"),\n    (\"c.212G>A\",   \"p.R71H\",                      71,  \"ATP6AP2-CDG (OMIM 301045)\",      \"missense\"),\n    (\"c.293T>C\",   \"p.L98S\",                      98,  \"ATP6AP2-CDG (OMIM 301045)\",      \"missense\"),\n], columns=[\"cdna\", \"effect\", \"pos\", \"entity\", \"vclass\"])\n\nfig, ax = plt.subplots(figsize=(13, 5.2))\n\nfor name, s, e, col in domains:\n    ax.add_patch(mpatches.Rectangle((s, 0), e - s, 1.0, facecolor=col, edgecolor=\"white\", lw=1.2))\n    if e - s > 25:\n        ax.text((s + e) / 2, 0.5, name, ha=\"center\", va=\"center\", color=\"white\", fontsize=8.5, weight=\"bold\")\n\n# exon 4 region\nax.add_patch(mpatches.Rectangle((exon4[0], -0.42), exon4[1] - exon4[0], 0.3,\n                                facecolor=\"#f2b701\", edgecolor=\"black\", lw=0.8))\nax.text((exon4[0] + exon4[1]) / 2, -0.62, \"exon 4 (32 aa lost in $\\\\Delta$e4 isoform)\",\n        ha=\"center\", va=\"top\", fontsize=8.5)\n\n# furin / S1P cleavage producing soluble (P)RR and the M8-9 fragment\nax.annotate(\"furin cleavage\\n(soluble (P)RR | M8-9)\", xy=(275, 1.02), xytext=(275, 1.62),\n            ha=\"center\", fontsize=8, arrowprops=dict(arrowstyle=\"->\", lw=1.1))\n\ncolmap = {\"splicing\": \"#d62728\", \"missense\": \"#1f77b4\"}\noffsets = {}\nfor i, r in variants.iterrows():\n    y = 2.35 + (i % 2) * 0.55\n    ax.plot([r.pos, r.pos], [1.0, y - 0.12], color=colmap[r.vclass], lw=1.1)\n    ax.plot(r.pos, 1.0, \"o\", color=colmap[r.vclass], ms=6, zorder=5)\n    ax.text(r.pos, y, f\"{r.cdna}\\n{r.effect}\\n{r.entity}\", ha=\"center\", va=\"bottom\",\n            fontsize=7.4, color=colmap[r.vclass])\n\nax.set_xlim(-12, 372)\nax.set_ylim(-1.1, 4.3)\nax.set_yticks([])\nax.set_xlabel(\"ATP6AP2 residue (UniProt O75787, 350 aa)\")\nax.set_title(\"Reported pathogenic ATP6AP2 variants: splicing variants give neurological disease,\\n\"\n             \"extracellular-domain missense variants give the glycosylation/liver phenotype\")\nfor sp in [\"top\", \"right\", \"left\"]:\n    ax.spines[sp].set_visible(False)\nhandles = [mpatches.Patch(color=colmap[\"splicing\"], label=\"splicing variant (reduces full-length dosage)\"),\n           mpatches.Patch(color=colmap[\"missense\"], label=\"missense variant (unstable protein, impaired ATP6AP1 binding)\")]\nax.legend(handles=handles, loc=\"upper left\", frameon=False, fontsize=8.5)\nplt.tight_layout()\nplt.show()\n\nprint(variants.to_string(index=False))\n",
  "plot_number": 1
}