{
  "filename": "dnajc28_plddt_profile.png",
  "iteration": 1,
  "description": "Creating pLDDT confidence profile visualization for DNAJC28 with J-domain secondary structure annotations",
  "timestamp": "2026-06-22 04:46:05",
  "code": "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport requests\n\n# Get AlphaFold pLDDT for the full protein\npdb_url = \"https://alphafold.ebi.ac.uk/files/AF-Q9NX36-F1-model_v6.pdb\"\npdb_text = requests.get(pdb_url).text\n\n# Parse CA B-factors (pLDDT)\nresidues = []\nplddts = []\nfor line in pdb_text.split('\\n'):\n    if line.startswith('ATOM') and line[12:16].strip() == 'CA':\n        res_num = int(line[22:26].strip())\n        bfactor = float(line[60:66])\n        residues.append(res_num)\n        plddts.append(bfactor)\n\nresidues = np.array(residues)\nplddts = np.array(plddts)\n\n# Create figure with two panels\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(14, 10))\n\n# Panel 1: Full protein pLDDT profile\nax1.plot(residues, plddts, 'b-', linewidth=1.5, alpha=0.8)\nax1.axhline(y=90, color='green', linestyle='--', alpha=0.5, label='Very high (>90)')\nax1.axhline(y=70, color='orange', linestyle='--', alpha=0.5, label='Confident (>70)')\nax1.axhline(y=50, color='red', linestyle='--', alpha=0.5, label='Low (>50)')\n\n# Highlight J-domain\nax1.axvspan(51, 115, alpha=0.2, color='green', label='J-domain (51-115)')\nax1.axvspan(79, 81, alpha=0.4, color='red', label='HPD motif (79-81)')\n\nax1.set_xlabel('Residue Number', fontsize=12)\nax1.set_ylabel('pLDDT Score', fontsize=12)\nax1.set_title('DNAJC28 (Q9NX36) AlphaFold pLDDT Confidence Profile', fontsize=14)\nax1.legend(loc='lower right', fontsize=9)\nax1.set_xlim(1, 388)\nax1.set_ylim(20, 100)\n\n# Panel 2: J-domain detail with secondary structure annotation\njd_mask = (residues >= 40) & (residues <= 125)\njd_res = residues[jd_mask]\njd_plddt = plddts[jd_mask]\n\nax2.bar(jd_res, jd_plddt, width=0.8, color='steelblue', alpha=0.7)\n\n# Annotate helices\nhelix_regions = [(45, 54, 'Helix I', 'lightblue'), \n                 (63, 76, 'Helix II', 'cornflowerblue'), \n                 (88, 115, 'Helix III/IV', 'royalblue')]\nfor start, end, name, color in helix_regions:\n    ax2.axvspan(start, end, alpha=0.2, color=color)\n    ax2.text((start+end)/2, 98, name, ha='center', fontsize=10, fontweight='bold')\n\n# Annotate HPD\nax2.axvspan(79, 81, alpha=0.3, color='red')\nax2.annotate('HPD', xy=(80, plddts[residues==80][0]), xytext=(80, 100),\n            ha='center', fontsize=11, fontweight='bold', color='red',\n            arrowprops=dict(arrowstyle='->', color='red'))\n\n# Annotate loops\nax2.text(58, 45, 'Loop\\nI-II', ha='center', fontsize=9, color='gray')\nax2.text(83, 45, 'HPD\\nLoop', ha='center', fontsize=9, color='gray')\n\nax2.axhline(y=90, color='green', linestyle='--', alpha=0.5)\nax2.axhline(y=70, color='orange', linestyle='--', alpha=0.5)\nax2.set_xlabel('Residue Number', fontsize=12)\nax2.set_ylabel('pLDDT Score', fontsize=12)\nax2.set_title('DNAJC28 J-domain Region: Secondary Structure & Confidence', fontsize=14)\nax2.set_xlim(40, 125)\nax2.set_ylim(40, 105)\n\nplt.tight_layout()\nplt.savefig('dnajc28_plddt_profile.png', dpi=150, bbox_inches='tight')\nprint(\"Plot saved: dnajc28_plddt_profile.png\")\n"
}