{
  "filename": "active_site_comparison.png",
  "iteration": 1,
  "description": "Visualization of active site residue conservation comparing DPYS, CRMP1, and CRMP2",
  "timestamp": "2026-07-05 06:16:23",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\n# Create a visualization of the active site residue conservation\nfig, ax = plt.subplots(figsize=(14, 7))\n\n# Data\nresidues = ['H67\\n(Zn\u00b2\u207a \u03b1)', 'H69\\n(Zn\u00b2\u207a \u03b1)', 'K159\\n(carbamate)', 'Y164\\n(substrate)', \n            'H192\\n(Zn\u00b2\u207a \u03b2)', 'H248\\n(Zn\u00b2\u207a)', 'D326\\n(Zn\u00b2\u207a \u03b2)', 'N347\\n(substrate)']\ndpys_aa = ['H', 'H', 'K', 'Y', 'H', 'H', 'D', 'N']\ncrmp1_aa = ['N', 'Y', 'Q', 'Y', 'H', 'K', 'G', 'E']\ncrmp2_aa = ['H', 'R', 'L', 'F', 'H', 'K', 'A', 'E']\n\ncrmp1_conserved = [1 if a == b else 0 for a, b in zip(dpys_aa, crmp1_aa)]\ncrmp2_conserved = [1 if a == b else 0 for a, b in zip(dpys_aa, crmp2_aa)]\n\nx = np.arange(len(residues))\nwidth = 0.35\n\n# Color bars\ncolors_crmp1 = ['#2ecc71' if c else '#e74c3c' for c in crmp1_conserved]\ncolors_crmp2 = ['#2ecc71' if c else '#e74c3c' for c in crmp2_conserved]\n\nbars1 = ax.bar(x - width/2, [1]*8, width, color=colors_crmp1, edgecolor='black', linewidth=0.8)\nbars2 = ax.bar(x + width/2, [1]*8, width, color=colors_crmp2, edgecolor='black', linewidth=0.8)\n\n# Add amino acid labels on bars\nfor i, (bar, aa) in enumerate(zip(bars1, crmp1_aa)):\n    ax.text(bar.get_x() + bar.get_width()/2, 0.5, aa, ha='center', va='center', \n            fontsize=14, fontweight='bold', color='white')\n    \nfor i, (bar, aa) in enumerate(zip(bars2, crmp2_aa)):\n    ax.text(bar.get_x() + bar.get_width()/2, 0.5, aa, ha='center', va='center', \n            fontsize=14, fontweight='bold', color='white')\n\n# Add DPYS reference on top\nfor i, aa in enumerate(dpys_aa):\n    ax.text(x[i], 1.15, f'DPYS: {aa}', ha='center', va='bottom', fontsize=10, \n            fontweight='bold', color='#2c3e50')\n\nax.set_ylabel('')\nax.set_title('Active Site Residue Conservation: DPYS (true enzyme) vs CRMP1/CRMP2\\n'\n             'Green = conserved, Red = substituted (catalytically incompatible)', \n             fontsize=13, fontweight='bold')\nax.set_xticks(x)\nax.set_xticklabels(residues, fontsize=9)\nax.set_ylim(0, 1.4)\nax.set_yticks([])\n\n# Legend\nconserved_patch = mpatches.Patch(color='#2ecc71', label='Conserved')\nlost_patch = mpatches.Patch(color='#e74c3c', label='Substituted (non-functional)')\nax.legend(handles=[conserved_patch, lost_patch], loc='upper right', fontsize=10)\n\n# Add labels for CRMP1 and CRMP2\nax.text(-0.7, 0.5, 'CRMP1', ha='center', va='center', fontsize=11, fontweight='bold', \n        color='#8e44ad', rotation=0)\nax.text(7.7, 0.5, 'CRMP2', ha='center', va='center', fontsize=11, fontweight='bold', \n        color='#2980b9', rotation=0)\n\n# Add summary text\nsummary_text = (f\"CRMP1: 2/8 conserved (25%)\\n\"\n                f\"CRMP2: 2/8 conserved (25%)\\n\"\n                f\"Both lack zinc-binding capacity\\n\"\n                f\"\u2192 No hydrolase activity expected\")\nax.text(0.02, 0.98, summary_text, transform=ax.transAxes, fontsize=10,\n        verticalalignment='top', bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.8))\n\n# Labels\nax.text(x[0] - width/2 - 0.15, -0.22, 'CRMP1', ha='center', fontsize=9, color='#8e44ad', fontweight='bold')\nax.text(x[0] + width/2 + 0.15, -0.22, 'CRMP2', ha='center', fontsize=9, color='#2980b9', fontweight='bold')\n\nplt.tight_layout()\nplt.savefig('active_site_comparison.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved: active_site_comparison.png\")\n"
}