{
  "filename": "plot_2.png",
  "iteration": 2,
  "description": "GO term hierarchy and evidence flow diagram for CG4860 GO:0016937 annotation assessment",
  "timestamp": "2026-07-01 06:06:56",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(1, 2, figsize=(16, 7))\n\n# Panel A: GO Term Hierarchy with CG4860 annotations highlighted\nax1 = axes[0]\nax1.set_xlim(0, 10)\nax1.set_ylim(0, 12)\nax1.axis('off')\nax1.set_title('GO Term Hierarchy for\\nAcyl-CoA Dehydrogenase Activity', fontsize=12, fontweight='bold')\n\n# Draw boxes\ndef draw_box(ax, x, y, w, h, text, color, border_color='black', border_width=1):\n    rect = mpatches.FancyBboxPatch((x, y), w, h, boxstyle=\"round,pad=0.1\", \n                                     facecolor=color, edgecolor=border_color, linewidth=border_width)\n    ax.add_patch(rect)\n    ax.text(x + w/2, y + h/2, text, ha='center', va='center', fontsize=7, wrap=True)\n\n# Root\ndraw_box(ax1, 2, 10.5, 6, 0.8, 'GO:0003995\\nacyl-CoA dehydrogenase activity\\n(ISS:FlyBase via ACAD11)', '#90EE90', border_width=2)\n\n# Children of GO:0003995\ndraw_box(ax1, 0.2, 8, 3.5, 0.8, 'GO:0016937\\nshort-chain fatty acyl-CoA\\ndehydrogenase (IBA, IEA)', '#FFD700', border_color='red', border_width=3)\ndraw_box(ax1, 4.2, 8, 2.5, 0.8, 'GO:0070991\\nmedium-chain fatty\\nacyl-CoA DH', '#D3D3D3')\ndraw_box(ax1, 7, 8, 2.8, 0.8, 'GO:0004466\\nlong-chain fatty\\nacyl-CoA DH', '#D3D3D3')\n\n# Children of GO:0016937\ndraw_box(ax1, 0, 5.5, 2, 0.8, 'GO:0008470\\n3-methylbutanoyl-CoA\\nDH (IVD)', '#ADD8E6')\ndraw_box(ax1, 2.2, 5.5, 2.2, 0.8, 'GO:0003853\\nshort-chain 2-methyl\\nfatty acyl-CoA DH', '#ADD8E6')\n\n# Draw connecting lines\nax1.plot([5, 5], [10.5, 9.5], 'k-', linewidth=1)\nax1.plot([1.95, 5.45, 8.4], [9.5, 9.5, 9.5], 'k-', linewidth=1)\nax1.plot([1.95, 1.95], [9.5, 8.8], 'k-', linewidth=1)\nax1.plot([5.45, 5.45], [9.5, 8.8], 'k-', linewidth=1)\nax1.plot([8.4, 8.4], [9.5, 8.8], 'k-', linewidth=1)\n\nax1.plot([1.95, 1.95], [8, 7.2], 'k-', linewidth=1)\nax1.plot([1, 3.3], [7.2, 7.2], 'k-', linewidth=1)\nax1.plot([1, 1], [7.2, 6.3], 'k-', linewidth=1)\nax1.plot([3.3, 3.3], [7.2, 6.3], 'k-', linewidth=1)\n\n# Annotations\nax1.text(5, 4.5, 'CG4860 annotations:', fontsize=9, fontweight='bold')\nax1.text(5, 3.8, '\u2022 GO:0003995 (ISS:FlyBase) \u2713 Well supported', fontsize=8, color='green')\nax1.text(5, 3.2, '\u2022 GO:0016937 (IBA:GO_Central) \u26a0 Over-specific?', fontsize=8, color='darkorange')\nax1.text(5, 2.6, '\u2022 GO:0016937 (IEA:UniProt) \u26a0 From EC:1.3.8.1', fontsize=8, color='darkorange')\nax1.text(5, 1.8, 'Key evidence:', fontsize=9, fontweight='bold')\nax1.text(5, 1.2, '\u2022 CG4860 LOF \u2260 SCAD phenotype (PMID:40519079)', fontsize=8, color='red')\nax1.text(5, 0.6, '\u2022 Arc42 LOF = SCAD phenotype \u2713', fontsize=8, color='green')\n\n# Legend\nlegend_elements = [\n    mpatches.Patch(facecolor='#90EE90', edgecolor='black', label='Well-supported annotation'),\n    mpatches.Patch(facecolor='#FFD700', edgecolor='red', linewidth=2, label='Annotation under review'),\n    mpatches.Patch(facecolor='#ADD8E6', edgecolor='black', label='Child terms (not annotated)'),\n    mpatches.Patch(facecolor='#D3D3D3', edgecolor='black', label='Sibling terms (not annotated)')\n]\nax1.legend(handles=legend_elements, loc='lower left', fontsize=7)\n\n# Panel B: Evidence flow diagram\nax2 = axes[1]\nax2.set_xlim(0, 10)\nax2.set_ylim(0, 12)\nax2.axis('off')\nax2.set_title('Evidence Sources for GO:0016937\\nAnnotation on CG4860', fontsize=12, fontweight='bold')\n\n# Evidence sources\ny_pos = 11\nitems = [\n    ('PANTHER PAINT (IBA)', 'Phylogenetic inference\\nPTN000097838 \u2192 P16219, Q3ZBF6', '#FFD700', 'Propagated from\\ncharacterized ACADS'),\n    ('UniProt IEA', 'EC:1.3.8.1 mapping', '#FFD700', 'Automatic from\\nEC assignment'),\n    ('FlyBase ISS', 'Ref: Q709F0 (ACAD11!)\\nPMID:22758915', '#FFA07A', 'Only GO:0003995\\n(general ACAD)'),\n    ('Sequence analysis', '57.1% identity to HsACADS\\nConserved catalytic Glu', '#90EE90', 'Supports SCAD\\nsubfamily membership'),\n    ('PMID:40519079', 'CG4860 LOF \u2260 ACADS phenotype\\nArc42 LOF = ACADS phenotype', '#FF6B6B', 'Challenges in vivo\\nSCAD function'),\n    ('Substrate pocket', 'Leu\u2192Thr at RIGIA+8\\nAltered pocket shape', '#FFD700', 'May explain\\ndifferent specificity'),\n]\n\nfor i, (source, detail, color, implication) in enumerate(items):\n    y = 11 - i * 1.8\n    # Source box\n    draw_box(ax2, 0.2, y-0.3, 2.5, 0.7, source, color)\n    # Detail\n    ax2.text(3, y, detail, fontsize=7, va='center')\n    # Arrow\n    ax2.annotate('', xy=(7, y), xytext=(6.2, y),\n                arrowprops=dict(arrowstyle='->', color='gray'))\n    # Implication\n    ax2.text(7.2, y, implication, fontsize=7, va='center', style='italic')\n\nplt.tight_layout()\nplt.savefig('go_hierarchy_evidence.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved\")\n",
  "plot_number": 2
}