{
  "filename": "final_evidence_summary.png",
  "iteration": 2,
  "description": "Consolidated 4-panel evidence visualization for MCR-1 GO term assessment",
  "timestamp": "2026-06-23 21:44:10",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig = plt.figure(figsize=(18, 14))\n\n# Create a 2x2 grid\ngs = fig.add_gridspec(2, 2, hspace=0.35, wspace=0.3)\n\n# === Panel A: GO Term Hierarchy ===\nax1 = fig.add_subplot(gs[0, 0])\nax1.set_xlim(0, 10)\nax1.set_ylim(0, 10)\nax1.set_title(\"A. GO Term Hierarchy: Sibling Term Error\", fontsize=13, fontweight='bold', loc='left')\nax1.axis('off')\n\n# Common parent\nrect_p = mpatches.FancyBboxPatch((1.5, 8.3), 7, 0.9, boxstyle=\"round,pad=0.1\", \n                                   facecolor='#E0E0E0', edgecolor='black', linewidth=1.5)\nax1.add_patch(rect_p)\nax1.text(5, 8.75, 'GO:0016772\\ntransferase activity, transferring P-groups', \n         ha='center', va='center', fontsize=8, fontweight='bold')\n\n# Wrong branch\nrect_w = mpatches.FancyBboxPatch((0.2, 5.3), 4.3, 1.1, boxstyle=\"round,pad=0.1\", \n                                   facecolor='#FFCCCC', edgecolor='#CC0000', linewidth=2)\nax1.add_patch(rect_w)\nax1.text(2.35, 5.85, 'GO:0016776 \u2717 WRONG\\nphosphotransferase,\\nphosphate group as acceptor\\nEC 2.7.4.*', \n         ha='center', va='center', fontsize=7.5, color='#CC0000', fontweight='bold')\n\n# Correct branch\nrect_c = mpatches.FancyBboxPatch((5.5, 5.3), 4.3, 1.1, boxstyle=\"round,pad=0.1\", \n                                   facecolor='#CCFFCC', edgecolor='#006600', linewidth=2)\nax1.add_patch(rect_c)\nax1.text(7.65, 5.85, 'GO:0016780 \u2713 CORRECT\\nphosphotransferase,\\nother substituted P-groups\\nEC 2.7.8.*', \n         ha='center', va='center', fontsize=7.5, color='#006600', fontweight='bold')\n\n# Specific term\nrect_s = mpatches.FancyBboxPatch((5.5, 2.5), 4.3, 1.0, boxstyle=\"round,pad=0.1\", \n                                   facecolor='#99FF99', edgecolor='#006600', linewidth=1.5)\nax1.add_patch(rect_s)\nax1.text(7.65, 3.0, 'GO:0043838\\nPE:Kdo2-lipid A PEtN\\ntransferase (EptB-specific)', \n         ha='center', va='center', fontsize=7.5, color='#006600')\n\n# Wrong children\nrect_wc = mpatches.FancyBboxPatch((0.2, 2.5), 4.3, 1.0, boxstyle=\"round,pad=0.1\", \n                                    facecolor='#FFE0E0', edgecolor='gray', linewidth=1)\nax1.add_patch(rect_wc)\nax1.text(2.35, 3.0, 'Children: NDP kinase,\\npolyphosphate kinase,\\nphosphomevalonate kinase...', \n         ha='center', va='center', fontsize=7, color='gray')\n\n# Arrows\nax1.annotate('', xy=(2.35, 6.4), xytext=(3.5, 8.3), arrowprops=dict(arrowstyle='->', color='#CC0000', lw=2))\nax1.annotate('', xy=(7.65, 6.4), xytext=(6.5, 8.3), arrowprops=dict(arrowstyle='->', color='#006600', lw=2))\nax1.annotate('', xy=(7.65, 3.5), xytext=(7.65, 5.3), arrowprops=dict(arrowstyle='->', color='#006600', lw=1.5))\nax1.annotate('', xy=(2.35, 3.5), xytext=(2.35, 5.3), arrowprops=dict(arrowstyle='->', color='gray', lw=1))\n\n# MCR-1 label\nax1.text(5, 1.3, 'MCR-1 (EC 2.7.8.43) \u2192 belongs under GO:0016780', \n         ha='center', fontsize=10, fontweight='bold', color='navy',\n         bbox=dict(boxstyle='round,pad=0.4', facecolor='#CCE5FF', edgecolor='navy', linewidth=1.5))\n\n# === Panel B: EC2GO Mapping ===\nax2 = fig.add_subplot(gs[0, 1])\nax2.set_title(\"B. Official EC2GO Mapping Verification\", fontsize=13, fontweight='bold', loc='left')\n\ncategories = ['EC 2.7.4.* \u2192\\nGO:0016776', 'EC 2.7.8.* \u2192\\nGO:0016780', 'EC 2.7.8.* \u2192\\nGO:0016776\\n(cross-branch)']\nvalues = [21, 34, 0]\ncolors = ['#FFCCCC', '#CCFFCC', '#FFE0E0']\nedge_colors = ['#CC0000', '#006600', '#999999']\n\nbars = ax2.bar(categories, values, color=colors, edgecolor=edge_colors, linewidth=2)\nax2.set_ylabel(\"Number of EC\u2192GO mappings\", fontsize=10)\n\nfor bar, val in zip(bars, values):\n    ax2.text(bar.get_x() + bar.get_width()/2., bar.get_height() + 0.5, \n             str(val), ha='center', va='bottom', fontsize=14, fontweight='bold')\n\nax2.text(2, 27, 'ZERO cross-branch mappings\\nconfirms EC 2.7.8 \u2260 GO:0016776', \n         ha='center', fontsize=10, fontweight='bold', color='#CC0000',\n         bbox=dict(boxstyle='round,pad=0.3', facecolor='#FFF0F0', edgecolor='#CC0000'))\nax2.set_ylim(0, 40)\nax2.spines['top'].set_visible(False)\nax2.spines['right'].set_visible(False)\n\n# === Panel C: Active-Site Conservation ===\nax3 = fig.add_subplot(gs[1, 0])\nax3.set_title(\"C. Active-Site Residues: MCR-1 vs EptA\", fontsize=13, fontweight='bold', loc='left')\n\nresidues = ['E246/E244', 'T285/T282', 'N329/D326', 'K333/K330', 'H395/H385', \n            'D465/D455', 'H466/H456', 'E468/E458', 'H478/H468']\nroles = ['Zn bind', 'Nucl./Zn', 'Catalytic', 'Catalytic', 'Catalytic',\n         'Zn bind', 'Zn bind', 'Resistance', 'Catalytic']\nconserved = [1, 1, 0.5, 1, 1, 1, 1, 1, 1]  # 0.5 = conservative sub\ncolors_res = ['#2ecc71' if c == 1 else '#f39c12' if c == 0.5 else '#e74c3c' for c in conserved]\n\ny_pos = range(len(residues))\nbars = ax3.barh(y_pos, conserved, color=colors_res, edgecolor='black', height=0.6, alpha=0.8)\n\nax3.set_yticks(y_pos)\nax3.set_yticklabels([f\"{r}\\n({rl})\" for r, rl in zip(residues, roles)], fontsize=8)\nax3.set_xlim(0, 1.8)\nax3.set_xticks([])\n\nfor i, (c, res) in enumerate(zip(conserved, residues)):\n    if c == 1:\n        ax3.text(1.05, i, \"IDENTICAL \u2713\", va='center', fontsize=9, color='#006600', fontweight='bold')\n    else:\n        ax3.text(1.05, i, \"Conservative (N\u2194D)\", va='center', fontsize=9, color='#996600')\n\nax3.text(0.9, -1.3, \"8/9 identical \u2022 All essential by mutagenesis\\n\u2192 Pseudo-enzyme EXCLUDED\", \n         ha='center', fontsize=10, fontweight='bold', color='#006600',\n         bbox=dict(boxstyle='round,pad=0.3', facecolor='#E8F5E9', edgecolor='#006600'))\nax3.invert_yaxis()\nax3.spines['top'].set_visible(False)\nax3.spines['right'].set_visible(False)\nax3.spines['bottom'].set_visible(False)\n\n# === Panel D: Failure Mode Analysis ===\nax4 = fig.add_subplot(gs[1, 1])\nax4.set_title(\"D. Failure Mode Analysis Summary\", fontsize=13, fontweight='bold', loc='left')\nax4.axis('off')\n\n# Table data\ntable_data = [\n    ['#1 Granularity\\n(family vs subfamily)', 'N/A', 'Error is sibling,\\nnot granularity'],\n    ['#2 Pseudo-enzyme\\n(activity lost)', 'EXCLUDED', '8/9 residues conserved;\\ndirect assay confirms\\nPEtN transfer'],\n    ['#3 Mis-placement\\n(wrong sibling term)', 'CONFIRMED \u2605', 'GO:0016776 (EC 2.7.4)\\n\u2260 GO:0016780 (EC 2.7.8)\\nEC2GO: zero cross-maps']\n]\n\ncell_colors = [\n    ['#F0F0F0', '#F0F0F0', '#F0F0F0'],\n    ['#E8F5E9', '#E8F5E9', '#E8F5E9'],\n    ['#FFEBEE', '#FFEBEE', '#FFEBEE']\n]\n\ntable = ax4.table(cellText=table_data, \n                   colLabels=['Failure Mode', 'Status', 'Key Evidence'],\n                   cellColours=cell_colors,\n                   colColours=['#B0BEC5', '#B0BEC5', '#B0BEC5'],\n                   loc='center',\n                   cellLoc='center')\ntable.auto_set_font_size(False)\ntable.set_fontsize(9)\ntable.scale(1, 2.5)\n\n# Add verdict\nax4.text(0.5, 0.05, 'VERDICT: REFUTED \u2014 replace GO:0016776 with GO:0016780', \n         ha='center', va='center', fontsize=12, fontweight='bold', color='white',\n         transform=ax4.transAxes,\n         bbox=dict(boxstyle='round,pad=0.4', facecolor='#CC0000', edgecolor='black', linewidth=2))\n\nfig.suptitle('MCR-1 GO:0016776 Function Assignment Assessment', fontsize=16, fontweight='bold', y=0.98)\n\nplt.savefig('final_evidence_summary.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved: final_evidence_summary.png\")\n"
}