{
  "filename": "plot_1.png",
  "iteration": 1,
  "description": "Create domain architecture comparison between active rhomboid protease and UBAC2 pseudoprotease showing absence of catalytic residues",
  "timestamp": "2026-07-05 05:16:25",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(3, 1, figsize=(14, 10), gridspec_kw={'height_ratios': [1, 1, 1.5]})\n\n# --- Panel 1: Active Rhomboid (RHBDL2) domain architecture ---\nax = axes[0]\nax.set_xlim(0, 350)\nax.set_ylim(-2, 4)\nax.set_title('Active Rhomboid Protease (RHBDL2, 303 aa)', fontsize=12, fontweight='bold', color='darkgreen')\n\n# Backbone\nax.barh(1, 303, height=0.8, left=0, color='#e8e8e8', edgecolor='gray')\n\n# 7 TM segments (approximate positions for RHBDL2)\ntm_positions = [(37,57), (67,87), (99,119), (134,154), (175,195), (214,234), (256,276)]\nfor i, (s, e) in enumerate(tm_positions):\n    ax.barh(1, e-s, height=0.8, left=s, color='#4CAF50', edgecolor='darkgreen', linewidth=1)\n    if i == 3:  # TM4 with catalytic Ser\n        ax.barh(1, e-s, height=0.8, left=s, color='#FF5722', edgecolor='darkred', linewidth=2)\n        ax.annotate('GxSG\\n(cat. Ser)', xy=(s+(e-s)/2, 0.2), ha='center', fontsize=7, \n                   fontweight='bold', color='darkred')\n    if i == 5:  # TM6 with catalytic His\n        ax.barh(1, e-s, height=0.8, left=s, color='#FF9800', edgecolor='darkorange', linewidth=2)\n        ax.annotate('Cat. His', xy=(s+(e-s)/2, 0.2), ha='center', fontsize=7,\n                   fontweight='bold', color='darkorange')\n\nax.text(150, 2.5, '7 TM segments \u2022 Catalytic Ser-His dyad PRESENT \u2022 Active protease \u2713', \n        ha='center', fontsize=9, color='darkgreen', fontweight='bold')\nax.set_yticks([])\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\nax.spines['left'].set_visible(False)\n\n# --- Panel 2: UBAC2 domain architecture ---\nax = axes[1]\nax.set_xlim(0, 350)\nax.set_ylim(-2, 4)\nax.set_title('UBAC2 - Rhomboid Pseudoprotease (344 aa)', fontsize=12, fontweight='bold', color='#D32F2F')\n\n# Backbone\nax.barh(1, 344, height=0.8, left=0, color='#e8e8e8', edgecolor='gray')\n\n# 3 TM segments\ntm_ubac2 = [(92, 112), (126, 146), (164, 184)]\nfor s, e in tm_ubac2:\n    ax.barh(1, e-s, height=0.8, left=s, color='#90CAF9', edgecolor='#1565C0', linewidth=1)\n\n# UBA domain\nax.barh(1, 40, height=0.8, left=304, color='#CE93D8', edgecolor='#6A1B9A', linewidth=1.5)\nax.annotate('UBA', xy=(324, 1), ha='center', va='center', fontsize=8, fontweight='bold')\n\n# LIR motif\nax.barh(1, 4, height=0.8, left=275, color='#FFD54F', edgecolor='#F57F17', linewidth=1.5)\nax.annotate('LIR', xy=(277, 0.2), ha='center', fontsize=7, fontweight='bold', color='#F57F17')\n\n# Mark ABSENCE of catalytic residues\nax.annotate('No GxSG in any TM', xy=(138, 2.3), ha='center', fontsize=9, \n           color='red', fontweight='bold')\nax.annotate('Only 3 TM segments', xy=(138, 3.0), ha='center', fontsize=9, \n           color='red', fontweight='bold')\n\n# X marks where catalytic residues would be\nfor s, e in tm_ubac2:\n    mid = s + (e-s)/2\n    ax.plot(mid, 1, 'x', color='red', markersize=10, markeredgewidth=2)\n\nax.text(280, 2.8, 'Catalytic Ser-His dyad ABSENT \u2717', \n        ha='center', fontsize=9, color='#D32F2F', fontweight='bold')\nax.set_yticks([])\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\nax.spines['left'].set_visible(False)\n\n# --- Panel 3: Evidence summary table ---\nax = axes[2]\nax.axis('off')\nax.set_title('Evidence Against Serine Endopeptidase Activity for UBAC2', \n            fontsize=12, fontweight='bold', pad=15)\n\ntable_data = [\n    ['Feature', 'Active Rhomboid (RHBDL2)', 'UBAC2', 'Assessment'],\n    ['GxSG catalytic motif', 'GASG at pos 185 (in TM4)', 'GSSG at pos 6 (N-term, NOT in TM)', 'ABSENT \u2717'],\n    ['Catalytic His (TM6)', 'Present', 'Not present in TM context', 'ABSENT \u2717'],\n    ['TM segment count', '7 segments', '3 segments', 'Insufficient \u2717'],\n    ['Protease activity shown', 'Yes (biochemical assays)', 'Never demonstrated', 'No evidence \u2717'],\n    ['Classified as pseudoprotease', 'No', 'Yes (PMID:23297223, InterPro)', 'PSEUDOPROTEASE'],\n    ['Known function', 'Intramembrane proteolysis', 'ER-phagy receptor', 'Non-catalytic'],\n]\n\ncolors_header = ['#263238'] * 4\ncolors_good = ['#E8F5E9', '#E8F5E9', '#FFEBEE', '#FFEBEE']\ncell_colors = [colors_header]\nfor i in range(1, len(table_data)):\n    cell_colors.append(colors_good)\n\ntable = ax.table(cellText=table_data, loc='center', cellLoc='center',\n                colWidths=[0.2, 0.3, 0.3, 0.2])\ntable.auto_set_font_size(False)\ntable.set_fontsize(8)\ntable.scale(1, 1.5)\n\n# Style header\nfor j in range(4):\n    table[0, j].set_facecolor('#37474F')\n    table[0, j].set_text_props(color='white', fontweight='bold')\n\n# Style data rows\nfor i in range(1, len(table_data)):\n    for j in range(4):\n        if j <= 1:\n            table[i, j].set_facecolor('#E8F5E9')\n        elif j == 2:\n            table[i, j].set_facecolor('#FFEBEE')\n        else:\n            table[i, j].set_facecolor('#FFCDD2')\n            table[i, j].set_text_props(fontweight='bold', color='#C62828')\n\n# Legend\nlegend_elements = [\n    mpatches.Patch(facecolor='#4CAF50', edgecolor='darkgreen', label='TM segment'),\n    mpatches.Patch(facecolor='#FF5722', edgecolor='darkred', label='Catalytic Ser (GxSG)'),\n    mpatches.Patch(facecolor='#FF9800', edgecolor='darkorange', label='Catalytic His'),\n    mpatches.Patch(facecolor='#90CAF9', edgecolor='#1565C0', label='TM (no catalytic residues)'),\n    mpatches.Patch(facecolor='#CE93D8', edgecolor='#6A1B9A', label='UBA domain'),\n    mpatches.Patch(facecolor='#FFD54F', edgecolor='#F57F17', label='LIR motif'),\n]\nfig.legend(handles=legend_elements, loc='lower center', ncol=6, fontsize=8,\n          bbox_to_anchor=(0.5, -0.02))\n\nplt.tight_layout()\nplt.savefig('ubac2_domain_comparison.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Domain comparison figure saved.\")\n",
  "plot_number": 1
}