{
  "filename": "plot_2.png",
  "iteration": 2,
  "description": "Create visual evidence matrix comparing functional hypotheses for YrhB",
  "timestamp": "2026-06-21 20:13:54",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, ax = plt.subplots(figsize=(12, 7))\n\n# Evidence comparison table - visual summary\ncategories = [\n    'Fold assignment\\n(Imm35)',\n    'Bacteriocin\\nimmunity',\n    'Peptidase\\ninhibitor',\n    'Chaperone\\nactivity',\n    'K12 = BL21\\nsequence'\n]\n\nevidence_types = {\n    'Pfam/InterPro domain': [1, 0, 0, 0, 0],\n    'Foldseek structural homology': [1, 0, 0, 0, 0],\n    'CATH classification': [1, 0, 0, 0, 0],\n    'AlphaFold high-confidence model': [1, 0, 0, 0, 0],\n    'In vitro biochemical assay (PMID 22569261)': [0, 0, 0, 1, 0],\n    'In vivo growth phenotype (PMID 22569261)': [0, 0, 0, 1, 0],\n    'Adjacent toxin gene context': [0, -1, -1, 0, 0],\n    'Genomic context (IS elements, pseudogene)': [0, -1, 0, 0, 0],\n    'Current GO annotations': [0, -1, -1, -1, 0],\n    'Sequence identity verification': [0, 0, 0, 0, 1],\n    'Any Imm35 family experimental evidence': [0, -1, -1, 0, 0],\n}\n\n# Color map: 1=green (supports), 0=gray (no evidence), -1=red (refutes)\ncmap = {1: '#4CAF50', 0: '#E0E0E0', -1: '#F44336'}\nsymbols = {1: '+', 0: '\u25cb', -1: '\u2013'}\n\ny_labels = list(evidence_types.keys())\nn_rows = len(y_labels)\nn_cols = len(categories)\n\nfor i, (label, values) in enumerate(evidence_types.items()):\n    for j, v in enumerate(values):\n        color = cmap[v]\n        circle = plt.Circle((j, n_rows - i - 1), 0.35, color=color, alpha=0.8)\n        ax.add_patch(circle)\n        ax.text(j, n_rows - i - 1, symbols[v], ha='center', va='center', \n                fontsize=14, fontweight='bold', color='white' if v != 0 else 'gray')\n\nax.set_xlim(-0.6, n_cols - 0.4)\nax.set_ylim(-0.6, n_rows - 0.4)\nax.set_xticks(range(n_cols))\nax.set_xticklabels(categories, fontsize=10, fontweight='bold')\nax.set_yticks(range(n_rows))\nax.set_yticklabels(list(reversed(y_labels)), fontsize=9)\nax.set_title('Evidence Matrix: YrhB Functional Assignment\\n'\n             'Green (+) = supports, Red (\u2013) = refutes, Gray (\u25cb) = no evidence', \n             fontsize=13, fontweight='bold')\nax.set_aspect('equal')\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\nax.spines['bottom'].set_visible(False)\nax.spines['left'].set_visible(False)\n\n# Add verdict bar at bottom\nverdict_colors = ['#4CAF50', '#F44336', '#F44336', '#4CAF50', '#4CAF50']\nverdict_text = ['SUPPORTED', 'REFUTED', 'REFUTED', 'SUPPORTED', 'CONFIRMED']\nfor j in range(n_cols):\n    ax.text(j, -0.5, verdict_text[j], ha='center', va='center', fontsize=8,\n            fontweight='bold', color=verdict_colors[j],\n            bbox=dict(boxstyle='round,pad=0.3', facecolor='white', \n                     edgecolor=verdict_colors[j], linewidth=2))\n\nplt.tight_layout()\nplt.savefig('/tmp/evidence_matrix.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Evidence matrix figure saved\")\n",
  "plot_number": 2
}