{
  "filename": "plot_2.png",
  "iteration": 1,
  "description": "Comprehensive evidence summary figure for PGRPLC amidase activity assessment",
  "timestamp": "2026-07-05 11:15:39",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\n# Create a comprehensive figure showing the evidence\nfig, axes = plt.subplots(2, 1, figsize=(14, 12), gridspec_kw={'height_ratios': [1, 1.2]})\n\n# === Panel A: Zinc-binding motif comparison ===\nax1 = axes[0]\nax1.set_title('A. Critical Zinc-Binding Motifs in PGRP Family', fontsize=13, fontweight='bold', loc='left')\n\n# Motif data (extracted from sequences)\nmotif_data = [\n    ('Dm_PGRP_LB\\n(CATALYTIC)', 'YVIIHH', 'ECPGxxx', True),\n    ('Dm_PGRP_SC1b\\n(CATALYTIC)', 'YAIIHH', 'ECPGxxx', True),\n    ('Hs_PGLYRP2\\n(CATALYTIC)', 'FLYVHH', 'DCPGxxx', True),\n    ('', '', '', None),  # separator\n    ('Ag_PGRPLC\\n(TARGET)', 'VIIIAHT', 'no Cys', False),\n    ('Dm_PGRP_LC\\n(RECEPTOR)', '(no HH)', 'no Cys', False),\n]\n\ny_positions = []\ny = 0\nfor i, (label, motif1, motif2, is_catalytic) in enumerate(motif_data):\n    if is_catalytic is None:\n        y -= 0.3\n        continue\n    \n    y_positions.append(y)\n    \n    # Background color\n    if is_catalytic:\n        bg_color = '#d5f5e3'\n    else:\n        bg_color = '#fadbd8'\n    \n    # Draw background\n    ax1.axhspan(y - 0.35, y + 0.35, color=bg_color, alpha=0.5)\n    \n    # Label\n    fontweight = 'bold' if 'TARGET' in label else 'normal'\n    color = '#c0392b' if 'TARGET' in label else 'black'\n    ax1.text(-0.5, y, label, ha='right', va='center', fontsize=10, \n            fontweight=fontweight, color=color)\n    \n    # Zinc ligand 1 motif\n    for j, char in enumerate(motif1):\n        is_critical = False\n        if is_catalytic and char == 'H' and j >= 4:  # the HH\n            is_critical = True\n            fc = '#27ae60'\n        elif not is_catalytic and motif1 != '(no HH)':\n            if j == 4:  # position of first H (should be A or similar)\n                fc = '#e74c3c'\n                is_critical = True\n            elif j == 5 and char == 'H':\n                fc = '#f39c12'  # the remaining H\n            else:\n                fc = '#ecf0f1'\n        elif motif1 == '(no HH)':\n            fc = '#95a5a6'\n        else:\n            fc = '#ecf0f1'\n        \n        rect = plt.Rectangle((j * 0.5, y - 0.25), 0.45, 0.5, \n                             facecolor=fc, edgecolor='gray', linewidth=0.5)\n        ax1.add_patch(rect)\n        ax1.text(j * 0.5 + 0.225, y, char, ha='center', va='center', \n                fontsize=12, fontweight='bold', color='white' if fc not in ['#ecf0f1'] else 'black')\n    \n    # Cys motif\n    x_start = 5\n    if motif2 == 'no Cys':\n        ax1.text(x_start, y, '\u2014 no Cys \u2014', ha='left', va='center', \n                fontsize=11, color='#e74c3c', fontweight='bold', style='italic')\n    else:\n        for j, char in enumerate(motif2):\n            if char == 'C':\n                fc = '#27ae60'\n            else:\n                fc = '#ecf0f1'\n            rect = plt.Rectangle((x_start + j * 0.5, y - 0.25), 0.45, 0.5,\n                                facecolor=fc, edgecolor='gray', linewidth=0.5)\n            ax1.add_patch(rect)\n            ax1.text(x_start + j * 0.5 + 0.225, y, char, ha='center', va='center',\n                    fontsize=12, fontweight='bold', color='white' if char == 'C' else 'black')\n    \n    y -= 1\n\nax1.set_xlim(-3.5, 9)\nax1.set_ylim(y - 0.5, 1)\nax1.text(1.5, 0.7, 'N-terminal HH motif\\n(Zn ligands)', ha='center', fontsize=9, fontweight='bold')\nax1.text(6.5, 0.7, 'C-terminal Cys\\n(3rd Zn ligand)', ha='center', fontsize=9, fontweight='bold')\nax1.axis('off')\n\n# === Panel B: Evidence summary table ===\nax2 = axes[1]\nax2.set_title('B. Evidence Summary: GO:0008745 Annotation Assessment', fontsize=13, fontweight='bold', loc='left')\nax2.axis('off')\n\ntable_data = [\n    ['Evidence Type', 'Finding', 'Implication'],\n    ['Zinc ligand 1 (His)', 'H \u2192 A substitution\\nin Ag_PGRPLC', 'Cannot coordinate\\ncatalytic zinc'],\n    ['Zinc ligand 3 (Cys)', 'C \u2192 S substitution\\nin Ag_PGRPLC', 'Cannot coordinate\\ncatalytic zinc'],\n    ['Catalytic Tyr', 'Y conserved', 'Necessary but\\nnot sufficient'],\n    ['Zinc ligand 2 (His)', 'H conserved', 'Necessary but\\nnot sufficient'],\n    ['Dm PGRP-LC ortholog', 'Also lacks HH + C;\\nNO amidase GO term', 'Consistent: receptors\\nlack amidase activity'],\n    ['Functional evidence\\n(PMID:19662170)', 'Ag PGRPLC is Imd\\npathway receptor', 'Signal transduction,\\nnot enzymatic'],\n    ['Functional evidence\\n(PMID:15657141)', 'Dm PGRP-LC is\\nsignal-transducing\\nreceptor', 'Pattern recognition,\\nnot catalysis'],\n]\n\ntable = ax2.table(cellText=table_data[1:], colLabels=table_data[0],\n                  loc='center', cellLoc='center',\n                  colWidths=[0.3, 0.35, 0.35])\ntable.auto_set_font_size(False)\ntable.set_fontsize(9)\ntable.scale(1, 2.0)\n\n# Color the header\nfor j in range(3):\n    table[0, j].set_facecolor('#2c3e50')\n    table[0, j].set_text_props(color='white', fontweight='bold')\n\n# Color rows\nfor i in range(1, len(table_data)):\n    for j in range(3):\n        if i <= 2:  # critical missing residues\n            table[i, j].set_facecolor('#fadbd8')\n        elif i <= 4:  # conserved but insufficient\n            table[i, j].set_facecolor('#fef9e7')\n        else:  # supporting evidence\n            table[i, j].set_facecolor('#d5f5e3')\n\n# Add verdict box\nverdict_text = (\"VERDICT: OVER-ANNOTATED\\n\\n\"\n               \"GO:0008745 (N-acetylmuramoyl-L-alanine amidase activity)\\n\"\n               \"should be REMOVED from Ag PGRPLC (A7UTA1).\\n\\n\"\n               \"The protein is a peptidoglycan pattern recognition receptor,\\n\"\n               \"not a catalytic amidase. Two of three zinc ligands are substituted.\")\n\nfig.text(0.5, -0.02, verdict_text, ha='center', va='top', fontsize=11,\n        fontweight='bold', color='#c0392b',\n        bbox=dict(boxstyle='round,pad=0.5', facecolor='#fdf2e9', edgecolor='#c0392b', linewidth=2))\n\nplt.tight_layout()\nplt.subplots_adjust(bottom=0.15)\nplt.savefig('pgrp_evidence_summary.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Evidence summary figure saved.\")\n",
  "plot_number": 2
}