{
  "filename": "plot_5.png",
  "iteration": 3,
  "description": "Corrected allelic series for SERPINA6 using primary-source binding data, and the mass-action compensation measured directly in the original CBG Lyon proband",
  "timestamp": "2026-11-28 09:16:12",
  "code": "\nimport numpy as np, matplotlib.pyplot as plt\n\n# ---------------------------------------------------------------------\n# A. CBG Lyon index case, Emptoz-Bonneton 2000 (PMID 10634411)\n#    43-year-old woman, chronic asthenia and hypotension.\n# ---------------------------------------------------------------------\ntot_pt_lo, tot_pt_hi = 22.0, 61.0          # nmol/L, repeated morning cortisol\ntot_ref_lo, tot_ref_hi = 204.0, 546.0      # nmol/L reference\nfree_pct_pt_lo, free_pct_pt_hi = 8.7, 9.7  # % dialysable\nfree_pct_ref_lo, free_pct_ref_hi = 2.9, 3.9\n\ntot_pt = (tot_pt_lo + tot_pt_hi)/2\ntot_ref = (tot_ref_lo + tot_ref_hi)/2\nfp_pt = (free_pct_pt_lo + free_pct_pt_hi)/2\nfp_ref = (free_pct_ref_lo + free_pct_ref_hi)/2\n\nfree_pt, free_ref = tot_pt*fp_pt/100, tot_ref*fp_ref/100\n\nprint(\"=== CBG Lyon index case (PMID 10634411) ===\")\nprint(f\"Total cortisol      : {tot_pt:6.1f} vs {tot_ref:6.1f} nmol/L   ratio {tot_pt/tot_ref:.3f}  ({(1-tot_pt/tot_ref)*100:.0f}% reduction)\")\nprint(f\"Free fraction       : {fp_pt:6.1f} vs {fp_ref:6.1f} %        ratio {fp_pt/fp_ref:.2f}  ({fp_pt/fp_ref:.1f}-fold rise)\")\nprint(f\"Free cortisol       : {free_pt:6.2f} vs {free_ref:6.2f} nmol/L   ratio {free_pt/free_ref:.3f}\")\nprint(f\"Serum CBG           :   24.0 vs   44.0 mg/L     ratio {24/44:.3f}\")\nprint(f\"Association const Ka:   0.12 vs   0.82 L/nmol   ratio {0.12/0.82:.3f}  ({0.82/0.12:.1f}-fold loss)\")\nprint(f\"\\nCompensation index  : free ratio / total ratio = {(free_pt/free_ref)/(tot_pt/tot_ref):.2f}\")\nprint(\"ACTH and 24 h urinary cortisol were both normal, so the HPA axis is intact.\")\n\n# ---------------------------------------------------------------------\n# B. Corrected allelic series. Recombinant data (PMID 22948765) show the\n#    variant PROTEIN is dead; heterozygote serum shows ~50% capacity\n#    because half the molecules are wild type.\n# ---------------------------------------------------------------------\nseries = [\n  # name,                class,      ELISA CBG %, binding capacity %, recombinant protein activity\n  (\"CBG null, heterozygote\",      \"quantity\",  50,  50, \"n/a\"),\n  (\"CBG null, HOMOZYGOTE (n=3)\",  \"quantity\",   0,   0, \"n/a\"),\n  (\"CBG Santiago het (L5Cfs*26)\", \"quantity\",  50,  50, \"n/a\"),\n  (\"CBG Montevideo het\",          \"quantity\",  50,  50, \"n/a\"),\n  (\"CBG Lyon D367N het\",          \"quality\",  100,  50, \"zero\"),\n  (\"CBG Leuven L93H het\",         \"quality\",  100,  65, \"reduced\"),\n  (\"CBG Athens W371S het\",        \"quality\",  100,  50, \"zero\"),\n  (\"Athens/Lyon compound het\",    \"quality\",  100,   0, \"zero\"),\n  (\"CBG A224S (S246A) polymorph\", \"neutral\",  100, 100, \"normal\"),\n]\nprint(\"\\n=== Corrected allelic series ===\")\nprint(f\"{'Variant':<30} {'class':<9} {'ELISA %':>8} {'binding %':>10}  recombinant\")\nfor nm, cl, el, bc, rec in series:\n    print(f\"{nm:<30} {cl:<9} {el:>8} {bc:>10}  {rec}\")\n\nprint(\"\\nThe dissociation that matters diagnostically:\")\nprint(\"  CBG Lyon / Athens heterozygotes: ELISA 100% of reference, binding capacity 50%.\")\nprint(\"  Immunoassay alone reports these patients as entirely normal.\")\n\n# ---------------------------------------------------------------------\n# Figure\n# ---------------------------------------------------------------------\nfig, axes = plt.subplots(1, 2, figsize=(14, 5.4))\n\nax = axes[0]\ncats = [\"Total cortisol\", \"Free fraction (%)\", \"Free cortisol\", \"Serum CBG\", \"CBG affinity (Ka)\"]\nratios = [tot_pt/tot_ref, fp_pt/fp_ref, free_pt/free_ref, 24/44, 0.12/0.82]\ncols = [\"#C44E52\", \"#55A868\", \"#DD8452\", \"#4C72B0\", \"#4C72B0\"]\nb = ax.bar(cats, ratios, color=cols, edgecolor=\"black\", linewidth=0.6)\nax.axhline(1.0, color=\"black\", ls=\"--\", lw=1.2)\nfor xi, v in enumerate(ratios):\n    ax.text(xi, v+0.08, f\"{v:.2f}\", ha=\"center\", fontsize=10)\nax.set_ylabel(\"Patient value / reference value\")\nax.set_ylim(0, 3.0)\nax.set_xticklabels(cats, rotation=20, ha=\"right\", fontsize=9)\nax.set_title(\"A. CBG Lyon index case: total cortisol falls 89%,\\n\"\n             \"but the free fraction rises 2.6-fold so free cortisol is near normal\", fontsize=10)\n\nax = axes[1]\ncmap = {\"quantity\":\"#4C72B0\", \"quality\":\"#DD8452\", \"neutral\":\"#999999\"}\nnames = [s[0] for s in series]\ny = np.arange(len(series)); h = 0.38\nax.barh(y-h/2, [s[2] for s in series], h, label=\"CBG by immunoassay (ELISA)\",\n        color=[cmap[s[1]] for s in series], edgecolor=\"black\", linewidth=0.5)\nax.barh(y+h/2, [s[3] for s in series], h, label=\"cortisol-binding capacity\",\n        color=[cmap[s[1]] for s in series], edgecolor=\"black\", linewidth=0.5,\n        hatch=\"///\", alpha=0.72)\nax.axvline(100, color=\"black\", ls=\":\", lw=1)\nax.set_yticks(y); ax.set_yticklabels(names, fontsize=8.5)\nax.set_xlabel(\"Percent of reference value\")\nax.set_xlim(0, 118); ax.invert_yaxis(); ax.legend(fontsize=8, loc=\"lower right\")\nax.set_title(\"B. Quality-defect alleles are invisible to immunoassay:\\n\"\n             \"normal ELISA, half the binding capacity\", fontsize=10)\n\nplt.tight_layout(); plt.show()\n",
  "plot_number": 5
}