{
  "filename": "plot_7.png",
  "iteration": 5,
  "description": "Quantify the population attributable fraction and annual case burden of germline ATM heterozygosity",
  "timestamp": "2026-11-26 21:26:48",
  "code": "\nimport numpy as np, pandas as pd\nimport matplotlib.pyplot as plt\n\n# Population impact of ATM heterozygosity, from values already established in this investigation\nq      = 0.00199        # ATM P/LP allele frequency, gnomAD v4 (finding #2)\ncarrier= 2*q*(1-q)      # heterozygote frequency\nRR     = {\"Breast (female)\":2.10,\"Pancreas\":4.21,\"Prostate (aggressive)\":2.58,\"Ovary\":1.57}\n# annual US incident cases (SEER 2024 estimates, rounded)\nCASES  = {\"Breast (female)\":310720,\"Pancreas\":66440,\"Prostate (aggressive)\":60000,\"Ovary\":19680}\n\nrows=[]\nfor site,rr in RR.items():\n    paf = carrier*(rr-1)/(1+carrier*(rr-1))        # population attributable fraction\n    pcase = carrier*rr/(1+carrier*(rr-1))          # carrier prevalence among cases\n    rows.append({\"site\":site,\"RR\":rr,\n                 \"carriers_among_cases_pct\":100*pcase,\n                 \"PAF_pct\":100*paf,\n                 \"US_cases_per_yr\":CASES[site],\n                 \"ATM_carrier_cases_per_yr\":round(CASES[site]*pcase),\n                 \"excess_cases_per_yr\":round(CASES[site]*paf)})\ndf=pd.DataFrame(rows)\nprint(f\"ATM heterozygote frequency: {carrier:.5f} (1 in {1/carrier:.0f})\\n\")\nprint(df.round(3).to_string(index=False))\nprint(f\"\\nTotal ATM-carrier cancer cases per year across these 4 sites: {df.ATM_carrier_cases_per_yr.sum():,}\")\nprint(f\"Total excess (attributable) cases per year: {df.excess_cases_per_yr.sum():,}\")\n\n# How many carriers exist, and how many ever develop breast cancer?\nUS_F = 168e6\nncarr_f = US_F*carrier\nprint(f\"\\nEstimated US female ATM P/LP carriers: {ncarr_f:,.0f}\")\nprint(f\"Of these, lifetime breast cancer (23.4%, finding #12): {ncarr_f*0.234:,.0f}\")\nprint(f\"Expected A-T births per year (US, 3.6M births, q^2): {3.6e6*q*q:,.0f}\")\n\nfig,ax=plt.subplots(figsize=(8,5))\nx=np.arange(len(df)); w=0.38\nax.bar(x-w/2, df.carriers_among_cases_pct, w, color=\"#4878a8\", label=\"ATM carriers among cases (%)\")\nax.bar(x+w/2, df.PAF_pct, w, color=\"#c44e52\", label=\"Population attributable fraction (%)\")\nax.axhline(100*carrier, ls=\"--\", c=\"k\", lw=1)\nax.text(2.6, 100*carrier+0.03, f\"carrier frequency in general population ({100*carrier:.2f}%)\", fontsize=8, ha=\"right\")\nfor i,(a,b,n) in enumerate(zip(df.carriers_among_cases_pct, df.PAF_pct, df.ATM_carrier_cases_per_yr)):\n    ax.text(i-w/2, a+0.02, f\"{a:.2f}%\", ha=\"center\", fontsize=8)\n    ax.text(i+w/2, b+0.02, f\"{b:.2f}%\", ha=\"center\", fontsize=8)\nax.set_xticks(x); ax.set_xticklabels(df.site, fontsize=9)\nax.set_ylabel(\"Percent\")\nax.set_title(\"Population impact of germline ATM heterozygosity\\ncarrier enrichment among cases and attributable fraction by site\", fontsize=11)\nax.legend(fontsize=9); ax.grid(axis=\"y\", alpha=0.3)\nplt.tight_layout(); plt.show()\n",
  "plot_number": 7
}