{
  "filename": "plot_4.png",
  "iteration": 3,
  "description": "Create comprehensive annotation conflict map showing all GO annotation sources and conflicts for CRMP1",
  "timestamp": "2026-07-05 06:36:40",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\n# Create a comprehensive annotation conflict diagram\nfig, ax = plt.subplots(figsize=(14, 9))\nax.set_xlim(0, 14)\nax.set_ylim(0, 10)\nax.axis('off')\n\n# Title\nax.text(7, 9.5, 'CRMP1 GO Annotation Conflict Map', \n        ha='center', fontsize=16, fontweight='bold')\nax.text(7, 9.1, 'Showing all hydrolase-related annotations and their evidence sources',\n        ha='center', fontsize=10, color='gray')\n\n# GO Term boxes\ngo_terms = {\n    'GO:0016787': ('hydrolase activity', 2, 7.5, '#d5e8d4'),\n    'GO:0016810': ('hydrolase, C-N\\n(not peptide)', 5, 7.5, '#d5e8d4'),\n    'GO:0016812': ('hydrolase, C-N\\ncyclic amides', 8, 7.5, '#ffe6e6'),\n    'GO:0004157': ('dihydropyrimidinase\\nactivity', 11, 7.5, '#ffe6e6'),\n}\n\nfor go_id, (label, x, y, color) in go_terms.items():\n    rect = mpatches.FancyBboxPatch((x-1.2, y-0.5), 2.4, 1.0, \n                                     boxstyle=\"round,pad=0.1\", \n                                     facecolor=color, edgecolor='black', linewidth=1.5)\n    ax.add_patch(rect)\n    ax.text(x, y+0.1, go_id, ha='center', va='center', fontsize=8, fontweight='bold')\n    ax.text(x, y-0.2, label, ha='center', va='center', fontsize=7)\n\n# Arrows between GO terms (is_a)\nfor x1, x2 in [(3.2, 3.8), (6.2, 6.8), (9.2, 9.8)]:\n    ax.annotate('', xy=(x2, 7.5), xytext=(x1, 7.5),\n                arrowprops=dict(arrowstyle='->', color='gray', lw=1.5))\n\n# Annotation boxes below\ny_ann = 5.5\n\n# GO:0016787 - IEA\nrect1 = mpatches.FancyBboxPatch((0.5, y_ann-0.4), 2.6, 0.8,\n                                 boxstyle=\"round,pad=0.05\", facecolor='#fff2cc', edgecolor='orange')\nax.add_patch(rect1)\nax.text(1.8, y_ann+0.05, 'enables [IEA]\\nInterPro IPR006680', ha='center', fontsize=7)\nax.annotate('', xy=(2, 7.0), xytext=(1.8, y_ann+0.4),\n            arrowprops=dict(arrowstyle='->', color='orange', lw=1))\n\n# GO:0016810 - IEA\nrect2 = mpatches.FancyBboxPatch((3.7, y_ann-0.4), 2.6, 0.8,\n                                 boxstyle=\"round,pad=0.05\", facecolor='#fff2cc', edgecolor='orange')\nax.add_patch(rect2)\nax.text(5, y_ann+0.05, 'enables [IEA]\\nInterPro IPR011059', ha='center', fontsize=7)\nax.annotate('', xy=(5, 7.0), xytext=(5, y_ann+0.4),\n            arrowprops=dict(arrowstyle='->', color='orange', lw=1))\n\n# GO:0016812 - CONFLICT\nrect3a = mpatches.FancyBboxPatch((6.5, y_ann+0.1), 2.6, 0.5,\n                                  boxstyle=\"round,pad=0.05\", facecolor='#ffcccc', edgecolor='red', linewidth=2)\nax.add_patch(rect3a)\nax.text(7.8, y_ann+0.35, 'enables [IBA] \u2190 CONFLICT', ha='center', fontsize=7, color='red', fontweight='bold')\n\nrect3b = mpatches.FancyBboxPatch((6.5, y_ann-0.55), 2.6, 0.5,\n                                  boxstyle=\"round,pad=0.05\", facecolor='#ccffcc', edgecolor='green', linewidth=2)\nax.add_patch(rect3b)\nax.text(7.8, y_ann-0.3, 'NOT|enables [IBA] \u2713', ha='center', fontsize=7, color='green', fontweight='bold')\n\nax.annotate('', xy=(8, 7.0), xytext=(7.8, y_ann+0.6),\n            arrowprops=dict(arrowstyle='->', color='red', lw=1.5))\n\n# GO:0004157 - NOT\nrect4a = mpatches.FancyBboxPatch((9.7, y_ann-0.55), 2.6, 0.5,\n                                  boxstyle=\"round,pad=0.05\", facecolor='#ccffcc', edgecolor='green', linewidth=2)\nax.add_patch(rect4a)\nax.text(11, y_ann-0.3, 'NOT|enables [IBA] \u2713', ha='center', fontsize=7, color='green', fontweight='bold')\n\nax.annotate('', xy=(11, 7.0), xytext=(11, y_ann-0.05),\n            arrowprops=dict(arrowstyle='->', color='green', lw=1.5))\n\n# TAS annotation (root cause)\nrect_tas = mpatches.FancyBboxPatch((3.5, 3.0), 7, 1.0,\n                                    boxstyle=\"round,pad=0.1\", facecolor='#ffe0b2', edgecolor='#e65100', linewidth=2)\nax.add_patch(rect_tas)\nax.text(7, 3.7, 'ROOT CAUSE: PMID:8973361 (Hamajima et al. 1996)', \n        ha='center', fontsize=9, fontweight='bold', color='#e65100')\nax.text(7, 3.3, 'Named proteins \"DHPase-Related\" based on 57-59% sequence identity only', \n        ha='center', fontsize=8)\nax.text(7, 3.0, 'TAS evidence assigned to GO:0004157 and GO:0006139 \u2014 NO enzymatic assay in paper', \n        ha='center', fontsize=7, style='italic')\n\nax.annotate('', xy=(5, y_ann-0.4), xytext=(5.5, 4.0),\n            arrowprops=dict(arrowstyle='->', color='#e65100', lw=1.5, linestyle='--'))\nax.annotate('', xy=(7.8, y_ann-0.55), xytext=(7.5, 4.0),\n            arrowprops=dict(arrowstyle='->', color='#e65100', lw=1.5, linestyle='--'))\n\n# Evidence summary box\nevidence_box = mpatches.FancyBboxPatch((0.3, 0.3), 13.4, 2.2,\n                                        boxstyle=\"round,pad=0.1\", facecolor='#e8f5e9', edgecolor='#2e7d32')\nax.add_patch(evidence_box)\nax.text(7, 2.2, 'COMPUTATIONAL & STRUCTURAL EVIDENCE (THIS ANALYSIS)', \n        ha='center', fontsize=10, fontweight='bold', color='#2e7d32')\nevidence_lines = [\n    '\u2022 6/8 active site residues substituted (EMBOSS Needle alignment, 52.8% identity)',\n    '\u2022 Only 1/6 zinc-coordinating sidechains retained (AlphaFold structural analysis, pLDDT >96)',\n    '\u2022 GLY at position 332 \u2014 no sidechain, zinc coordination physically impossible',\n    '\u2022 Active site loss universal across all metazoan CRMPs (human \u2192 Drosophila)',\n    '\u2022 Crystal structures explicitly state: \"they have lost the enzymatic active site\" (PMID:28044206)',\n    '\u2022 UniProt names CRMP1 \"Inactive dihydropyrimidinase\" \u2014 no EC number assigned',\n]\nfor i, line in enumerate(evidence_lines):\n    ax.text(1, 1.85 - i*0.25, line, fontsize=7, color='#1b5e20')\n\n# Legend\nlegend_items = [\n    mpatches.Patch(facecolor='#fff2cc', edgecolor='orange', label='IEA (domain-based)'),\n    mpatches.Patch(facecolor='#ffcccc', edgecolor='red', label='Conflicting positive IBA'),\n    mpatches.Patch(facecolor='#ccffcc', edgecolor='green', label='NOT annotation (correct)'),\n    mpatches.Patch(facecolor='#ffe0b2', edgecolor='#e65100', label='TAS root cause'),\n]\nax.legend(handles=legend_items, loc='upper left', fontsize=8, framealpha=0.9)\n\nplt.tight_layout()\nplt.savefig('/tmp/annotation_conflict_map.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Annotation conflict map saved\")\n",
  "plot_number": 4
}