{
  "filename": "plot_3.png",
  "iteration": 2,
  "description": "Visualize cross-subfamily identity comparison showing Mcad is definitively MCAD",
  "timestamp": "2026-07-01 07:12:11",
  "code": "\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 6))\nfig.suptitle('Cross-Subfamily Analysis: Drosophila Mcad (Q9VSA3) vs Human ACAD Family', \n             fontsize=13, fontweight='bold')\n\n# Panel 1: Bar chart of identity to each human ACAD\nsubfamilies = ['MCAD\\n(P11310)', 'SCAD\\n(P16219)', 'LCAD\\n(P28330)', 'VLCAD\\n(P49748)']\nidentities = [69.08, 37.81, 31.83, 32.69]\ncolors = ['#e74c3c', '#3498db', '#2ecc71', '#f39c12']\nbars = ax1.bar(subfamilies, identities, color=colors, edgecolor='black', linewidth=0.8, width=0.6)\n\n# Highlight the MCAD bar\nbars[0].set_edgecolor('red')\nbars[0].set_linewidth(3)\nbars[0].set_hatch('///')\n\nax1.set_ylabel('Sequence Identity (%)', fontsize=12)\nax1.set_title('Drosophila Mcad Identity to\\nHuman ACAD Subfamilies', fontsize=11, fontweight='bold')\nax1.set_ylim(0, 85)\n\nfor bar, val in zip(bars, identities):\n    ax1.text(bar.get_x() + bar.get_width()/2., val + 1, \n             f'{val:.1f}%', ha='center', va='bottom', fontweight='bold', fontsize=12)\n\n# Add line showing the gap\nax1.axhline(y=69.08, color='red', linestyle='--', alpha=0.3)\nax1.axhline(y=38, color='gray', linestyle=':', alpha=0.3)\n\n# Annotate the gap\nax1.annotate('', xy=(0.5, 69.08), xytext=(0.5, 37.81),\n            arrowprops=dict(arrowstyle='<->', color='black', lw=2))\nax1.text(0.75, 53, '\u039431%\\ngap', ha='center', va='center', fontsize=11, \n         fontweight='bold', color='darkred',\n         bbox=dict(boxstyle='round,pad=0.3', facecolor='lightyellow', edgecolor='darkred'))\n\n# Panel 2: Heatmap-style identity matrix\nlabels = ['Dmel Mcad', 'Hs MCAD', 'Hs SCAD', 'Hs LCAD', 'Hs VLCAD']\nmatrix = np.array([\n    [100.00, 69.08, 37.81, 31.83, 32.69],\n    [69.08, 100.00, 37.93, 30.56, 30.86],\n    [37.81, 37.93, 100.00, 32.56, 33.50],\n    [31.83, 30.56, 32.56, 100.00, 29.81],\n    [32.69, 30.86, 33.50, 29.81, 100.00],\n])\n\nim = ax2.imshow(matrix, cmap='RdYlGn', vmin=20, vmax=100, aspect='auto')\nax2.set_xticks(range(5))\nax2.set_yticks(range(5))\nax2.set_xticklabels(labels, fontsize=9, rotation=45, ha='right')\nax2.set_yticklabels(labels, fontsize=9)\nax2.set_title('Pairwise Identity Matrix (%)\\n(Clustal Omega)', fontsize=11, fontweight='bold')\n\n# Add text annotations\nfor i in range(5):\n    for j in range(5):\n        color = 'white' if matrix[i, j] > 60 else 'black'\n        ax2.text(j, i, f'{matrix[i, j]:.0f}', ha='center', va='center', \n                fontsize=10, fontweight='bold', color=color)\n\n# Add colorbar\ncbar = plt.colorbar(im, ax=ax2, shrink=0.8)\ncbar.set_label('Sequence Identity (%)', fontsize=10)\n\n# Highlight the MCAD-Mcad cell\nrect = plt.Rectangle((-0.5, -0.5), 2, 2, linewidth=3, edgecolor='red', \n                      facecolor='none', linestyle='--')\nax2.add_patch(rect)\n\nplt.tight_layout()\nplt.savefig('cross_subfamily_analysis.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Cross-subfamily analysis figure saved.\")\nprint(f\"\\nKey result: Drosophila Mcad is {69.08/37.81:.1f}x more similar to human MCAD\")\nprint(f\"than to the next-closest subfamily (SCAD at {37.81}%).\")\nprint(f\"This {69.08-37.81:.1f} percentage-point gap definitively places Q9VSA3 in the MCAD subfamily.\")\n",
  "plot_number": 3
}