{
  "filename": "domain_architecture_comparison.png",
  "iteration": 1,
  "description": "Domain architecture comparison showing lrx-1 lacks transmembrane helix unlike its paralogs and ortholog",
  "timestamp": "2026-07-04 22:45:46",
  "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, 1, 1, 1]})\nfig.suptitle('Domain Architecture Comparison: lrx-1 vs Paralogs and Ortholog', fontsize=14, fontweight='bold')\n\ndef draw_protein(ax, name, length, features, y=0.5):\n    \"\"\"Draw a protein with annotated features\"\"\"\n    # Protein backbone\n    ax.barh(y, length, height=0.3, color='lightgray', edgecolor='black', linewidth=0.5)\n    \n    colors = {\n        'Signal peptide': '#FFD700',\n        'Signal anchor': '#FFD700',\n        'Transmembrane': '#FF4444',\n        'LDL-A repeat': '#4488FF',\n        'Cytoplasmic': '#88CC88',\n        'Extracellular': '#CCCCFF',\n        'Disordered': '#DDDDDD'\n    }\n    \n    for feat_name, start, end in features:\n        color = colors.get(feat_name, '#AAAAAA')\n        ax.barh(y, end-start, left=start, height=0.3, color=color, \n                edgecolor='black', linewidth=0.5, alpha=0.8)\n        if end - start > 20:\n            ax.text((start+end)/2, y, feat_name, ha='center', va='center', \n                   fontsize=6, fontweight='bold')\n    \n    ax.set_xlim(0, max(length+10, 600))\n    ax.set_ylim(0, 1)\n    ax.set_ylabel(name, fontsize=11, fontweight='bold', rotation=0, labelpad=60)\n    ax.set_yticks([])\n    ax.spines['top'].set_visible(False)\n    ax.spines['right'].set_visible(False)\n    ax.spines['left'].set_visible(False)\n\n# lrx-1 (Q22179) - 368 aa\ndraw_protein(axes[0], 'lrx-1\\n(Q22179)\\n368 aa', 368, [\n    ('Signal peptide', 0, 19),\n    ('LDL-A repeat', 207, 246),\n    ('LDL-A repeat', 246, 287),\n    ('LDL-A repeat', 290, 330),\n    ('LDL-A repeat', 327, 368),\n])\naxes[0].annotate('NO TM helix\\n(SECRETED?)', xy=(368, 0.5), xytext=(420, 0.5),\n                fontsize=9, color='red', fontweight='bold',\n                arrowprops=dict(arrowstyle='->', color='red'))\n\n# EGG-1 (Q09967) - 551 aa\ndraw_protein(axes[1], 'EGG-1\\n(Q09967)\\n551 aa', 551, [\n    ('Cytoplasmic', 0, 48),\n    ('Transmembrane', 49, 69),\n    ('LDL-A repeat', 122, 160),\n    ('LDL-A repeat', 161, 213),\n    ('LDL-A repeat', 215, 252),\n    ('LDL-A repeat', 253, 288),\n    ('LDL-A repeat', 291, 328),\n    ('LDL-A repeat', 372, 414),\n    ('LDL-A repeat', 418, 456),\n    ('LDL-A repeat', 457, 494),\n])\naxes[1].annotate('Type II TM\\n(membrane)', xy=(59, 0.35), xytext=(59, 0.1),\n                fontsize=8, color='red', fontweight='bold',\n                arrowprops=dict(arrowstyle='->', color='red'))\n\n# EGG-2 (Q21629) - 548 aa\ndraw_protein(axes[2], 'EGG-2\\n(Q21629)\\n548 aa', 548, [\n    ('Cytoplasmic', 0, 49),\n    ('Transmembrane', 50, 70),\n    ('LDL-A repeat', 122, 160),\n    ('LDL-A repeat', 161, 213),\n    ('LDL-A repeat', 215, 252),\n    ('LDL-A repeat', 253, 288),\n    ('LDL-A repeat', 291, 328),\n    ('LDL-A repeat', 370, 412),\n    ('LDL-A repeat', 416, 454),\n    ('LDL-A repeat', 455, 492),\n])\naxes[2].annotate('Type II TM\\n(membrane)', xy=(60, 0.35), xytext=(60, 0.1),\n                fontsize=8, color='red', fontweight='bold',\n                arrowprops=dict(arrowstyle='->', color='red'))\n\n# CD320 (Q9NPF0) - 282 aa\ndraw_protein(axes[3], 'hCD320\\n(Q9NPF0)\\n282 aa', 282, [\n    ('Signal peptide', 0, 35),\n    ('LDL-A repeat', 53, 90),\n    ('LDL-A repeat', 131, 168),\n    ('Transmembrane', 230, 250),\n    ('Cytoplasmic', 251, 282),\n])\naxes[3].annotate('Type I TM\\n(membrane)', xy=(240, 0.35), xytext=(320, 0.3),\n                fontsize=8, color='red', fontweight='bold',\n                arrowprops=dict(arrowstyle='->', color='red'))\naxes[3].set_xlabel('Residue position', fontsize=10)\n\n# Legend\nlegend_elements = [\n    mpatches.Patch(facecolor='#FFD700', edgecolor='black', label='Signal peptide/anchor'),\n    mpatches.Patch(facecolor='#FF4444', edgecolor='black', label='Transmembrane helix'),\n    mpatches.Patch(facecolor='#4488FF', edgecolor='black', label='LDL-A repeat'),\n    mpatches.Patch(facecolor='#88CC88', edgecolor='black', label='Cytoplasmic'),\n    mpatches.Patch(facecolor='lightgray', edgecolor='black', label='Other regions'),\n]\nfig.legend(handles=legend_elements, loc='lower center', ncol=5, fontsize=9, \n          bbox_to_anchor=(0.5, -0.02))\n\nplt.tight_layout(rect=[0, 0.03, 1, 0.96])\nplt.savefig('domain_architecture_comparison.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved: domain_architecture_comparison.png\")\n"
}