{
  "filename": "plot_3.png",
  "iteration": 2,
  "description": "Create structural comparison figure: backbone geometry conservation vs side chain divergence",
  "timestamp": "2026-07-05 06:26:28",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\n# Create a comprehensive structural comparison figure\nfig, axes = plt.subplots(1, 2, figsize=(16, 7))\n\n# Panel A: Inter-residue CA distances comparison\nax1 = axes[0]\n\n# Distance data from AlphaFold analysis\npair_labels = [\n    'pos1-pos2\\n(Zn \u03b1)', 'pos1-pos3\\n(Zn \u03b1-bridge)', 'pos2-pos3\\n(Zn \u03b1-bridge)',\n    'pos5-pos6\\n(Zn \u03b2)', 'pos5-pos7\\n(Zn \u03b2)', 'pos6-pos7\\n(Zn \u03b2)',\n    'pos1-pos5\\n(cross-site)', 'pos3-pos5\\n(bridge-\u03b2)',\n    'pos4-pos8\\n(substrate)'\n]\n\ndpys_distances = [7.1, 10.9, 12.7, 7.4, 11.3, 7.0, 11.6, 7.4, 11.5]\ncrmp1_distances = [7.1, 10.7, 12.6, 7.3, 11.7, 6.9, 11.5, 7.2, 11.6]\n\nx = np.arange(len(pair_labels))\nwidth = 0.35\n\nbars1 = ax1.bar(x - width/2, dpys_distances, width, label='DPYS (true enzyme)', \n                color='#3498db', edgecolor='black', linewidth=0.5)\nbars2 = ax1.bar(x + width/2, crmp1_distances, width, label='CRMP1 (pseudoenzyme)', \n                color='#e74c3c', edgecolor='black', linewidth=0.5)\n\nax1.set_ylabel('CA-CA Distance (Angstrom)', fontsize=11)\nax1.set_title('A) Active Site Backbone Geometry\\n(AlphaFold CA-CA distances)', fontsize=12, fontweight='bold')\nax1.set_xticks(x)\nax1.set_xticklabels(pair_labels, fontsize=7, rotation=0)\nax1.legend(fontsize=9)\nax1.set_ylim(0, 15)\n\n# Add difference annotations\nfor i in range(len(dpys_distances)):\n    diff = abs(dpys_distances[i] - crmp1_distances[i])\n    ax1.text(x[i], max(dpys_distances[i], crmp1_distances[i]) + 0.3, \n             f'\u0394={diff:.1f}', ha='center', fontsize=7, color='#2c3e50')\n\nax1.text(0.02, 0.98, 'Backbone geometry\\nNEARLY IDENTICAL\\n(\u0394 < 0.5 \u00c5 for all pairs)\\n\u2192 Fold conserved', \n         transform=ax1.transAxes, fontsize=9, va='top',\n         bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.9))\n\n# Panel B: Residue identity comparison across species\nax2 = axes[1]\n\n# Species and their conservation counts\nspecies = ['Human DPYS\\n(true enzyme)', 'Human\\nCRMP1', 'Mouse\\nCrmp1', 'Human\\nCRMP2', \n           'Mouse\\nCrmp2', 'C. elegans\\nUNC-33', 'Drosophila\\nCRMP']\nconservation = [8, 2, 2, 2, 2, 2, 0]\ncolors = ['#2ecc71' if c >= 7 else '#e74c3c' for c in conservation]\n\nbars = ax2.bar(range(len(species)), conservation, color=colors, edgecolor='black', linewidth=0.8)\n\n# Add count labels\nfor bar, count in zip(bars, conservation):\n    ax2.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.15, \n             f'{count}/8', ha='center', va='bottom', fontsize=11, fontweight='bold')\n\nax2.set_xticks(range(len(species)))\nax2.set_xticklabels(species, fontsize=8)\nax2.set_ylabel('Active Site Residues Conserved\\n(out of 8)', fontsize=11)\nax2.set_title('B) Active Site Conservation\\nAcross Species', fontsize=12, fontweight='bold')\nax2.set_ylim(0, 10)\nax2.axhline(y=4, color='gray', linestyle='--', alpha=0.5)\n\n# Legend\nenzyme_patch = mpatches.Patch(color='#2ecc71', label='True enzyme (\u22657/8)')\npseudo_patch = mpatches.Patch(color='#e74c3c', label='Pseudoenzyme (\u22642/8)')\nax2.legend(handles=[enzyme_patch, pseudo_patch], fontsize=9)\n\nax2.text(0.98, 0.98, 'Active site loss\\nis UNIVERSAL across\\nall CRMP family members\\nfrom invertebrates to humans', \n         transform=ax2.transAxes, fontsize=9, va='top', ha='right',\n         bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.9))\n\nplt.tight_layout()\nplt.savefig('/tmp/structural_comparison.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Structural comparison figure saved\")\n",
  "plot_number": 3
}