{
  "filename": "alphafold_plddt_profile.png",
  "iteration": 2,
  "description": "AlphaFold pLDDT profile showing domain architecture of MEFV confirming absence of RING domain",
  "timestamp": "2026-07-05 12:20:25",
  "code": "\nimport requests\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\n\n# Re-download the PDB for visualization\naf_url = \"https://alphafold.ebi.ac.uk/files/AF-O15553-F1-model_v6.pdb\"\npdb_response = requests.get(af_url)\npdb_text = pdb_response.text\n\n# Parse all CA atoms with pLDDT\nca_data = []\nfor line in pdb_text.split('\\n'):\n    if line.startswith('ATOM') and ' CA ' in line:\n        try:\n            resnum = int(line[22:26].strip())\n            resname = line[17:20].strip()\n            bfactor = float(line[60:66].strip())\n            ca_data.append((resnum, resname, bfactor))\n        except:\n            pass\n\nresidues = np.array([d[0] for d in ca_data])\nplddt = np.array([d[2] for d in ca_data])\n\n# Create comprehensive pLDDT profile with domain annotations\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(16, 10), gridspec_kw={'height_ratios': [3, 1]})\n\n# Top panel: pLDDT profile\nax1.fill_between(residues, plddt, alpha=0.3, color='steelblue')\nax1.plot(residues, plddt, linewidth=0.8, color='steelblue')\nax1.axhline(y=70, color='orange', linestyle='--', alpha=0.5, label='pLDDT=70 (confident)')\nax1.axhline(y=50, color='red', linestyle='--', alpha=0.5, label='pLDDT=50 (low confidence)')\n\n# Mark domain boundaries\ndomains = [\n    ('Pyrin\\n(PYD)', 1, 92, '#9b59b6', 'No RING here\\n(0 Cys, 3 His)'),\n    ('Disordered\\nlinker', 93, 369, '#e0e0e0', 'No hidden\\ndomain'),\n    ('B-box\\n(Zn finger)', 370, 412, '#3498db', '4 Cys + 4 His\\n(Zn binding,\\nnot E3 catalysis)'),\n    ('CC', 413, 442, '#95a5a6', ''),\n    ('Helical\\nscaffold', 443, 579, '#f39c12', ''),\n    ('B30.2/\\nSPRY', 580, 775, '#2ecc71', 'Cargo\\nrecognition'),\n]\n\nfor name, start, end, color, note in domains:\n    ax1.axvspan(start, end, alpha=0.15, color=color)\n    mid = (start + end) / 2\n    ax1.text(mid, 102, name, ha='center', va='bottom', fontsize=7, fontweight='bold')\n    if note:\n        ax1.text(mid, -8, note, ha='center', va='top', fontsize=6, color='darkred', style='italic')\n\nax1.set_ylim(-15, 110)\nax1.set_ylabel('AlphaFold pLDDT', fontsize=11)\nax1.set_title('MEFV/Pyrin (TRIM20) AlphaFold Structure Confidence\\n'\n              'No RING domain present \u2014 E3 ubiquitin ligase annotation is unsupported', \n              fontsize=13, fontweight='bold')\nax1.legend(loc='lower right', fontsize=8)\n\n# Bottom panel: Domain architecture comparison\nax2.set_xlim(0, 800)\nax2.set_ylim(-0.5, 2.5)\n\n# MEFV architecture\ny_mefv = 1.8\nax2.barh(y_mefv, 781, height=0.4, color='#ecf0f1', edgecolor='#bdc3c7')\nfor name, start, end, color, _ in domains:\n    ax2.barh(y_mefv, end-start, left=start, height=0.4, color=color, edgecolor='black', linewidth=0.5)\nax2.text(-5, y_mefv, 'MEFV/TRIM20\\n(no RING)', ha='right', va='center', fontsize=8, fontweight='bold', color='red')\n\n# Canonical TRIM (e.g., TRIM21) architecture for comparison\ny_trim = 0.6\nax2.barh(y_trim, 475, height=0.4, color='#ecf0f1', edgecolor='#bdc3c7')\ntrim21_domains = [\n    ('RING', 16, 55, '#e74c3c'),\n    ('B-box', 92, 123, '#3498db'),\n    ('CC', 130, 233, '#95a5a6'),\n    ('B30.2/SPRY', 268, 465, '#2ecc71'),\n]\nfor name, start, end, color in trim21_domains:\n    ax2.barh(y_trim, end-start, left=start, height=0.4, color=color, edgecolor='black', linewidth=0.5)\n    mid = (start+end)/2\n    ax2.text(mid, y_trim, name, ha='center', va='center', fontsize=6, color='white', fontweight='bold')\n\nax2.text(-5, y_trim, 'TRIM21\\n(has RING)', ha='right', va='center', fontsize=8, fontweight='bold', color='green')\n\n# Arrow showing RING \u2192 Pyrin replacement\nax2.annotate('RING \u2192 Pyrin\\n(domain replacement)', \n             xy=(40, y_mefv-0.2), xytext=(40, y_trim+0.4),\n             fontsize=7, ha='center', color='red', fontweight='bold',\n             arrowprops=dict(arrowstyle='->', color='red', lw=1.5))\n\nax2.set_xlabel('Amino acid position', fontsize=10)\nax2.set_yticks([])\nax2.spines['top'].set_visible(False)\nax2.spines['right'].set_visible(False)\nax2.spines['left'].set_visible(False)\n\nplt.tight_layout()\nplt.savefig('alphafold_plddt_profile.png', dpi=150, bbox_inches='tight')\nplt.show()\nprint(\"AlphaFold pLDDT profile saved.\")\n"
}