{
  "filename": "plot_2.png",
  "iteration": 2,
  "description": "Creating summary figure showing CLC family divergence and evidence weight against GO:0030321 for CLCN7",
  "timestamp": "2026-06-21 23:34:36",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\n# Create summary figure: CLC family functional divergence and CLCN7 localization evidence\nfig, axes = plt.subplots(1, 2, figsize=(16, 8))\n\n# Panel A: CLC family tree showing channel vs antiporter divergence\nax1 = axes[0]\nax1.set_xlim(0, 10)\nax1.set_ylim(0, 12)\nax1.set_title('A. CLC Family Functional Divergence', fontsize=13, fontweight='bold')\nax1.axis('off')\n\n# Root\nax1.plot([5, 5], [11, 10], 'k-', lw=2)\nax1.text(5, 11.3, 'CLC Ancestor', ha='center', fontsize=10, fontweight='bold')\n\n# Branch: Channels vs Antiporters\nax1.plot([5, 2.5], [10, 9], 'b-', lw=2)\nax1.plot([5, 7.5], [10, 9], 'r-', lw=2)\n\n# Channel branch\nax1.text(2.5, 9.2, 'Cl\u207b Channels', ha='center', fontsize=10, fontweight='bold', color='blue')\nax1.text(2.5, 8.6, '(Plasma membrane)', ha='center', fontsize=8, color='blue')\nax1.plot([2.5, 1.2], [8.3, 7.5], 'b-', lw=1.5)\nax1.plot([2.5, 2.5], [8.3, 7.5], 'b-', lw=1.5)\nax1.plot([2.5, 3.8], [8.3, 7.5], 'b-', lw=1.5)\n\nchannel_genes = [\n    ('ClC-1', 'Muscle', 1.2),\n    ('ClC-2', 'Ubiquitous', 2.5),\n    ('ClC-Ka/Kb', 'Kidney\\nepithelium', 3.8)\n]\nfor name, tissue, x in channel_genes:\n    color = 'green' if 'Ka' in name else 'blue'\n    bbox_color = '#90EE90' if 'Ka' in name else '#ADD8E6'\n    ax1.text(x, 7.0, name, ha='center', fontsize=9, fontweight='bold',\n             bbox=dict(boxstyle='round,pad=0.3', facecolor=bbox_color, edgecolor=color))\n    ax1.text(x, 6.2, tissue, ha='center', fontsize=7, style='italic')\n\n# Mark ClC-Ka/Kb as having GO:0030321\nax1.text(3.8, 5.5, '\u2713 GO:0030321', ha='center', fontsize=8, color='green', fontweight='bold')\n\n# Antiporter branch\nax1.text(7.5, 9.2, 'Cl\u207b/H\u207a Antiporters', ha='center', fontsize=10, fontweight='bold', color='red')\nax1.text(7.5, 8.6, '(Intracellular)', ha='center', fontsize=8, color='red')\n\nax1.plot([7.5, 5.8], [8.3, 7.5], 'r-', lw=1.5)\nax1.plot([7.5, 7.0], [8.3, 7.5], 'r-', lw=1.5)\nax1.plot([7.5, 8.2], [8.3, 7.5], 'r-', lw=1.5)\nax1.plot([7.5, 9.3], [8.3, 7.5], 'r-', lw=1.5)\n\nantiporter_genes = [\n    ('ClC-3', 'Endosomes', 5.8),\n    ('ClC-4/5', 'Endosomes', 7.0),\n    ('ClC-6', 'Late endo.', 8.2),\n    ('ClC-7', 'Lysosomes', 9.3)\n]\nfor name, tissue, x in antiporter_genes:\n    color = '#FF4444' if name == 'ClC-7' else '#FF9999'\n    ax1.text(x, 7.0, name, ha='center', fontsize=9, fontweight='bold',\n             bbox=dict(boxstyle='round,pad=0.3', facecolor='#FFB3B3', edgecolor='red'))\n    ax1.text(x, 6.2, tissue, ha='center', fontsize=7, style='italic')\n\n# Mark ClC-7 as NOT having GO:0030321\nax1.text(9.3, 5.5, '\u2717 GO:0030321', ha='center', fontsize=8, color='red', fontweight='bold')\n\n# Add arrow showing misannotation\nax1.annotate('Over-annotation\\n(family-level\\npropagation)', \n             xy=(9.3, 5.3), xytext=(6.5, 4.0),\n             fontsize=8, ha='center', color='#CC0000',\n             arrowprops=dict(arrowstyle='->', color='#CC0000', lw=1.5))\n\n# Legend\nax1.text(5, 2.5, 'GO:0030321 = transepithelial chloride transport', \n         ha='center', fontsize=9, fontweight='bold',\n         bbox=dict(boxstyle='round,pad=0.4', facecolor='lightyellow'))\nax1.text(5, 1.5, 'Only applicable to plasma membrane Cl\u207b channels\\nin polarized epithelial cells', \n         ha='center', fontsize=8, style='italic')\n\n# Panel B: Evidence weight diagram\nax2 = axes[1]\nax2.set_title('B. Evidence Against GO:0030321 for CLCN7', fontsize=13, fontweight='bold')\n\nevidence_categories = [\n    'Subcellular localization\\n(lysosome membrane)',\n    'Sorting motifs\\n(dileucine, acidic cluster)',\n    'Disease phenotype\\n(lysosomal storage, osteopetrosis)',\n    'Transport mechanism\\n(2Cl\u207b/1H\u207a antiporter, not channel)',\n    'Annotation provenance\\n(family-level misattribution)',\n    'Structural evidence\\n(cryo-EM in lysosomal context)',\n    'CLC family comparison\\n(channels \u2260 antiporters)'\n]\n\nconfidence = [0.95, 0.90, 0.95, 0.92, 0.88, 0.93, 0.90]\nevidence_types = ['localization', 'computational', 'mutant phenotype', \n                  'direct assay', 'database', 'structural', 'evolutionary']\n\ncolors = ['#FF6B6B', '#FFA07A', '#FF6B6B', '#FF4500', '#FFD700', '#FF6347', '#FF8C00']\n\nbars = ax2.barh(range(len(evidence_categories)), confidence, color=colors, edgecolor='black', linewidth=0.5)\nax2.set_yticks(range(len(evidence_categories)))\nax2.set_yticklabels(evidence_categories, fontsize=9)\nax2.set_xlabel('Confidence that GO:0030321 is over-annotation', fontsize=10)\nax2.set_xlim(0, 1.0)\nax2.axvline(x=0.5, color='gray', linestyle='--', alpha=0.5)\n\n# Add evidence type labels\nfor i, (conf, etype) in enumerate(zip(confidence, evidence_types)):\n    ax2.text(conf + 0.01, i, f'{conf:.0%}', va='center', fontsize=8, fontweight='bold')\n\nax2.invert_yaxis()\n\nplt.tight_layout()\nplt.savefig('/tmp/clcn7_evidence_summary.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Evidence summary figure saved.\")\n",
  "plot_number": 2
}