{
  "filename": "plot_2.png",
  "iteration": 1,
  "description": "Comprehensive evidence summary visualization for scully hypothesis evaluation",
  "timestamp": "2026-07-01 09:17:39",
  "code": "\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\n\nfig, axes = plt.subplots(2, 2, figsize=(18, 14))\n\n# ---- Panel A: Sequence alignment overview ----\nax = axes[0, 0]\nax.set_title(\"A. Sequence Conservation Map\", fontsize=13, fontweight='bold')\n\nscu_seq = \"MIKNAVSLVTGGASGLGRATAERLAKQGASVILADLPSSKGNEVAKELGDKVVFVPVDVTSEKDVSAALQTAKDKFGRLDLTVNCAGTATAVKTFNFNKNVAHRLEDFQRVININTVGTFNVIRLSAGLMGANEPNQDGQRGVIVNTASVAAFDGQIGQAAYSASKAAVVGMTLPIARDLSTQGIRICTIAPGLFNTPMLAALPEKVRTFLAKSIPFPQRLGEPSEYAHLVQAIYENPLLNGEVIRIDGALRMMP\"\nhsd_seq = \"MAAACRSVKGLVAVITGGASGLGLATAERLVGQGASAVLLDLPNSGGEAQAKKLGNNCVFAPADVTSEKDVQTALALAKGKFGRVDVAVNCAGIAVASKTYNLKKGQTHTLEDFQRVLDVNLMGTFNVIRLVAGEMGQNEPDQGGQRGVIINTASVAAFEGQVGQAAYSASKGGIVGMTLPIARDLAPIGIRVMTIAPGLFGTPLLTSLPEKVCNFLASQVPFPSRLGDPAEYAHLVQAIIENPFLNGEVIRLDGAIRMQP\"\n\n# Simple sliding window identity\nwindow = 10\nidentities = []\nfor i in range(min(len(scu_seq), len(hsd_seq)) - window):\n    s1 = scu_seq[i:i+window]\n    s2 = hsd_seq[i:i+window]\n    ident = sum(1 for a, b in zip(s1, s2) if a == b) / window\n    identities.append(ident)\n\npositions = range(len(identities))\nax.fill_between(positions, identities, alpha=0.3, color='steelblue')\nax.plot(positions, identities, color='steelblue', linewidth=0.8)\nax.axhline(y=0.731, color='red', linestyle='--', alpha=0.5, label='Overall identity (73.1%)')\n\n# Mark key features\nfeature_positions = [\n    (10, 'Rossmann\\nmotif', 'green'),\n    (84, 'NCAG', 'orange'),\n    (149, 'S149', 'blue'),\n    (162, 'Y162\\n(active)', 'red'),\n    (166, 'K166', 'purple'),\n]\nfor pos, label, color in feature_positions:\n    if pos < len(identities):\n        ax.axvline(x=pos, color=color, alpha=0.5, linewidth=1.5)\n        ax.text(pos, 1.05, label, ha='center', fontsize=7, color=color, fontweight='bold')\n\nax.set_xlim(0, len(identities))\nax.set_ylim(0, 1.15)\nax.set_xlabel('Position (SCU numbering)')\nax.set_ylabel('Identity (10-residue window)')\nax.legend(loc='lower right', fontsize=9)\n\n# ---- Panel B: Catalytic triad geometry comparison ----\nax2 = axes[0, 1]\nax2.set_title(\"B. Catalytic Triad Geometry (AlphaFold)\", fontsize=13, fontweight='bold')\n\n# Plot the triangles\nscu_dists = {'S-Y': 8.89, 'S-K': 5.92, 'Y-K': 6.23}\nhsd_dists = {'S-Y': 8.81, 'S-K': 5.87, 'Y-K': 6.24}\n\ncategories = list(scu_dists.keys())\nx = np.arange(len(categories))\nwidth = 0.35\n\nbars1 = ax2.bar(x - width/2, list(scu_dists.values()), width, label='SCU (O18404)', \n                color='steelblue', edgecolor='black')\nbars2 = ax2.bar(x + width/2, list(hsd_dists.values()), width, label='HSD17B10 (Q99714)', \n                color='goldenrod', edgecolor='black')\n\n# Add value labels\nfor bar in bars1:\n    ax2.text(bar.get_x() + bar.get_width()/2., bar.get_height() + 0.1,\n             f'{bar.get_height():.2f}', ha='center', va='bottom', fontsize=10)\nfor bar in bars2:\n    ax2.text(bar.get_x() + bar.get_width()/2., bar.get_height() + 0.1,\n             f'{bar.get_height():.2f}', ha='center', va='bottom', fontsize=10)\n\nax2.set_ylabel('CA-CA Distance (\u00c5)')\nax2.set_xticks(x)\nax2.set_xticklabels(['Ser\u2013Tyr', 'Ser\u2013Lys', 'Tyr\u2013Lys'], fontsize=11)\nax2.set_ylim(0, 11)\nax2.legend(fontsize=10)\n\n# Add delta values\ndeltas = [abs(scu_dists[k] - hsd_dists[k]) for k in categories]\nfor i, d in enumerate(deltas):\n    ax2.text(i, 10, f'\u0394 = {d:.2f} \u00c5', ha='center', fontsize=10, color='green', fontweight='bold')\n\n# ---- Panel C: Evidence matrix summary ----\nax3 = axes[1, 0]\nax3.set_title(\"C. Evidence Summary for Hypothesis\", fontsize=13, fontweight='bold')\nax3.axis('off')\n\nevidence_data = [\n    (\"Category\", \"Evidence\", \"Verdict\"),\n    (\"Sequence\", \"73% identity, 83% similarity\", \"SUPPORTS \u2713\"),\n    (\"Domain\", \"Both SDR (PF00106/adh_short)\", \"SUPPORTS \u2713\"),\n    (\"Catalytic triad\", \"S-Y-K 100% conserved\", \"SUPPORTS \u2713\"),\n    (\"Active site motif\", \"YSASK identical\", \"SUPPORTS \u2713\"),\n    (\"NAD-binding\", \"TGGASGLG identical\", \"SUPPORTS \u2713\"),\n    (\"Binding sites\", \"11/11 (100%) conserved\", \"SUPPORTS \u2713\"),\n    (\"Structural geom.\", \"CA-CA \u0394\u0394 < 0.08 \u00c5\", \"SUPPORTS \u2713\"),\n    (\"Enzymatic assay\", \"Direct IDA (PMID 12917011)\", \"SUPPORTS \u2713\"),\n    (\"Localization\", \"Mitochondrial matrix (IDA)\", \"SUPPORTS \u2713\"),\n    (\"Mutant phenotype\", \"Lipid inclusions\", \"SUPPORTS* \u2713\"),\n    (\"Moonlighting\", \"Also MRPP2 (RNase P)\", \"QUALIFIES \u26a0\"),\n    (\"Redundancy\", \"Had1/Had2/MTP\u03b1 also exist\", \"QUALIFIES \u26a0\"),\n]\n\ncolors_map = {\"SUPPORTS \u2713\": \"#c8e6c9\", \"SUPPORTS* \u2713\": \"#e8f5e9\", \"QUALIFIES \u26a0\": \"#fff9c4\"}\n\ntable = ax3.table(cellText=evidence_data, loc='center', cellLoc='center')\ntable.auto_set_font_size(False)\ntable.set_fontsize(9)\ntable.scale(1, 1.4)\n\nfor i, row in enumerate(evidence_data):\n    if i == 0:  # header\n        for j in range(3):\n            table[i, j].set_facecolor('#424242')\n            table[i, j].set_text_props(color='white', fontweight='bold')\n    else:\n        verdict = row[2]\n        for key, color in colors_map.items():\n            if key in verdict:\n                table[i, 2].set_facecolor(color)\n                break\n\n# ---- Panel D: Functional context ----\nax4 = axes[1, 1]\nax4.set_title(\"D. Functional Context: Beta-Oxidation Step 3\", fontsize=13, fontweight='bold')\nax4.axis('off')\n\ncontext_text = \"\"\"\nHYPOTHESIS VERDICT: SUPPORTED\n\nScully (scu, O18404) IS a mitochondrial\n3-hydroxyacyl-CoA dehydrogenase that CAN carry out\nstep 3 of fatty acid \u03b2-oxidation, as the ortholog\nof human HSD17B10 (Q99714).\n\nKEY NUANCES:\n\u2022 Scully = HSD17B10 ortholog (SDR family), NOT HADH\n  ortholog (different protein family/fold)\n\u2022 The hypothesis correctly identifies orthology to\n  HSD17B10, not HADH\n\u2022 Scully is multifunctional: also acts on steroids,\n  bile acids, and as MRPP2 (RNase P component)\n\u2022 Drosophila has additional \u03b2-oxidation step 3\n  enzymes (Had1, Had2, MTP\u03b1)\n\u2022 Loss-of-function phenotypes conflate dehydrogenase\n  and RNase P activities\n\"\"\"\nax4.text(0.05, 0.95, context_text, fontsize=10, va='top', ha='left',\n         transform=ax4.transAxes, family='monospace',\n         bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.8))\n\nplt.tight_layout()\nplt.savefig(\"evidence_summary.png\", dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Evidence summary figure saved.\")\n",
  "plot_number": 2
}