{
  "filename": "plot_3.png",
  "iteration": 2,
  "description": "Final provenance: Fe(II) triad conservation comparison and GO annotation conflict diagram",
  "timestamp": "2026-07-05 13:09:15",
  "code": "\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Create a comprehensive summary figure of all computational evidence\nfig, axes = plt.subplots(1, 2, figsize=(16, 7))\n\n# === Left: Fe(II) triad comparison bar chart ===\nax = axes[0]\nax.set_title('Fe(II) Catalytic Triad Conservation\\nAcross JHDM1/KDM2 Family', fontsize=12, fontweight='bold')\n\nproteins = ['KDM2A\\n(Human)', 'Jhd1\\n(S. cerevisiae)', 'Epe1\\n(S. pombe)', 'PHF2\\n(Human)']\n# Score: 1 = canonical, 0.5 = conservative change, 0 = non-conservative\nscores = {\n    'Ligand 1\\n(His)':   [1.0, 1.0, 1.0, 1.0],   # All have His\n    'Ligand 2\\n(Asp/Glu)': [1.0, 1.0, 0.7, 1.0],   # Epe1 has Glu (conservative)\n    'Ligand 3\\n(His)':   [1.0, 1.0, 0.0, 0.0],   # Epe1 and PHF2 have Tyr\n}\n\nx = np.arange(len(proteins))\nwidth = 0.25\ncolors_lig = ['#4CAF50', '#2196F3', '#F44336']\n\nfor i, (lig_name, vals) in enumerate(scores.items()):\n    bar_colors = ['#4CAF50' if v >= 0.7 else '#FFC107' if v >= 0.3 else '#F44336' for v in vals]\n    bars = ax.bar(x + i*width - width, vals, width, label=lig_name, color=bar_colors,\n                  edgecolor='black', linewidth=0.5)\n    \n    # Add residue labels\n    residue_labels = [\n        ['H212', 'H305', 'H297', 'H249'],   # Lig 1\n        ['D214', 'D307', 'E299', 'D251'],   # Lig 2  \n        ['H284', 'H377', 'Y370', 'Y321'],   # Lig 3\n    ]\n    for j, (bar, label) in enumerate(zip(bars, residue_labels[i])):\n        ax.text(bar.get_x() + bar.get_width()/2., bar.get_height() + 0.03,\n                label, ha='center', va='bottom', fontsize=8, fontweight='bold',\n                color='red' if vals[j] < 0.3 else 'black')\n\nax.set_xticks(x)\nax.set_xticklabels(proteins, fontsize=10)\nax.set_ylabel('Conservation Score', fontsize=11)\nax.set_ylim(0, 1.3)\nax.legend(fontsize=9, loc='upper right')\n\n# Add active/inactive labels\nfor i, prot in enumerate(proteins):\n    active = 'ACTIVE' if i < 2 else 'INACTIVE'\n    color = 'green' if i < 2 else 'red'\n    ax.text(i, -0.15, active, ha='center', fontweight='bold', fontsize=9, color=color)\n\n# === Right: Annotation conflict diagram ===\nax2 = axes[1]\nax2.set_title('GO Annotation Hierarchy & Conflict', fontsize=12, fontweight='bold')\nax2.set_xlim(0, 10)\nax2.set_ylim(0, 10)\n\n# GO terms as boxes\nimport matplotlib.patches as mpatches\n\n# Parent: GO:0032452\nbox1 = mpatches.FancyBboxPatch((2.5, 7.5), 5, 1.5, boxstyle=\"round,pad=0.2\",\n                                 facecolor='#FFCCCC', edgecolor='red', linewidth=2)\nax2.add_patch(box1)\nax2.text(5, 8.5, 'GO:0032452', ha='center', va='center', fontsize=10, fontweight='bold')\nax2.text(5, 8.0, 'histone demethylase activity', ha='center', va='center', fontsize=8)\n\n# Annotation label for parent\nax2.text(8.5, 8.3, 'IBA: enables', fontsize=9, color='red', fontweight='bold',\n         bbox=dict(boxstyle='round', facecolor='#FFCCCC'))\n\n# Child: GO:0141052  \nbox2 = mpatches.FancyBboxPatch((2.5, 4.0), 5, 1.5, boxstyle=\"round,pad=0.2\",\n                                 facecolor='#CCFFCC', edgecolor='green', linewidth=2)\nax2.add_patch(box2)\nax2.text(5, 5.0, 'GO:0141052', ha='center', va='center', fontsize=10, fontweight='bold')\nax2.text(5, 4.5, 'histone H3 demethylase activity', ha='center', va='center', fontsize=8)\n\n# Annotation label for child\nax2.text(8.5, 4.8, 'IDA: NOT enables', fontsize=9, color='green', fontweight='bold',\n         bbox=dict(boxstyle='round', facecolor='#CCFFCC'))\n\n# Arrow from parent to child (is_a)\nax2.annotate('', xy=(5, 5.5), xytext=(5, 7.5),\n            arrowprops=dict(arrowstyle='->', color='gray', lw=2))\nax2.text(5.5, 6.5, 'is_a', fontsize=9, color='gray', fontstyle='italic')\n\n# Grandchild: GO:0032454\nbox3 = mpatches.FancyBboxPatch((2.5, 1.0), 5, 1.5, boxstyle=\"round,pad=0.2\",\n                                 facecolor='#E8E8E8', edgecolor='gray', linewidth=1)\nax2.add_patch(box3)\nax2.text(5, 2.0, 'GO:0032454', ha='center', va='center', fontsize=10, fontweight='bold')\nax2.text(5, 1.5, 'histone H3K9 demethylase activity', ha='center', va='center', fontsize=8)\n\n# Annotation label for grandchild\nax2.text(8.5, 1.8, 'UniProt: IDA?\\n(absent from\\nQuickGO)', fontsize=8, color='gray',\n         bbox=dict(boxstyle='round', facecolor='#F0F0F0'))\n\nax2.annotate('', xy=(5, 2.5), xytext=(5, 4.0),\n            arrowprops=dict(arrowstyle='->', color='gray', lw=2))\nax2.text(5.5, 3.2, 'is_a', fontsize=9, color='gray', fontstyle='italic')\n\n# Conflict indicator\nax2.annotate('CONFLICT!\\nIBA positive (parent)\\nvs IDA negative (child)', \n            xy=(1.5, 6.5), fontsize=10, color='red', fontweight='bold',\n            ha='center',\n            bbox=dict(boxstyle='round,pad=0.4', facecolor='lightyellow', edgecolor='red', linewidth=2))\n\nax2.axis('off')\n\nplt.tight_layout()\nplt.savefig('/tmp/epe1_final_provenance.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Final provenance figure saved.\")\n",
  "plot_number": 3
}