{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Create comprehensive domain architecture visualization of AARSD1 isoforms showing AlaX editing domain, zinc-binding sites, and p23H domain",
  "timestamp": "2026-06-22 01:34:06",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(4, 1, figsize=(14, 10), gridspec_kw={'height_ratios': [1.5, 1.5, 1.5, 2]})\n\n# Color scheme\ncolors = {\n    'alax_editing': '#2E86AB',     # Blue - AlaX editing domain\n    'beta_barrel': '#A23B72',      # Purple - Translation beta-barrel\n    'tRNA_SAD': '#F18F01',         # Orange - tRNA_SAD domain\n    'p23H': '#C73E1D',             # Red - p23 homolog\n    'extended_nterm': '#8B8B8B',   # Gray - extended N-terminus  \n    'c_term': '#3B7A57',           # Green - C-terminal extension\n    'zinc': '#FFD700',             # Gold - zinc binding sites\n    'unique_nterm': '#D4A5A5',     # Light pink - unique N-terminal of iso1\n}\n\ndef draw_protein(ax, domains, protein_length, title, zinc_sites=None, labels=None):\n    ax.set_xlim(0, 600)\n    ax.set_ylim(-0.5, 1.5)\n    ax.set_yticks([])\n    \n    # Draw protein backbone\n    scale = 550 / protein_length\n    backbone_start = 25\n    \n    ax.add_patch(mpatches.FancyBboxPatch(\n        (backbone_start, 0.3), protein_length * scale, 0.4,\n        boxstyle=\"round,pad=0.02\", facecolor='#f0f0f0', edgecolor='gray', linewidth=0.5\n    ))\n    \n    # Draw domains\n    for name, start, end, color, label in domains:\n        width = (end - start + 1) * scale\n        x = backbone_start + (start - 1) * scale\n        ax.add_patch(mpatches.FancyBboxPatch(\n            (x, 0.25), width, 0.5,\n            boxstyle=\"round,pad=0.02\", facecolor=color, edgecolor='black', linewidth=1, alpha=0.85\n        ))\n        # Label\n        center_x = x + width / 2\n        ax.text(center_x, 0.5, label, ha='center', va='center', fontsize=7, fontweight='bold', color='white')\n    \n    # Draw zinc binding sites\n    if zinc_sites:\n        for pos, residue in zinc_sites:\n            x = backbone_start + (pos - 1) * scale\n            ax.plot(x, 1.0, 'v', color=colors['zinc'], markersize=8, markeredgecolor='black', markeredgewidth=0.5)\n            ax.text(x, 1.15, f'{residue}{pos}', ha='center', va='bottom', fontsize=6, fontweight='bold')\n    \n    # Title and length markers\n    ax.text(backbone_start - 5, 0.5, title, ha='right', va='center', fontsize=9, fontweight='bold')\n    ax.text(backbone_start, -0.1, '1', ha='center', fontsize=7)\n    ax.text(backbone_start + protein_length * scale, -0.1, str(protein_length), ha='center', fontsize=7)\n    \n    ax.set_frame_on(False)\n    ax.set_xticks([])\n\n# Isoform 1 (canonical, 412 aa)\ndomains_iso1 = [\n    ('unique_nterm', 1, 13, colors['unique_nterm'], 'N'),\n    ('beta_barrel', 2, 95, colors['beta_barrel'], '\u03b2-barrel'),\n    ('alax_editing', 43, 252, colors['alax_editing'], 'AlaX Editing Domain'),\n    ('tRNA_SAD', 196, 239, colors['tRNA_SAD'], 'SAD'),\n    ('c_term', 253, 412, colors['c_term'], 'C-terminal (C-Ala-like)'),\n]\nzinc_iso1 = [(109, 'H'), (113, 'H'), (209, 'C'), (213, 'H')]\n\ndraw_protein(axes[0], domains_iso1, 412, 'Isoform 1\\n(412 aa)', zinc_iso1)\naxes[0].set_title('AARSD1 Domain Architecture & Catalytic Residues', fontsize=13, fontweight='bold', pad=15)\n\n# Isoform 2 (525 aa, p23H + AlaXp)\ndomains_iso2 = [\n    ('p23H', 1, 126, colors['p23H'], 'p23-Homolog (CS)'),\n    ('beta_barrel', 115, 208, colors['beta_barrel'], '\u03b2-barrel'),\n    ('alax_editing', 156, 365, colors['alax_editing'], 'AlaX Editing Domain'),\n    ('tRNA_SAD', 309, 352, colors['tRNA_SAD'], 'SAD'),\n    ('c_term', 366, 525, colors['c_term'], 'C-terminal'),\n]\ndraw_protein(axes[1], domains_iso2, 525, 'Isoform 2\\n(525 aa)')\n\n# Isoform 3 (586 aa)\ndomains_iso3 = [\n    ('extended_nterm', 1, 61, colors['extended_nterm'], 'Ext'),\n    ('p23H', 62, 187, colors['p23H'], 'p23-Homolog (CS)'),\n    ('alax_editing', 217, 426, colors['alax_editing'], 'AlaX Editing Domain'),\n    ('c_term', 427, 586, colors['c_term'], 'C-terminal'),\n]\ndraw_protein(axes[2], domains_iso3, 586, 'Isoform 3\\n(586 aa)')\n\n# Bottom panel: Key findings summary\nax = axes[3]\nax.set_xlim(0, 1)\nax.set_ylim(0, 1)\nax.set_frame_on(False)\nax.set_xticks([])\nax.set_yticks([])\n\nfindings = [\n    (\"\u2713 CONSERVED\", \"Zinc-binding HxxxH (H109, H113) and CxxxH (C209, H213) motifs\", '#2E86AB'),\n    (\"\u2713 CONSERVED\", \"AlaX editing domain architecture (IPR018165, AlaX-L subfamily)\", '#2E86AB'),\n    (\"\u2713 ACTIVE\", \"Isoform 1 (AlaXp only) has Ser-tRNA(Ala) deacylase activity in vitro\", '#2E86AB'),\n    (\"\u2717 INACTIVE\", \"Isoform 2 (p23H+AlaXp fusion) is catalytically INACTIVE\", '#C73E1D'),\n    (\"\u2717 ABSENT\", \"No TPR domain in any isoform \u2192 no direct HSP90 binding module\", '#C73E1D'),\n    (\"\u25cf NOTE\", \"p23H is CS-domain homolog (not TPR); regulates editing in cis/trans\", '#F18F01'),\n]\n\nfor i, (status, text, color) in enumerate(findings):\n    y = 0.85 - i * 0.14\n    ax.text(0.02, y, status, fontsize=9, fontweight='bold', color=color, va='center')\n    ax.text(0.17, y, text, fontsize=9, va='center', color='#333333')\n\n# Legend\nlegend_elements = [\n    mpatches.Patch(facecolor=colors['alax_editing'], label='AlaX Editing Domain'),\n    mpatches.Patch(facecolor=colors['beta_barrel'], label='Translation \u03b2-barrel'),\n    mpatches.Patch(facecolor=colors['tRNA_SAD'], label='tRNA_SAD'),\n    mpatches.Patch(facecolor=colors['p23H'], label='p23-Homolog (CS domain)'),\n    mpatches.Patch(facecolor=colors['c_term'], label='C-terminal extension'),\n    mpatches.Patch(facecolor=colors['zinc'], label='Zinc-binding residues'),\n]\nfig.legend(handles=legend_elements, loc='lower center', ncol=3, fontsize=8, frameon=True, bbox_to_anchor=(0.5, -0.02))\n\nplt.tight_layout()\nplt.savefig('aarsd1_domain_architecture.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Domain architecture figure saved.\")\n",
  "plot_number": 1
}