{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Visualization of active site conservation and GO term assessment for Q88K52 AhpC",
  "timestamp": "2026-06-24 04:20:21",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(1, 2, figsize=(16, 8))\n\n# Panel 1: Active site residue conservation\nax1 = axes[0]\n\nresidues = ['C47\\n(CP)', 'C166\\n(CR)', 'T44', 'E50', 'R120']\nlabels = ['Peroxidatic\\nCys', 'Resolving\\nCys', 'Active-site\\nproximal', 'Active-site\\nproximal', 'Active-site\\nproximal']\n\n# All residues are conserved across all 3 species\npp_res = ['C', 'C', 'T', 'E', 'R']\nec_res = ['C', 'C', 'T', 'E', 'R']\nst_res = ['C', 'C', 'T', 'E', 'R']\n\nx = np.arange(len(residues))\nwidth = 0.25\n\ncolors_pp = ['#2ecc71'] * 5  # All green = conserved\ncolors_ec = ['#3498db'] * 5\ncolors_st = ['#e74c3c'] * 5\n\nbars1 = ax1.bar(x - width, [1]*5, width, label='P. putida (Q88K52)', color='#2ecc71', alpha=0.8)\nbars2 = ax1.bar(x, [1]*5, width, label='E. coli (P0AE08)', color='#3498db', alpha=0.8)\nbars3 = ax1.bar(x + width, [1]*5, width, label='S. typhimurium (P0A251)', color='#e74c3c', alpha=0.8)\n\n# Add residue labels on bars\nfor i, (p, e, s) in enumerate(zip(pp_res, ec_res, st_res)):\n    ax1.text(i - width, 0.5, p, ha='center', va='center', fontsize=14, fontweight='bold', color='white')\n    ax1.text(i, 0.5, e, ha='center', va='center', fontsize=14, fontweight='bold', color='white')\n    ax1.text(i + width, 0.5, s, ha='center', va='center', fontsize=14, fontweight='bold', color='white')\n\nax1.set_xticks(x)\nax1.set_xticklabels(residues, fontsize=10)\nax1.set_ylabel('Conservation', fontsize=12)\nax1.set_title('Active Site Catalytic Residues\\n(All 5/5 Conserved)', fontsize=13, fontweight='bold')\nax1.set_ylim(0, 1.3)\nax1.set_yticks([0, 1])\nax1.set_yticklabels(['Absent', 'Present'])\nax1.legend(fontsize=9, loc='upper right')\n\n# Add a \"100% CONSERVED\" stamp\nax1.text(2, 1.15, '\u2713 ALL CATALYTIC RESIDUES INTACT', ha='center', va='center', \n         fontsize=12, fontweight='bold', color='#27ae60',\n         bbox=dict(boxstyle='round,pad=0.3', facecolor='#d5f5e3', edgecolor='#27ae60'))\n\n# Panel 2: GO term hierarchy and assessment\nax2 = axes[1]\nax2.set_xlim(0, 10)\nax2.set_ylim(0, 10)\nax2.axis('off')\n\n# Title\nax2.text(5, 9.5, 'GO Term Assessment for Q88K52 (AhpC)', ha='center', fontsize=13, fontweight='bold')\n\n# GO hierarchy\nterms = [\n    (1, 8.3, 'GO:0051920', 'peroxiredoxin activity', '#27ae60', '\u2713 APPLIES'),\n    (2, 7.3, 'GO:0140824', 'thioredoxin-dependent Prx activity', '#f39c12', '? LIKELY'),\n    (3, 6.3, 'GO:0008379', 'thioredoxin peroxidase activity', '#f39c12', '\u2713 SUPPORTED*'),\n    (1, 5.0, 'GO:0102039', 'NADH-dependent Prx activity', '#27ae60', '\u2713 APPLIES'),\n]\n\nfor indent, y, go_id, name, color, verdict in terms:\n    x_pos = indent * 0.7\n    ax2.text(x_pos, y, f'{go_id}', fontsize=9, fontweight='bold', color='#2c3e50')\n    ax2.text(x_pos, y - 0.35, f'{name}', fontsize=9, color='#555')\n    ax2.text(8.5, y - 0.15, verdict, fontsize=9, fontweight='bold', color=color, ha='center',\n             bbox=dict(boxstyle='round,pad=0.2', facecolor=color+'20', edgecolor=color, alpha=0.5))\n\n# Draw hierarchy lines\nax2.annotate('', xy=(1.4, 7.6), xytext=(0.7, 8.0),\n             arrowprops=dict(arrowstyle='->', color='gray'))\nax2.annotate('', xy=(2.1, 6.6), xytext=(1.4, 7.0),\n             arrowprops=dict(arrowstyle='->', color='gray'))\n\n# Assessment summary\nax2.text(5, 4.0, 'VERDICT: SUPPORTED', ha='center', fontsize=14, fontweight='bold', color='#27ae60',\n         bbox=dict(boxstyle='round,pad=0.4', facecolor='#d5f5e3', edgecolor='#27ae60', linewidth=2))\n\nnotes = [\n    '\u2022 Protein is a bona fide 2-Cys peroxiredoxin (AhpC/Prx1 subfamily)',\n    '\u2022 All catalytic residues intact (C47, C166, T44, E50, R120)',\n    '\u2022 69% identity to characterized S. typhimurium AhpC',\n    '\u2022 \"Thioredoxin peroxidase\" = recognized synonym for peroxiredoxin',\n    '\u2022 *Primary reductant is AhpF; thioredoxin use is inferred',\n    '\u2022 No pseudo-enzyme or mis-placement evidence',\n]\n\nfor i, note in enumerate(notes):\n    ax2.text(0.5, 3.2 - i*0.45, note, fontsize=8.5, color='#2c3e50')\n\nplt.tight_layout()\nplt.savefig('active_site_and_go_assessment.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved: active_site_and_go_assessment.png\")\n",
  "plot_number": 1
}