{
  "filename": "dnajc28_structural_analysis.png",
  "iteration": 2,
  "description": "Creating definitive figure showing structural superposition per-residue distances and pLDDT profile for DNAJC28",
  "timestamp": "2026-06-22 05:06:20",
  "code": "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Per-residue distances from the superposition analysis\nresidues_c28 = list(range(51, 114))  # 63 residues\nper_res_distances = [\n    2.01, 2.12, 1.87, 1.49, 1.54, 1.61, 1.28, 1.57, 1.73, 2.06, 2.31, 1.66,\n    1.86, 2.60, 2.51, 1.66, 1.87, 2.23, 1.87, 1.34, 1.56, 1.68, 1.38, 1.24, \n    1.17, 1.19, 1.24, 1.28, 1.96, 0.93, 2.60, 3.89, 5.90, 7.78, 7.37, 5.22,\n    5.77, 5.56, 7.09, 6.24, 4.35, 5.16, 6.80, 6.43, 4.60, 4.94, 7.25, 6.92,\n    4.40, 5.37, 8.62, 8.23, 5.76, 4.59, 4.76, 3.04, 4.01, 4.51, 8.39, 9.73,\n    11.09, 12.44, 17.37\n]\n\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(14, 10))\n\n# Panel 1: Per-residue CA distances after superposition\ncolors = []\nfor i, res in enumerate(residues_c28):\n    if 51 <= res <= 54:\n        colors.append('#90CAF9')  # Helix I - light blue\n    elif 55 <= res <= 62:\n        colors.append('#BDBDBD')  # Loop I-II - gray\n    elif 63 <= res <= 76:\n        colors.append('#4CAF50')  # Helix II - green\n    elif 77 <= res <= 78:\n        colors.append('#FFEB3B')  # HPD loop pre\n    elif 79 <= res <= 81:\n        colors.append('#F44336')  # HPD\n    elif 82 <= res <= 87:\n        colors.append('#FFEB3B')  # HPD loop post\n    elif 88 <= res <= 107:\n        colors.append('#2196F3')  # Helix III\n    else:\n        colors.append('#9E9E9E')  # C-terminal\n\nax1.bar(residues_c28, per_res_distances, color=colors, edgecolor='none', width=0.8)\nax1.axhline(y=2.0, color='green', linestyle='--', alpha=0.7, label='2.0 \u00c5 threshold')\nax1.axhline(y=5.0, color='orange', linestyle='--', alpha=0.7, label='5.0 \u00c5 threshold')\n\n# Add region labels\nax1.annotate('Helix I', xy=(52, 14), fontsize=9, ha='center', color='#1565C0')\nax1.annotate('Loop\\nI-II', xy=(58, 14), fontsize=8, ha='center', color='gray')\nax1.annotate('Helix II\\nRMSD=1.78 \u00c5', xy=(69, 14), fontsize=10, ha='center', color='#2E7D32', fontweight='bold')\nax1.annotate('HPD\\n1.95 \u00c5', xy=(80, 14), fontsize=9, ha='center', color='#B71C1C', fontweight='bold')\nax1.annotate('HPD loop', xy=(84, 14), fontsize=8, ha='center', color='#F57F17')\nax1.annotate('Helix III/IV\\nRMSD=5.88 \u00c5', xy=(97, 14), fontsize=10, ha='center', color='#1565C0', fontweight='bold')\n\nax1.set_xlabel('DNAJC28 Residue Number', fontsize=12)\nax1.set_ylabel('CA Distance After\\nSuperposition (\u00c5)', fontsize=12)\nax1.set_title('Structural Superposition: DNAJC28 vs DNAJA1 J-domain (AlphaFold)', fontsize=14, fontweight='bold')\nax1.legend(loc='upper left', fontsize=9)\nax1.set_xlim(49, 115)\nax1.set_ylim(0, 18)\n\n# Add interpretation box\ntextstr = 'Helix II + HPD: <2 \u00c5 RMSD\\n(Hsp70 interaction surface conserved)'\nprops = dict(boxstyle='round', facecolor='#E8F5E9', edgecolor='#4CAF50', alpha=0.9)\nax1.text(0.72, 0.85, textstr, transform=ax1.transAxes, fontsize=11,\n        verticalalignment='top', bbox=props, fontweight='bold')\n\n# Panel 2: pLDDT profile with domain color coding\nimport requests\n\npdb_text = requests.get(\"https://alphafold.ebi.ac.uk/files/AF-Q9NX36-F1-model_v6.pdb\").text\nall_res = []\nall_plddt = []\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        all_res.append(res_num)\n        all_plddt.append(bfactor)\n\n# Color by domain\nbar_colors = []\nfor r in all_res:\n    if 45 <= r <= 54:\n        bar_colors.append('#90CAF9')\n    elif 55 <= r <= 62:\n        bar_colors.append('#BDBDBD')\n    elif 63 <= r <= 76:\n        bar_colors.append('#4CAF50')\n    elif 77 <= r <= 87:\n        bar_colors.append('#FFEB3B')\n    elif 79 <= r <= 81:\n        bar_colors.append('#F44336')\n    elif 88 <= r <= 115:\n        bar_colors.append('#2196F3')\n    elif 203 <= r <= 271:\n        bar_colors.append('#9C27B0')\n    else:\n        bar_colors.append('#E0E0E0')\n\nax2.bar(all_res, all_plddt, color=bar_colors, width=1.0, edgecolor='none')\nax2.axhline(y=90, color='green', linestyle='--', alpha=0.4, linewidth=0.8)\nax2.axhline(y=70, color='orange', linestyle='--', alpha=0.4, linewidth=0.8)\nax2.axhline(y=50, color='red', linestyle='--', alpha=0.4, linewidth=0.8)\n\n# Domain annotations\nax2.annotate('J-domain\\n(51-115)\\npLDDT=87.3', xy=(83, 95), fontsize=10, ha='center', \n            fontweight='bold', color='#2E7D32',\n            bbox=dict(boxstyle='round,pad=0.3', facecolor='white', alpha=0.8, edgecolor='#4CAF50'))\nax2.annotate('DJC28_CD\\n(203-271)\\npLDDT=87.0', xy=(237, 95), fontsize=10, ha='center',\n            fontweight='bold', color='#6A1B9A',\n            bbox=dict(boxstyle='round,pad=0.3', facecolor='white', alpha=0.8, edgecolor='#9C27B0'))\n\nax2.set_xlabel('Residue Number', fontsize=12)\nax2.set_ylabel('AlphaFold pLDDT', fontsize=12)\nax2.set_title('DNAJC28 AlphaFold Confidence Profile with Domain Architecture', fontsize=14, fontweight='bold')\nax2.set_xlim(0, 390)\nax2.set_ylim(20, 100)\n\nplt.tight_layout()\nplt.savefig('dnajc28_structural_analysis.png', dpi=150, bbox_inches='tight')\nprint(\"Final figure saved: dnajc28_structural_analysis.png\")\n"
}