{
  "filename": "plot_2.png",
  "iteration": 2,
  "description": "Create comprehensive 4-panel figure: pLDDT profile, zinc coordination schematic, RPP21 comparison, evidence summary",
  "timestamp": "2026-06-22 02:55:10",
  "code": "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\nimport numpy as np\nimport requests\n\n# Download AlphaFold model for pLDDT data\napi_url = \"https://alphafold.ebi.ac.uk/api/prediction/Q32NC0\"\nresp = requests.get(api_url, timeout=15)\napi_data = resp.json()\npdb_url = api_data[0]['pdbUrl']\npdb_resp = requests.get(pdb_url, timeout=15)\npdb_text = pdb_resp.text\n\n# Parse pLDDT\nresidues = []\nfor line in pdb_text.split('\\n'):\n    if line.startswith(\"ATOM\") and line[12:16].strip() == \"CA\":\n        resnum = int(line[22:26].strip())\n        bfactor = float(line[60:66].strip())\n        residues.append((resnum, bfactor))\n\nresnums = [r[0] for r in residues]\nplddts = [r[1] for r in residues]\n\n# Create comprehensive 3-panel figure\nfig = plt.figure(figsize=(16, 14))\ngs = fig.add_gridspec(3, 2, height_ratios=[1.2, 1.2, 1.5], hspace=0.35, wspace=0.3)\n\n# Panel A: pLDDT profile with domain annotations\nax1 = fig.add_subplot(gs[0, :])\ncolors = []\nfor p in plddts:\n    if p > 90: colors.append('#0053D6')\n    elif p > 70: colors.append('#65CBF3')\n    elif p > 50: colors.append('#FFDB13')\n    else: colors.append('#FF7D45')\nax1.bar(resnums, plddts, color=colors, width=1.0, edgecolor='none')\nax1.axhline(y=70, color='gray', linestyle='--', alpha=0.5, linewidth=0.8)\nax1.axhline(y=90, color='gray', linestyle=':', alpha=0.5, linewidth=0.8)\n\n# Highlight zinc-coordinating cysteines\nfor cys_pos in [43, 46, 104, 107]:\n    idx = resnums.index(cys_pos) if cys_pos in resnums else None\n    if idx is not None:\n        ax1.plot(cys_pos, plddts[idx], 'v', color='red', markersize=10, zorder=5)\n\n# Mark experimental structure coverage\nax1.axvspan(2, 119, alpha=0.08, color='blue', label='Resolved in cryo-EM (9UH9)')\nax1.axvspan(120, 220, alpha=0.06, color='gray')\n\nax1.annotate('Zn\u00b2\u207a\\nCPYC', xy=(44.5, 95), fontsize=9, ha='center', color='red', fontweight='bold')\nax1.annotate('Zn\u00b2\u207a\\nCKTC', xy=(105.5, 95), fontsize=9, ha='center', color='red', fontweight='bold')\nax1.annotate('Disordered\\n(not resolved)', xy=(170, 30), fontsize=9, ha='center', color='gray')\n\nax1.set_ylabel('AlphaFold pLDDT', fontsize=11)\nax1.set_xlabel('Residue number', fontsize=11)\nax1.set_title('A. C18orf21/RMP24 AlphaFold Confidence & Experimental Coverage', fontsize=13, fontweight='bold')\nax1.set_xlim(0, 225)\nax1.set_ylim(0, 105)\nax1.legend(loc='upper right', fontsize=9)\n\n# Panel B: Zinc coordination schematic\nax2 = fig.add_subplot(gs[1, 0])\nax2.set_xlim(-3, 3)\nax2.set_ylim(-3, 3)\nax2.set_aspect('equal')\nax2.axis('off')\nax2.set_title('B. Zinc Coordination in C18orf21\\n(PDB 9UH9, chain K)', fontsize=12, fontweight='bold')\n\n# Draw zinc at center\nzn_circle = plt.Circle((0, 0), 0.3, color='#888888', ec='black', linewidth=2, zorder=10)\nax2.add_patch(zn_circle)\nax2.text(0, 0, 'Zn\u00b2\u207a', ha='center', va='center', fontsize=11, fontweight='bold', color='white', zorder=11)\n\n# Draw coordinating cysteines in tetrahedral arrangement\ncys_positions = {\n    'CYS43': (-1.5, 1.5),\n    'CYS46': (1.5, 1.5),\n    'CYS104': (-1.5, -1.5),\n    'CYS107': (1.5, -1.5)\n}\n\nfor cys, (cx, cy) in cys_positions.items():\n    cys_circle = plt.Circle((cx, cy), 0.4, color='#FFD700', ec='black', linewidth=1.5, zorder=8)\n    ax2.add_patch(cys_circle)\n    ax2.text(cx, cy, 'SG', ha='center', va='center', fontsize=9, fontweight='bold', zorder=9)\n    ax2.text(cx, cy + 0.65 if cy > 0 else cy - 0.65, cys, ha='center', va='center', fontsize=10, color='darkblue', fontweight='bold')\n    \n    # Draw bond line\n    ax2.plot([0, cx], [0, cy], 'k-', linewidth=2, zorder=5)\n    # Distance annotation\n    mid_x, mid_y = cx/2, cy/2\n    ax2.text(mid_x + 0.15, mid_y + 0.15, '2.33\u00c5', fontsize=8, color='green', fontweight='bold',\n             bbox=dict(boxstyle='round,pad=0.1', facecolor='white', alpha=0.8))\n\n# Motif labels\nax2.text(-1.5, 2.4, 'CPYC motif\\n(res 43-46)', ha='center', fontsize=9, color='darkred', style='italic')\nax2.text(1.5, -2.4, 'CKTC motif\\n(res 104-107)', ha='center', fontsize=9, color='darkred', style='italic')\n\n# Geometry annotation\nax2.text(0, -2.8, 'Mean SG-Zn-SG angle: 109.5\u00b0 \u00b1 2.6\u00b0\\n(ideal tetrahedral: 109.5\u00b0)', \n         ha='center', fontsize=9, color='green', fontweight='bold')\n\n# Panel C: Comparison table (C18orf21 vs RPP21)\nax3 = fig.add_subplot(gs[1, 1])\nax3.axis('off')\nax3.set_title('C. Zinc-Finger Comparison:\\nC18orf21/RMP24 vs RPP21', fontsize=12, fontweight='bold')\n\ntable_data = [\n    ['Feature', 'C18orf21/RMP24', 'RPP21'],\n    ['Complex', 'RNase MRP', 'RNase P'],\n    ['Zinc motif 1', 'CPYC (43-46)', 'CRGC (62-65)'],\n    ['Zinc motif 2', 'CKTC (104-107)', 'CLTC (92-95)'],\n    ['CxxC spacing', 'CxxC-x(57)-CxxC', 'CxxC-x(26)-CxxC'],\n    ['Coordination', 'Cys\u2084 (confirmed)', 'Cys\u2084 (by analogy)'],\n    ['Zn in PDB', 'Yes (9UH9)', 'Not standalone'],\n    ['Zn distances', '2.32-2.33 \u00c5', 'N/A'],\n    ['Geometry', 'Tetrahedral', 'Tetrahedral\u00b9'],\n    ['Sequence ID', '<15%', '\u2014'],\n    ['Foldseek E', '~10\u207b\u2074', '\u2014'],\n]\n\ncolors_table = [['#D4E6F1']*3]\nfor i in range(1, len(table_data)):\n    if i % 2 == 0:\n        colors_table.append(['#F2F3F4']*3)\n    else:\n        colors_table.append(['#FFFFFF']*3)\n\ntable = ax3.table(cellText=table_data, cellLoc='center', loc='center',\n                  cellColours=colors_table)\ntable.auto_set_font_size(False)\ntable.set_fontsize(9)\ntable.scale(1, 1.3)\nfor key, cell in table.get_celld().items():\n    if key[0] == 0:\n        cell.set_text_props(fontweight='bold')\n\nax3.text(0.5, -0.05, '\u00b9 Inferred from archaeal RPP21 NMR (PMID: 18922021)',\n         transform=ax3.transAxes, ha='center', fontsize=8, style='italic')\n\n# Panel D: Evidence summary\nax4 = fig.add_subplot(gs[2, :])\nax4.axis('off')\nax4.set_title('D. Key Evidence Summary for Fold Assignment', fontsize=13, fontweight='bold')\n\nevidence_text = \"\"\"\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  VERDICT: DUF4674 fold is ASSIGNABLE to RPP21/Rpr2 structural superfamily                           \u2502\n\u2502                                                                                                       \u2502\n\u2502  Foldseek vs PDB100:        No confident matches (best prob=35.3%) \u2192 fold appears \"novel\"             \u2502\n\u2502  Foldseek vs AlphaFold DB:  RPP21 clearly detected (E\u224810\u207b\u2074) \u2192 fold is RPP21-like                     \u2502\n\u2502  Experimental structure:    PDB 9UH9 (3.47\u00c5) \u2014 118/220 residues resolved in cryo-EM                  \u2502\n\u2502  Zinc coordination:         Cys\u2084 tetrahedral zinc (CYS43/46/104/107), distances 2.32-2.33\u00c5           \u2502\n\u2502  Shared with RPP21:         Zinc-binding CxxC-x(n)-CxxC motif, \u03b1-helical core, RNA binding           \u2502\n\u2502  Literature (2025-2026):    3 groups independently identified C18orf21=RMP24 (RNase MRP subunit)      \u2502\n\u2502                                                                                                       \u2502\n\u2502  GO CURATION LEADS:                                                                                   \u2502\n\u2502  MF: GO:0008270 (zinc ion binding) \u2014 direct structural evidence from PDB 9UH9                         \u2502\n\u2502  MF: GO:0003723 (RNA binding) \u2014 stabilizes RNase MRP catalytic RNA                                    \u2502\n\u2502  BP: GO:0006364 (rRNA processing) \u2014 required for pre-rRNA cleavage                                    \u2502\n\u2502  CC: GO:0000171 (ribonuclease MRP complex) \u2014 cryo-EM-confirmed subunit                                \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\"\"\"\n\nax4.text(0.02, 0.95, evidence_text, transform=ax4.transAxes, fontsize=9.5,\n         verticalalignment='top', fontfamily='monospace',\n         bbox=dict(boxstyle='round', facecolor='lightyellow', alpha=0.8, edgecolor='#DAA520'))\n\nplt.savefig('/tmp/c18orf21_comprehensive_analysis.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"Comprehensive figure saved!\")\n",
  "plot_number": 2
}