{
  "filename": "active_site_alignment.png",
  "iteration": 1,
  "description": "Active-site motif alignment visualization comparing catalytic residues across squid ADAR2, human ADAR2, and human ADAT1",
  "timestamp": "2026-06-24 03:39:44",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as patches\n\nfig, ax = plt.subplots(figsize=(16, 6))\nax.axis('off')\n\n# Title\nax.text(0.5, 0.97, 'Active-Site Motif Alignment: Squid ADAR2 vs Human ADAR2 vs Human ADAT1',\n        transform=ax.transAxes, fontsize=14, fontweight='bold', ha='center', va='top')\n\n# CHAE motif alignment\ny_start = 0.82\nax.text(0.02, y_start, 'Motif 1: Catalytic Center (Zn-binding His + Proton-donor Glu)',\n        transform=ax.transAxes, fontsize=11, fontweight='bold', color='#1565C0')\n\nsequences = [\n    (\"Squid ADAR2 (457)\", \"INGEYMNDRGF\", \"AVND\", \"CHAE\", \"IIAR\", \"RCFLRFIYDQL\"),\n    (\"Human ADAR2 (394)\", \"INGEYMSDRGL\", \"ALND\", \"CHAE\", \"IISR\", \"RSLLRFLYTQL\"),\n    (\"Human ADAT1\",       \"     ------\", \"----\", \"----\", \"----\", \"-----------\"),\n]\n\ny = y_start - 0.06\ncolors_match = '#4CAF50'    # green for match\ncolors_diff = '#FFC107'     # yellow for conservative substitution\ncolors_active = '#F44336'   # red for active site\ncolors_missing = '#9E9E9E'  # grey for missing\n\nfor name, pre, pre2, motif, post1, post2 in sequences:\n    x_pos = 0.22\n    ax.text(0.02, y, name, transform=ax.transAxes, fontsize=10, fontfamily='monospace', \n            fontweight='bold', va='center')\n    \n    # Pre-motif\n    for i, char in enumerate(pre):\n        color = colors_missing if char == '-' else (colors_match if i < len(sequences[0][1]) and char == sequences[0][1][i] else colors_diff)\n        ax.text(x_pos + i*0.018, y, char, transform=ax.transAxes, fontsize=10, \n                fontfamily='monospace', va='center', color='black' if char != '-' else '#BDBDBD')\n    \n    x_pos += len(pre) * 0.018\n    for i, char in enumerate(pre2):\n        color = colors_missing if char == '-' else 'black'\n        ax.text(x_pos + i*0.018, y, char, transform=ax.transAxes, fontsize=10, \n                fontfamily='monospace', va='center', color=color)\n    \n    x_pos += len(pre2) * 0.018\n    # Active site motif - highlighted\n    for i, char in enumerate(motif):\n        bg_color = colors_active if char != '-' else colors_missing\n        fcolor = 'white' if char != '-' else '#BDBDBD'\n        ax.text(x_pos + i*0.018, y, char, transform=ax.transAxes, fontsize=12, \n                fontfamily='monospace', va='center', fontweight='bold', color=fcolor,\n                bbox=dict(boxstyle='round,pad=0.1', facecolor=bg_color, edgecolor='none', alpha=0.8))\n    \n    x_pos += len(motif) * 0.018 + 0.005\n    for i, char in enumerate(post1 + post2):\n        color = colors_missing if char == '-' else 'black'\n        ax.text(x_pos + i*0.018, y, char, transform=ax.transAxes, fontsize=10, \n                fontfamily='monospace', va='center', color=color)\n    \n    y -= 0.05\n\n# Add annotation\nax.text(0.22, y - 0.02, '                         ^^^^', transform=ax.transAxes, \n        fontsize=10, fontfamily='monospace', color=colors_active)\nax.text(0.22, y - 0.05, '              Zn\u00b2\u207a-coordinating His + Proton-donor Glu',\n        transform=ax.transAxes, fontsize=9, color=colors_active, fontstyle='italic')\nax.text(0.22, y - 0.08, '              ADAT1 lacks this motif entirely',\n        transform=ax.transAxes, fontsize=9, color=colors_missing, fontweight='bold')\n\n# PCG motif alignment\ny2 = y - 0.15\nax.text(0.02, y2, 'Motif 2: Zinc-Coordinating Cysteine (PCG motif)',\n        transform=ax.transAxes, fontsize=11, fontweight='bold', color='#1565C0')\n\nsequences2 = [\n    (\"Squid ADAR2 (515)\", \"KLKPNIQFHLYISTA\", \"PCG\", \"DARIFSPHGQDVETG\"),\n    (\"Human ADAR2 (451)\", \"RLKENVQFHLYISTS\", \"PCG\", \"DARIFSPHEPILEGS\"),\n    (\"Human ADAT1 (141)\", \"KLRRDLIFVFFSSHT\", \"PCG\", \"DASIIPMLEFEDQPC\"),\n]\n\ny3 = y2 - 0.06\nfor name, pre, motif, post in sequences2:\n    ax.text(0.02, y3, name, transform=ax.transAxes, fontsize=10, fontfamily='monospace',\n            fontweight='bold', va='center')\n    x_pos = 0.24\n    \n    for i, char in enumerate(pre):\n        ax.text(x_pos + i*0.018, y3, char, transform=ax.transAxes, fontsize=10,\n                fontfamily='monospace', va='center')\n    \n    x_pos += len(pre) * 0.018\n    for i, char in enumerate(motif):\n        ax.text(x_pos + i*0.018, y3, char, transform=ax.transAxes, fontsize=12,\n                fontfamily='monospace', va='center', fontweight='bold', color='white',\n                bbox=dict(boxstyle='round,pad=0.1', facecolor='#FF5722', edgecolor='none', alpha=0.8))\n    \n    x_pos += len(motif) * 0.018 + 0.005\n    for i, char in enumerate(post):\n        ax.text(x_pos + i*0.018, y3, char, transform=ax.transAxes, fontsize=10,\n                fontfamily='monospace', va='center')\n    \n    y3 -= 0.05\n\nax.text(0.24, y3 - 0.02, '                              ^^^', transform=ax.transAxes,\n        fontsize=10, fontfamily='monospace', color='#FF5722')\nax.text(0.24, y3 - 0.05, '              Shared across superfamily (ADAR + ADAT)',\n        transform=ax.transAxes, fontsize=9, color='#FF5722', fontstyle='italic')\n\n# Conclusion box\nconclusion = (\n    \"CONCLUSION: Squid ADAR2 active-site residues match human ADAR2 perfectly.\\n\"\n    \"The CHAE catalytic motif (diagnostic for ADAR subfamily) is conserved, while\\n\"\n    \"ADAT1 lacks it. The PCG motif is shared by both families (superfamily-level).\\n\"\n    \"\u2192 The protein is a catalytically active ADAR2, not a tRNA deaminase.\"\n)\nax.text(0.5, 0.03, conclusion, transform=ax.transAxes, fontsize=9.5,\n        ha='center', va='bottom', fontfamily='monospace',\n        bbox=dict(boxstyle='round', facecolor='#E8F5E9', edgecolor='#4CAF50', alpha=0.9))\n\nplt.tight_layout()\nplt.savefig('active_site_alignment.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Active site alignment figure saved\")\n"
}