{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Quantitative synthesis of published CBG deficiency biochemistry: plasma CBG, total cortisol, free cortisol fraction and binding affinity by SERPINA6 genotype class",
  "timestamp": "2026-11-28 08:57:34",
  "code": "\nimport numpy as np, matplotlib.pyplot as plt\n\n# ---------------------------------------------------------------\n# Published biochemical data for SERPINA6 (CBG) deficiency.\n# Sources:\n#  Torpy et al. 2001 JCEM (PMID 11502797) -- c.121G>A null kindred\n#  Emptoz-Bonneton et al. 2000 JCEM (PMID 10634411) -- CBG Lyon (D367N) proband\n#  Gagliardi, Ho & Torpy 2010 (PMID 19643166) -- affinity reductions\n#  Hill et al. 2012 JCEM (PMID 22948765) -- CBG Athens (W371S) / D367N\n# ---------------------------------------------------------------\n\nfig, axes = plt.subplots(2, 2, figsize=(12.5, 8.5))\n\n# Panel A: plasma immunoreactive CBG by genotype (Torpy 2001 null kindred)\nax = axes[0, 0]\nlabels = [\"Reference\\nrange\", \"Null\\nheterozygote\", \"Null\\nhomozygote\"]\nvals   = [41.0, 18.7, 0.0]          # ug/mL; reference midpoint of 30-52\nerrs   = [11.0, 1.3, 0.0]           # half-width of reference range; SEM for het\ncols   = [\"#4C72B0\", \"#DD8452\", \"#C44E52\"]\nax.bar(labels, vals, yerr=errs, capsize=5, color=cols, edgecolor=\"black\", linewidth=0.6)\nax.axhspan(30, 52, color=\"#4C72B0\", alpha=0.12, zorder=0)\nax.set_ylabel(\"Plasma immunoreactive CBG (ug/mL)\")\nax.set_title(\"A. CBG protein falls with null allele dose\\n(c.121G>A kindred, PMID 11502797)\", fontsize=10)\nax.text(2, 1.5, \"undetectable\", ha=\"center\", fontsize=8, style=\"italic\")\nfor i, v in enumerate(vals):\n    if v > 0:\n        ax.text(i, v + errs[i] + 1.2, f\"{v:.1f}\", ha=\"center\", fontsize=9)\n\n# Panel B: CBG Lyon proband vs reference women (Emptoz-Bonneton 2000)\nax = axes[0, 1]\nmetrics = [\"Serum CBG\\n(mg/L)\", \"Cortisol Ka\\n(L/nmol x 10)\", \"Free cortisol\\n(% of total)\"]\nref     = [44.0, 8.2, 3.4]\nref_err = [6.0, 2.9, 0.5]\npat     = [24.0, 1.2, 9.2]\nx = np.arange(len(metrics)); w = 0.36\nax.bar(x - w/2, ref, w, yerr=ref_err, capsize=4, label=\"Reference women\",\n       color=\"#4C72B0\", edgecolor=\"black\", linewidth=0.6)\nax.bar(x + w/2, pat, w, label=\"CBG Lyon proband\",\n       color=\"#C44E52\", edgecolor=\"black\", linewidth=0.6)\nax.set_xticks(x); ax.set_xticklabels(metrics, fontsize=9)\nax.legend(fontsize=8); ax.set_ylabel(\"Value (units as labelled)\")\nax.set_title(\"B. CBG Lyon (p.Asp367Asn): low CBG, 7-fold lower affinity,\\n\"\n             \"free cortisol fraction raised ~2.7x (PMID 10634411)\", fontsize=10)\n\n# Panel C: total vs free cortisol compensation\nax = axes[1, 0]\n# total morning cortisol: reference 204-546 nmol/L, proband 22-61 nmol/L\ntot_ref = (204 + 546) / 2; tot_pat = (22 + 61) / 2\nfree_ref = tot_ref * 0.034\nfree_pat = tot_pat * 0.092\ngroups = [\"Reference\", \"CBG Lyon\\nproband\"]\ntot = [tot_ref, tot_pat]; free = [free_ref, free_pat]\nx = np.arange(2); w = 0.36\nax.bar(x - w/2, tot, w, label=\"Total cortisol\", color=\"#8172B3\", edgecolor=\"black\", linewidth=0.6)\nax.bar(x + w/2, free, w, label=\"Free (unbound) cortisol\", color=\"#CCB974\", edgecolor=\"black\", linewidth=0.6)\nfor i in range(2):\n    ax.text(i - w/2, tot[i] + 8, f\"{tot[i]:.0f}\", ha=\"center\", fontsize=9)\n    ax.text(i + w/2, free[i] + 8, f\"{free[i]:.1f}\", ha=\"center\", fontsize=9)\nax.set_xticks(x); ax.set_xticklabels(groups)\nax.set_ylabel(\"Cortisol (nmol/L)\")\nax.legend(fontsize=8)\nax.set_title(\"C. Total cortisol collapses 90% while free cortisol is\\n\"\n             \"near-preserved: the core diagnostic trap\", fontsize=10)\nprint(f\"Total cortisol ratio patient/reference : {tot_pat/tot_ref:.3f}\")\nprint(f\"Free  cortisol ratio patient/reference : {free_pat/free_ref:.3f}\")\n\n# Panel D: variant catalogue, mechanism class\nax = axes[1, 1]\nvariants = [\"c.121G>A\\n(null, exon 2)\", \"D367N\\n(Lyon)\", \"W371S\\n(Athens)\",\n            \"L93H\\n(Leuven)\", \"A224S\", \"G335V\", \"T342A\"]\n# fraction of wild-type cortisol-binding activity (approximate, from cited functional work)\nactivity = [0.00, 0.00, 0.00, 0.33, 1.00, 0.85, 1.00]\nmech     = [\"quantity\", \"quality\", \"quality\", \"quality\", \"neutral\", \"quality\", \"quality\"]\ncmap = {\"quantity\": \"#C44E52\", \"quality\": \"#DD8452\", \"neutral\": \"#55A868\"}\nax.barh(variants, activity, color=[cmap[m] for m in mech], edgecolor=\"black\", linewidth=0.6)\nax.set_xlabel(\"Residual cortisol-binding activity (fraction of wild type)\")\nax.set_xlim(0, 1.15)\nhandles = [plt.Rectangle((0, 0), 1, 1, color=cmap[k]) for k in [\"quantity\", \"quality\", \"neutral\"]]\nax.legend(handles, [\"Reduced CBG quantity\", \"Reduced CBG quality/affinity\", \"No functional effect\"],\n          fontsize=8, loc=\"lower right\")\nax.set_title(\"D. SERPINA6 variants split into quantity and quality defects\\n\"\n             \"(PMIDs 11502797, 10634411, 22948765, 20226861)\", fontsize=10)\n\nplt.tight_layout()\nplt.show()\n",
  "plot_number": 1
}