{
  "filename": "evidence_assessment.png",
  "iteration": 1,
  "description": "Comprehensive evidence assessment figure: PANTHER tree, domain architecture, sequence identity, and evidence summary for LPL1 MAG lipase hypothesis",
  "timestamp": "2026-07-05 07:32:54",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(2, 2, figsize=(16, 14))\nfig.suptitle('Evidence Assessment: LPL1 (Q5AMS2) Monoacylglycerol Lipase Activity (GO:0047372)', \n             fontsize=14, fontweight='bold', y=0.98)\n\n# Panel 1: PANTHER family tree schematic\nax1 = axes[0, 0]\nax1.set_xlim(0, 10)\nax1.set_ylim(0, 10)\nax1.set_title('A. PANTHER Family Tree (PTHR12482)\\nDUF676 Alpha/Beta Hydrolase', fontweight='bold')\nax1.axis('off')\n\n# Draw simplified tree\n# Root duplication\nax1.plot([5, 5], [9, 8], 'k-', lw=2)\nax1.plot([5, 2.5], [8, 7], 'k-', lw=2)\nax1.plot([5, 7.5], [8, 7], 'k-', lw=2)\n\n# SF62 branch (ROG1) - left\nax1.plot([2.5, 2.5], [7, 5], 'k-', lw=2)\nax1.plot([2.5, 1.5], [5, 4], 'k-', lw=2)  # ROG1\n\n# SF65/SF24 branch - duplication\nax1.plot([2.5, 4], [5, 4], 'k-', lw=2)  # SF65 then SF24\nax1.plot([4, 4], [4, 3], 'k-', lw=2)\nax1.plot([4, 3], [3, 2], 'k-', lw=2)  # SF24 - LPL1\nax1.plot([4, 5.5], [3, 2], 'k-', lw=2)  # SF65\n\n# SF5 branch - right\nax1.plot([7.5, 7.5], [7, 4], 'k-', lw=2)\n\n# Labels and nodes\nax1.add_patch(plt.Circle((5, 9), 0.25, color='orange', zorder=5))\nax1.text(5, 9.5, 'Root', ha='center', fontsize=8)\nax1.add_patch(plt.Circle((5, 8), 0.2, color='red', zorder=5))\nax1.text(5.4, 8.2, 'DUPLICATION', fontsize=7, color='red', fontstyle='italic')\n\nax1.add_patch(plt.Circle((2.5, 5), 0.2, color='red', zorder=5))\nax1.text(2.9, 5.2, 'DUP', fontsize=7, color='red', fontstyle='italic')\n\nax1.add_patch(plt.Circle((4, 3), 0.2, color='red', zorder=5))\nax1.text(4.4, 3.2, 'DUP', fontsize=7, color='red', fontstyle='italic')\n\n# Leaf labels\nax1.add_patch(mpatches.FancyBboxPatch((0.3, 3.5), 2, 0.8, boxstyle=\"round,pad=0.1\", \n                                       facecolor='#ff9999', edgecolor='black', lw=1.5))\nax1.text(1.3, 3.9, 'SF62: ROG1\\nMAG lipase (IDA)', fontsize=8, ha='center', fontweight='bold')\n\nax1.add_patch(mpatches.FancyBboxPatch((1.8, 1.3), 2.4, 0.8, boxstyle=\"round,pad=0.1\", \n                                       facecolor='#99ccff', edgecolor='black', lw=1.5))\nax1.text(3, 1.7, 'SF24: Sc_LPL1/Ca_LPL1\\nPhospholipase B (IDA)', fontsize=8, ha='center', fontweight='bold')\n\nax1.add_patch(mpatches.FancyBboxPatch((4.8, 1.3), 2, 0.8, boxstyle=\"round,pad=0.1\", \n                                       facecolor='#dddddd', edgecolor='black'))\nax1.text(5.8, 1.7, 'SF65: Esterase\\n(putative)', fontsize=8, ha='center')\n\nax1.add_patch(mpatches.FancyBboxPatch((6.5, 3.5), 2, 0.8, boxstyle=\"round,pad=0.1\", \n                                       facecolor='#dddddd', edgecolor='black'))\nax1.text(7.5, 3.9, 'SF5: Other\\nlipases', fontsize=8, ha='center')\n\n# Arrow showing annotation propagation\nax1.annotate('IBA propagation\\n(across 2 duplications!)', \n             xy=(2.5, 3.5), xytext=(1, 2.3),\n             arrowprops=dict(arrowstyle='->', color='red', lw=1.5),\n             fontsize=8, color='red', ha='center')\nax1.annotate('', xy=(3, 2.1), xytext=(1, 2.3),\n             arrowprops=dict(arrowstyle='->', color='red', lw=1.5, ls='--'))\n\n# Panel 2: Domain architecture comparison\nax2 = axes[0, 1]\nax2.set_xlim(0, 750)\nax2.set_ylim(-0.5, 5.5)\nax2.set_title('B. Domain Architecture Comparison', fontweight='bold')\nax2.set_xlabel('Residue position')\nax2.set_yticks([0, 1, 2, 3, 4])\nax2.set_yticklabels(['MGL2\\n(Q03649)', 'YJU3\\n(P28321)', 'ROG1\\n(P53118)', \n                      'Sc_LPL1\\n(Q08448)', 'Ca_LPL1\\n(Q5AMS2)'], fontsize=9)\n\n# Draw protein bars\nproteins = [\n    ('MGL2', 449, [(1, 449, '#bbbbbb', 'Abhydro_1')], [(230, 'GFSLG')], 'PTHR10794'),\n    ('YJU3', 313, [(1, 313, '#aaddaa', 'Hydrolase_4')], [(121, 'GHSMG')], 'PTHR11614'),\n    ('ROG1', 685, [(234, 434, '#ff9999', 'DUF676')], [(267, 'GHSLG')], 'PTHR12482:SF62'),\n    ('Sc_LPL1', 450, [(1, 200, '#99ccff', 'DUF676')], [(88, 'GYSQG')], 'PTHR12482:SF24'),\n    ('Ca_LPL1', 556, [(14, 213, '#6699ff', 'DUF676')], [(102, 'GYSLG')], 'PTHR12482:SF24'),\n]\n\nfor i, (name, length, domains, motifs, panther) in enumerate(proteins):\n    # Background bar\n    ax2.barh(i, length, height=0.4, color='#eeeeee', edgecolor='gray', linewidth=0.5)\n    # Domain\n    for dstart, dend, color, dlabel in domains:\n        ax2.barh(i, dend-dstart, left=dstart, height=0.4, color=color, edgecolor='black', linewidth=0.5)\n        ax2.text((dstart+dend)/2, i, dlabel, ha='center', va='center', fontsize=7, fontweight='bold')\n    # GXSXG motif\n    for mpos, mlabel in motifs:\n        ax2.plot(mpos, i+0.3, 'v', color='red', markersize=6)\n        ax2.text(mpos, i+0.42, mlabel, ha='center', va='bottom', fontsize=6, color='red')\n    # Length label\n    ax2.text(length+5, i, f'{length}aa', va='center', fontsize=7)\n    # PANTHER\n    ax2.text(700, i, panther, va='center', fontsize=6, color='gray')\n\n# TM regions\nax2.barh(4, 20, left=286, height=0.4, color='yellow', edgecolor='orange', linewidth=1)\nax2.barh(3, 20, left=269, height=0.4, color='yellow', edgecolor='orange', linewidth=1)\n\n# Legend\nax2.text(350, 5.2, 'TM', fontsize=7, color='orange', fontweight='bold')\nax2.plot([340], [5.2], 's', color='yellow', markersize=6, markeredgecolor='orange')\n\n# Panel 3: Sequence identity heatmap\nax3 = axes[1, 0]\nax3.set_title('C. DUF676 Domain Sequence Identity (%)', fontweight='bold')\n\n# Identity matrix (from our analysis)\nlabels = ['Ca_LPL1', 'Sc_LPL1', 'Sc_ROG1']\nidentity_matrix = np.array([\n    [100, 44.4, 25.6],\n    [44.4, 100, 25.0],  # estimated\n    [25.6, 25.0, 100]\n])\n\nim = ax3.imshow(identity_matrix, cmap='YlOrRd', vmin=20, vmax=100, aspect='auto')\nax3.set_xticks(range(3))\nax3.set_yticks(range(3))\nax3.set_xticklabels(labels, fontsize=10)\nax3.set_yticklabels(labels, fontsize=10)\n\nfor i in range(3):\n    for j in range(3):\n        color = 'white' if identity_matrix[i,j] > 60 else 'black'\n        ax3.text(j, i, f'{identity_matrix[i,j]:.1f}%', ha='center', va='center', \n                fontsize=12, fontweight='bold', color=color)\n\nplt.colorbar(im, ax=ax3, label='Sequence identity (%)')\n\n# Panel 4: Evidence summary table\nax4 = axes[1, 1]\nax4.axis('off')\nax4.set_title('D. Evidence Summary', fontweight='bold')\n\ntable_data = [\n    ['Evidence', 'Finding', 'Impact'],\n    ['Closest ortholog\\n(Sc_LPL1)', 'Phospholipase B\\n(IDA, PMID:25014274)', 'AGAINST\\nMAG lipase'],\n    ['Same subfamily\\n(PTHR12482:SF24)', 'Both in LD Phospho-\\nlipase 1 subfamily', 'AGAINST\\nMAG lipase'],\n    ['MAG lipase source\\n(Sc_ROG1)', 'Different subfamily\\n(SF62, 25.6% identity)', 'WEAKENS\\nIBA transfer'],\n    ['2 duplication events\\nbetween subfamilies', 'Functional divergence\\nexpected after DUP', 'WEAKENS\\nIBA transfer'],\n    ['InterPro Rog1_fam\\n(IPR016445)', 'Ca_LPL1 LACKS\\nthis signature', 'AGAINST\\nMAG lipase'],\n    ['Ca_LPL1 direct\\nevidence', 'NONE available\\n(uncharacterized)', 'INCONCLUSIVE'],\n]\n\ncolors = ['#cccccc', '#ffcccc', '#ffcccc', '#ffddaa', '#ffddaa', '#ffcccc', '#ffffcc']\n\ntable = ax4.table(cellText=table_data, cellLoc='center', loc='center',\n                  cellColours=[[c]*3 for c in colors])\ntable.auto_set_font_size(False)\ntable.set_fontsize(8)\ntable.scale(1, 1.8)\n\n# Style header row\nfor j in range(3):\n    table[0, j].set_facecolor('#666666')\n    table[0, j].set_text_props(color='white', fontweight='bold')\n\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig('evidence_assessment.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Figure saved as evidence_assessment.png\")\n"
}