{
  "filename": "plot_3.png",
  "iteration": 1,
  "description": "Final comprehensive analysis figure with AlphaFold confidence, verdict summary, and protein family relationships",
  "timestamp": "2026-07-05 07:41:26",
  "code": "\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport requests\n\nheaders = {\"User-Agent\": \"Mozilla/5.0\", \"Accept\": \"application/json\"}\n\n# Download all three PDB files and extract pLDDT + CA coordinates\ndef get_af_data(acc):\n    url = f\"https://alphafold.ebi.ac.uk/files/AF-{acc}-F1-model_v6.pdb\"\n    resp = requests.get(url, headers=headers, timeout=30)\n    plddt = []\n    residues = []\n    ca_coords = []\n    for line in resp.text.split('\\n'):\n        if line.startswith('ATOM') and line[12:16].strip() == 'CA':\n            resnum = int(line[22:26].strip())\n            bfactor = float(line[60:66].strip())\n            x = float(line[30:38].strip())\n            y = float(line[38:46].strip())\n            z = float(line[46:54].strip())\n            plddt.append(bfactor)\n            residues.append(resnum)\n            ca_coords.append([x, y, z])\n    return np.array(residues), np.array(plddt), np.array(ca_coords)\n\nca_res, ca_plddt, ca_coords = get_af_data('Q5AMS2')\nsc_res, sc_plddt, sc_coords = get_af_data('Q08448')\nrog_res, rog_plddt, rog_coords = get_af_data('P53118')\n\nfig, axes = plt.subplots(2, 2, figsize=(16, 12))\nfig.suptitle('AlphaFold Structure Analysis: LPL1 vs ROG1', fontsize=14, fontweight='bold')\n\n# Panel A: pLDDT profiles\nax1 = axes[0, 0]\nax1.plot(ca_res, ca_plddt, 'b-', lw=1, alpha=0.8, label='Ca_LPL1 (Q5AMS2)')\nax1.plot(sc_res, sc_plddt, 'g-', lw=1, alpha=0.8, label='Sc_LPL1 (Q08448)')\nax1.plot(rog_res, rog_plddt, 'r-', lw=1, alpha=0.8, label='Sc_ROG1 (P53118)')\nax1.axhline(y=90, color='gray', ls='--', alpha=0.3)\nax1.axhline(y=70, color='gray', ls=':', alpha=0.3)\nax1.set_xlabel('Residue number')\nax1.set_ylabel('pLDDT')\nax1.set_title('A. AlphaFold Confidence (pLDDT)', fontweight='bold')\nax1.legend(fontsize=8)\nax1.set_ylim(0, 105)\n\n# Mark DUF676 domains\nax1.axvspan(14, 213, alpha=0.08, color='blue')\nax1.text(113, 5, 'Ca DUF676', fontsize=7, ha='center', color='blue')\n\n# Panel B: Domain pLDDT comparison\nax2 = axes[0, 1]\n# Ca_LPL1 regions\nregions_ca = {\n    'DUF676\\n(14-213)': ca_plddt[13:213],\n    'TM helix\\n(286-306)': ca_plddt[285:306],\n    'C-terminal\\n(350-556)': ca_plddt[349:]\n}\n# Sc_ROG1 DUF676\nregions_rog = {\n    'DUF676\\n(234-434)': rog_plddt[233:434],\n}\n\nlabels = list(regions_ca.keys())\nca_means = [np.mean(v) for v in regions_ca.values()]\nca_stds = [np.std(v) for v in regions_ca.values()]\n\nx = np.arange(len(labels))\nbars = ax2.bar(x, ca_means, 0.35, yerr=ca_stds, label='Ca_LPL1', color='#6699ff', \n               edgecolor='black', capsize=3)\n\n# Add ROG1 DUF676 for comparison\nax2.bar(3.5, np.mean(rog_plddt[233:434]), 0.35, yerr=np.std(rog_plddt[233:434]),\n        label='Sc_ROG1 DUF676', color='#ff9999', edgecolor='black', capsize=3)\n\nax2.set_ylabel('Mean pLDDT \u00b1 SD')\nax2.set_title('B. Regional AlphaFold Confidence', fontweight='bold')\nax2.set_xticks(list(x) + [3.5])\nax2.set_xticklabels(labels + ['ROG1\\nDUF676'], fontsize=8)\nax2.legend(fontsize=8)\nax2.set_ylim(0, 105)\nax2.axhline(y=90, color='gray', ls='--', alpha=0.3)\n\n# Panel C: Summary evidence table\nax3 = axes[1, 0]\nax3.axis('off')\nax3.set_title('C. Verdict Summary', fontweight='bold')\n\nverdict_text = \"\"\"\nVERDICT: OVER-ANNOTATED\n\nGO:0047372 (monoacylglycerol lipase activity)\non C. albicans LPL1 (Q5AMS2)\n\nEvidence AGAINST MAG lipase annotation:\n  \u2717 Closest ortholog (Sc_LPL1) = phospholipase B (IDA)\n  \u2717 Different PANTHER subfamily from ROG1 (SF24 vs SF62)\n  \u2717 44.4% identity with Sc_LPL1, only 25.6% with ROG1\n  \u2717 Lacks InterPro Rog1_fam (IPR016445) signature\n  \u2717 MAG and phospholipids are different substrate classes\n  \u2717 \u22652 gene duplications between ROG1 and LPL1\n\nEvidence FOR retaining GO:0004622:\n  \u2713 Sc_LPL1 has IDA for PC lysophospholipase A1\n  \u2713 Same PANTHER subfamily (SF24)\n  \u2713 Conserved catalytic GYSxG motif\n  \u2713 Shared TM helix and LD localization\n\nRECOMMENDATION: Remove GO:0047372; retain GO:0004622\n\"\"\"\n\nax3.text(0.05, 0.95, verdict_text, transform=ax3.transAxes, fontsize=9,\n         verticalalignment='top', fontfamily='monospace',\n         bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.8))\n\n# Panel D: Protein family relationship diagram\nax4 = axes[1, 1]\nax4.set_xlim(0, 10)\nax4.set_ylim(0, 10)\nax4.axis('off')\nax4.set_title('D. Functional Assignment Summary', fontweight='bold')\n\n# Three circles for the three lipase families\nfrom matplotlib.patches import Circle, FancyArrowPatch\n\n# Yju3 family - true MGL\ncircle1 = Circle((2, 7), 1.5, fill=True, facecolor='#aaddaa', edgecolor='black', lw=2)\nax4.add_patch(circle1)\nax4.text(2, 7.5, 'Yju3p Family\\n(PF12146)', ha='center', fontsize=9, fontweight='bold')\nax4.text(2, 6.5, 'PRIMARY\\nMAG Lipase\\n>90% activity', ha='center', fontsize=7, color='darkgreen')\n\n# ROG1 subfamily - secondary MAG lipase\ncircle2 = Circle((6, 7), 1.5, fill=True, facecolor='#ff9999', edgecolor='black', lw=2)\nax4.add_patch(circle2)\nax4.text(6, 7.5, 'ROG1 Subfamily\\n(SF62, PF05057)', ha='center', fontsize=9, fontweight='bold')\nax4.text(6, 6.5, 'SECONDARY\\nMAG Lipase\\n(IDA)', ha='center', fontsize=7, color='red')\n\n# LPL1 subfamily - phospholipase B\ncircle3 = Circle((6, 3), 1.5, fill=True, facecolor='#99ccff', edgecolor='black', lw=2)\nax4.add_patch(circle3)\nax4.text(6, 3.5, 'LPL1 Subfamily\\n(SF24, PF05057)', ha='center', fontsize=9, fontweight='bold')\nax4.text(6, 2.5, 'PHOSPHOLIPASE B\\n(IDA on Sc_LPL1)', ha='center', fontsize=7, color='blue')\n\n# Ca_LPL1 marker\nax4.plot(7.3, 2.5, '*', color='blue', markersize=20, zorder=10)\nax4.text(8, 2.5, 'Ca_LPL1\\n(Q5AMS2)', fontsize=8, fontweight='bold', color='blue')\n\n# Arrows showing relationships\nax4.annotate('', xy=(6, 5.5), xytext=(6, 4.5),\n            arrowprops=dict(arrowstyle='<->', color='red', lw=2))\nax4.text(6.8, 5, 'DUPLICATION\\n(different\\nsubstrates)', fontsize=7, color='red', ha='left')\n\nax4.annotate('', xy=(3.5, 7), xytext=(4.5, 7),\n            arrowprops=dict(arrowstyle='<->', color='gray', lw=1.5, ls='--'))\nax4.text(4, 7.7, 'Different\\nfamilies', fontsize=7, color='gray', ha='center')\n\n# Crossed-out arrow showing incorrect propagation\nax4.annotate('IBA\\n(incorrect?)', xy=(6, 4.5), xytext=(3, 4),\n            arrowprops=dict(arrowstyle='->', color='red', lw=1.5, ls='--'),\n            fontsize=8, color='red', ha='center',\n            bbox=dict(boxstyle='round', facecolor='lightyellow', edgecolor='red'))\n\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig('final_analysis.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Final analysis figure saved\")\n",
  "plot_number": 3
}