open this file

Reading File
Reading File
Here's a summary of the PDB file:

AF-A0A6F8Z204-F1-model_v6.pdb

File type: AlphaFold2 predicted protein structure (PDB format)

Protein Identity

FieldValue
Protein nameNADP-dependent oxidoreductase
UniProt IDA0A6F8Z204
OrganismStreptomyces violaceusniger (TaxID: 68280)
ChainA
Sequence length339 residues (positions 1-339)
Prediction dateJune 1, 2022
Model versionAlphaFold Monomer v2.0

Structure

  • Single polypeptide chain (Chain A)
  • Contains ATOM records for all heavy atoms with 3D coordinates (X, Y, Z)
  • The B-factor column encodes pLDDT confidence scores (per-residue confidence, 0-100):
    • Residues seen in the sample range from ~88 to ~97 pLDDT, indicating high to very high confidence
  • Standard PDB format with backbone and sidechain atoms for each residue

Biological Context

NADP-dependent oxidoreductases are enzymes that catalyze redox reactions using NADP+/NADPH as a cofactor. In Streptomyces violaceusniger (a soil-dwelling actinobacterium known for producing bioactive compounds), this enzyme likely plays a role in biosynthetic or metabolic redox pathways.

Citation

The structure was predicted by AlphaFold2 (Jumper et al., Nature 596, 583, 2021; PMID: 34265844), under a CC-BY 4.0 licence.

Would you like to do anything with this structure - such as analyze specific residues, extract the sequence, check secondary structure, or visualize it?

Generate 3D protein structure visualization (PyMOL/UCSF Chimera script)

Running Command

ls /home/daytona/workspace/ && python3 -c "import py3Dmol; print('py3Dmol ok')" 2>/dev/null || echo "py3Dmol not available"; python3 -c "from Bio import PDB; print('biopython ok')" 2>/dev/null || echo "biopython not available"

Running Command

python3 -c "import matplotlib; print('matplotlib', matplotlib.__version__)" 2>/dev/null; python3 -c "import numpy; print('numpy', numpy.__version__)" 2>/dev/null; python3 -c "import plotly; print('plotly', plotly.__version__)" 2>/dev/null || echo "plotly not available"

Running Command

mkdir -p /home/daytona/workspace/protein-viz

Writing File

~/protein-viz/visualize_pymol.pml

# ============================================================
# PyMOL Visualization Script
# Protein: NADP-dependent oxidoreductase (A0A6F8Z204)
# Organism: Streptomyces violaceusniger
# Model: AlphaFold2 Monomer v2.0
#
# Usage:
#   pymol visualize_pymol.pml
# Or open PyMOL and run: @visualize_pymol.pml
# ============================================================

# --- Load structure ---
load AF-A0A6F8Z204-F1-model_v6.pdb, oxidoreductase

# --- Basic setup ---
bg_color white
set ray_opaque_background, off

# --- Show as cartoon (secondary structure) ---
hide everything, oxidoreductase
show cartoon, oxidoreductase

# --- Color by pLDDT (stored in B-factor column) ---
# AlphaFold pLDDT coloring convention:
#   > 90  : Very high confidence  -> blue
#   70-90 : High confidence       -> cyan
#   50-70 : Low confidence        -> yellow
#   < 50  : Very low confidence   -> orange/red

spectrum b, blue_white_red, oxidoreductase, minimum=50, maximum=100

# --- Alternative: rainbow coloring along chain ---
# spectrum count, rainbow, oxidoreductase

# --- Surface representation (toggle off by default) ---
# show surface, oxidoreductase
# set transparency, 0.3, oxidoreductase

# --- Stick representation for ligand-binding residues (if known) ---
# Example: show sticks for residues near NADP binding site
# select nadp_site, resi 180-220
# show sticks, nadp_site

# --- Labels ---
set label_size, 14
set label_color, black

# --- Axes and orientation ---
orient oxidoreductase
zoom oxidoreductase

# --- Set cartoon style ---
set cartoon_fancy_helices, 1
set cartoon_flat_sheets, 1
set cartoon_smooth_loops, 1
set cartoon_highlight_color, grey70
set cartoon_dumbbell_length, 1.5
set cartoon_oval_length, 1.5

# --- Ambient occlusion for depth ---
set ambient, 0.4
set direct, 0.7
set reflect, 0.5
set shininess, 50

# --- Render settings ---
set ray_shadows, 1
set ray_trace_mode, 1     # photorealistic

# --- Save a ray-traced image ---
# ray 2400, 1800
# png AF-A0A6F8Z204_plddt.png, dpi=300

# ============================================================
# Additional useful selections
# ============================================================

# Select high-confidence residues (pLDDT > 90)
select high_conf, b > 90
# select low_conf, b < 70

# Show surface only for high-confidence region
# show surface, high_conf

# ============================================================
# To export a session:
#   save oxidoreductase_session.pse
# ============================================================

print "AlphaFold NADP-dependent oxidoreductase loaded."
print "Colored by pLDDT: blue=high confidence, red=low confidence."
print "Use 'spectrum b, rainbow, oxidoreductase' for rainbow mode."
Writing File

~/protein-viz/visualize_chimerax.cxc

# ============================================================
# UCSF ChimeraX Visualization Script
# Protein: NADP-dependent oxidoreductase (A0A6F8Z204)
# Organism: Streptomyces violaceusniger
# Model: AlphaFold2 Monomer v2.0
#
# Usage:
#   chimerax --script visualize_chimerax.cxc
# Or open ChimeraX and run: open visualize_chimerax.cxc
# ============================================================

# --- Load structure ---
open AF-A0A6F8Z204-F1-model_v6.pdb

# --- White background ---
set bgColor white

# --- Show cartoon (secondary structure ribbons) ---
hide atoms
show cartoons

# --- Color by pLDDT (B-factor) using AlphaFold convention ---
# Very high confidence (>90)  : cornflower blue  #0053D6
# High confidence (70-90)     : cyan             #65CBF3
# Low confidence (50-70)      : yellow           #FFDB13
# Very low confidence (<50)   : orange           #FF7D45

color bfactor #1 palette alphafold

# --- Alternative coloring options (uncomment to use) ---
# color bychain #1              # color each chain differently
# color byhetero #1             # highlight heteroatoms
# rainbow #1                    # rainbow N->C terminus
# color #1 byattribute bfactor palette blue:white:red range 50,100

# --- Lighting and visual quality ---
lighting soft
graphics silhouettes true

# --- Display secondary structure labels ---
# label #1/A residues text "{name}{number}" height 2 color black

# --- Surface representation ---
# surface #1
# transparency 50 surfaces

# --- Select and highlight binding-site region ---
# select #1/A:180-220
# color sel lime

# --- Zoom to fit ---
view

# --- Axes indicator ---
show #1 models

# ============================================================
# pLDDT confidence zone selections
# ============================================================

# High confidence residues
select #1 & @@bfactor>90
name sel highconf

# Low confidence residues  
select #1 & @@bfactor<70
name sel lowconf

# Clear selection
select clear

# ============================================================
# Save session / export image
# ============================================================

# Save session:
# save oxidoreductase_session.cxs

# Export high-res image:
# save AF-A0A6F8Z204_chimerax.png width 2400 height 1800 supersample 3

# ============================================================
# Useful ChimeraX commands reference:
#
# Rotate:     click + drag (left mouse)
# Zoom:       scroll wheel
# Clip:       right-click drag
# Measure:    distance #1/A:10@CA #1/A:50@CA
# H-bonds:    hbonds #1
# Contacts:   contacts #1
# ============================================================
Writing File

~/protein-viz/viewer_3dmol.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>NADP-dependent Oxidoreductase (A0A6F8Z204) - 3D Viewer</title>
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background: #0d1117;
      color: #e6edf3;
      height: 100vh;
      display: flex;
      flex-direction: column;
    }
    header {
      background: #161b22;
      border-bottom: 1px solid #30363d;
      padding: 12px 20px;
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
    }
    header h1 {
      font-size: 1rem;
      font-weight: 600;
      color: #58a6ff;
    }
    header .meta {
      font-size: 0.75rem;
      color: #8b949e;
    }
    .badge {
      background: #1f6feb;
      color: white;
      font-size: 0.7rem;
      padding: 2px 8px;
      border-radius: 12px;
      font-weight: 600;
    }
    .main {
      display: flex;
      flex: 1;
      overflow: hidden;
    }
    #viewer {
      flex: 1;
      position: relative;
    }
    .sidebar {
      width: 280px;
      background: #161b22;
      border-left: 1px solid #30363d;
      padding: 16px;
      overflow-y: auto;
      font-size: 0.82rem;
    }
    .sidebar h2 {
      font-size: 0.9rem;
      color: #58a6ff;
      margin-bottom: 12px;
      border-bottom: 1px solid #30363d;
      padding-bottom: 6px;
    }
    .ctrl-group { margin-bottom: 20px; }
    .ctrl-group label {
      display: block;
      color: #8b949e;
      font-size: 0.75rem;
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    .btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
    button {
      background: #21262d;
      border: 1px solid #30363d;
      color: #c9d1d9;
      padding: 5px 10px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 0.78rem;
      transition: background 0.15s;
    }
    button:hover { background: #30363d; color: #58a6ff; }
    button.active { background: #1f6feb; border-color: #1f6feb; color: white; }

    .plddt-legend { margin-top: 8px; }
    .plddt-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 5px;
      font-size: 0.75rem;
    }
    .plddt-swatch {
      width: 14px;
      height: 14px;
      border-radius: 3px;
      flex-shrink: 0;
    }

    .info-box {
      background: #0d1117;
      border: 1px solid #30363d;
      border-radius: 6px;
      padding: 10px;
      font-size: 0.75rem;
      line-height: 1.6;
      color: #8b949e;
    }
    .info-box span { color: #c9d1d9; }

    .load-area {
      margin-bottom: 14px;
    }
    .load-area input[type=file] {
      display: none;
    }
    .load-btn {
      width: 100%;
      text-align: center;
      padding: 8px;
      background: #21262d;
      border: 1px dashed #30363d;
      border-radius: 6px;
      cursor: pointer;
      color: #58a6ff;
    }
    .load-btn:hover { background: #161b22; }

    #status {
      position: absolute;
      bottom: 12px;
      left: 12px;
      background: rgba(22,27,34,0.85);
      border: 1px solid #30363d;
      border-radius: 6px;
      padding: 6px 12px;
      font-size: 0.75rem;
      color: #8b949e;
      pointer-events: none;
    }
  </style>
</head>
<body>

<header>
  <h1>NADP-dependent Oxidoreductase</h1>
  <span class="badge">AlphaFold2</span>
  <div class="meta">UniProt: A0A6F8Z204 &nbsp;|&nbsp; <i>Streptomyces violaceusniger</i> &nbsp;|&nbsp; 339 residues</div>
</header>

<div class="main">
  <div id="viewer"></div>

  <div class="sidebar">
    <h2>Load Structure</h2>
    <div class="load-area">
      <label class="load-btn" for="pdbfile">
        📂 Load PDB file
        <input type="file" id="pdbfile" accept=".pdb,.ent,.cif">
      </label>
      <p style="font-size:0.72rem;color:#8b949e;margin-top:6px;">
        Load <code>AF-A0A6F8Z204-F1-model_v6.pdb</code> from your computer.
      </p>
    </div>

    <h2>Representation</h2>
    <div class="ctrl-group">
      <label>Style</label>
      <div class="btn-row">
        <button id="btn-cartoon" class="active" onclick="setStyle('cartoon')">Cartoon</button>
        <button id="btn-stick" onclick="setStyle('stick')">Stick</button>
        <button id="btn-sphere" onclick="setStyle('sphere')">Sphere</button>
        <button id="btn-surface" onclick="setStyle('surface')">Surface</button>
        <button id="btn-line" onclick="setStyle('line')">Line</button>
      </div>
    </div>

    <div class="ctrl-group">
      <label>Color Scheme</label>
      <div class="btn-row">
        <button id="col-plddt" class="active" onclick="setColor('plddt')">pLDDT</button>
        <button id="col-rainbow" onclick="setColor('rainbow')">Rainbow</button>
        <button id="col-chain" onclick="setColor('chain')">Chain</button>
        <button id="col-ss" onclick="setColor('ss')">Sec. Struct.</button>
      </div>
    </div>

    <div class="ctrl-group">
      <label>Background</label>
      <div class="btn-row">
        <button onclick="setBg('black')" id="bg-black" class="active">Black</button>
        <button onclick="setBg('white')" id="bg-white">White</button>
        <button onclick="setBg('0x1a1a2e')" id="bg-navy">Navy</button>
      </div>
    </div>

    <div class="ctrl-group">
      <label>Actions</label>
      <div class="btn-row">
        <button onclick="viewer.rotate(1,{x:0,y:1,z:0}, 500)">Spin</button>
        <button onclick="viewer.zoomTo()">Reset View</button>
        <button onclick="viewer.zoom(1.3)">Zoom +</button>
        <button onclick="viewer.zoom(0.7)">Zoom -</button>
      </div>
    </div>

    <h2>pLDDT Legend</h2>
    <div class="plddt-legend">
      <div class="plddt-bar">
        <div class="plddt-swatch" style="background:#0053D6"></div>
        <span>&gt;90 — Very high confidence</span>
      </div>
      <div class="plddt-bar">
        <div class="plddt-swatch" style="background:#65CBF3"></div>
        <span>70-90 — High confidence</span>
      </div>
      <div class="plddt-bar">
        <div class="plddt-swatch" style="background:#FFDB13"></div>
        <span>50-70 — Low confidence</span>
      </div>
      <div class="plddt-bar">
        <div class="plddt-swatch" style="background:#FF7D45"></div>
        <span>&lt;50 — Very low confidence</span>
      </div>
    </div>
    <p style="font-size:0.7rem;color:#8b949e;margin-top:6px;">
      pLDDT is stored in the B-factor column of the PDB file.
    </p>

    <h2 style="margin-top:16px;">Protein Info</h2>
    <div class="info-box">
      <b>Name:</b> <span>NADP-dependent oxidoreductase</span><br>
      <b>UniProt:</b> <span>A0A6F8Z204</span><br>
      <b>Organism:</b> <span><i>S. violaceusniger</i></span><br>
      <b>Length:</b> <span>339 aa</span><br>
      <b>Model:</b> <span>AlphaFold2 v2.0</span><br>
      <b>Date:</b> <span>June 2022</span>
    </div>
  </div>
</div>

<div id="status">Load the PDB file using the sidebar to begin.</div>

<!-- 3Dmol.js from CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/3Dmol/2.1.0/3Dmol-min.js"></script>

<script>
  let viewer = null;
  let currentModel = null;
  let currentStyle = 'cartoon';
  let currentColor = 'plddt';
  let currentBg = 'black';

  // Initialize viewer
  viewer = $3Dmol.createViewer('viewer', {
    backgroundColor: 'black',
    antialias: true,
    id: 'mainviewer'
  });

  // File loader
  document.getElementById('pdbfile').addEventListener('change', function(e) {
    const file = e.target.files[0];
    if (!file) return;
    const reader = new FileReader();
    reader.onload = function(evt) {
      const pdbData = evt.target.result;
      viewer.removeAllModels();
      currentModel = viewer.addModel(pdbData, 'pdb');
      applyStyle();
      viewer.zoomTo();
      viewer.render();
      document.getElementById('status').textContent =
        'Loaded: ' + file.name + '  |  Drag to rotate  |  Scroll to zoom  |  Right-click to pan';
    };
    reader.readAsText(file);
  });

  function applyStyle() {
    if (!currentModel) return;
    viewer.setStyle({}, {});

    const colorSpec = getColorSpec();

    if (currentStyle === 'cartoon') {
      viewer.setStyle({}, { cartoon: colorSpec });
    } else if (currentStyle === 'stick') {
      viewer.setStyle({}, { stick: colorSpec });
    } else if (currentStyle === 'sphere') {
      viewer.setStyle({}, { sphere: colorSpec });
    } else if (currentStyle === 'line') {
      viewer.setStyle({}, { line: colorSpec });
    } else if (currentStyle === 'surface') {
      viewer.setStyle({}, { cartoon: { color: 'grey', opacity: 0.2 } });
      viewer.addSurface($3Dmol.SurfaceType.VDW, {
        opacity: 0.75,
        colorscheme: colorSpec.colorscheme || { prop: 'b', gradient: 'rwb', min: 50, max: 100 }
      });
    }
    viewer.render();
  }

  function getColorSpec() {
    if (currentColor === 'plddt') {
      // AlphaFold pLDDT uses B-factor; custom gradient
      return {
        colorscheme: { prop: 'b', gradient: 'rwb', min: 50, max: 100 }
      };
    } else if (currentColor === 'rainbow') {
      return { colorscheme: 'spectrum' };
    } else if (currentColor === 'chain') {
      return { colorscheme: 'chain' };
    } else if (currentColor === 'ss') {
      return { colorscheme: 'ssJmol' };
    }
    return {};
  }

  function setStyle(style) {
    currentStyle = style;
    // Update button states
    ['cartoon','stick','sphere','surface','line'].forEach(s => {
      const btn = document.getElementById('btn-' + s);
      if (btn) btn.classList.toggle('active', s === style);
    });
    viewer.removeAllSurfaces();
    applyStyle();
  }

  function setColor(color) {
    currentColor = color;
    ['plddt','rainbow','chain','ss'].forEach(c => {
      const btn = document.getElementById('col-' + c);
      if (btn) btn.classList.toggle('active', c === color);
    });
    viewer.removeAllSurfaces();
    applyStyle();
  }

  function setBg(color) {
    currentBg = color;
    viewer.setBackgroundColor(color);
    viewer.render();
  }

  // Auto-spin toggle
  let spinning = false;
  let spinInterval = null;
</script>

</body>
</html>
Writing File

~/protein-viz/visualize_matplotlib.py

"""
Static 3D protein structure visualization using matplotlib.
Parses Cα atoms from PDB, colors by pLDDT (B-factor), and renders
a 3D Cα trace with secondary structure coloring.

Usage:
    python3 visualize_matplotlib.py

Output:
    AF-A0A6F8Z204_structure.png  (high-res static image)
    AF-A0A6F8Z204_plddt.png      (pLDDT per-residue plot)
"""

import sys
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as mcolors
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Line3DCollection
from matplotlib.lines import Line2D

PDB_PATH = "/home/daytona/workspace/attachments/3c5fbf8d-933d-40d7-95f6-1ad169816800/AF-A0A6F8Z204-F1-model_v6.pdb"
OUT_DIR  = "/home/daytona/workspace/protein-viz"

# ── 1. Parse Cα atoms ────────────────────────────────────────────────────────

def parse_ca_atoms(pdb_path):
    residues, coords, plddt = [], [], []
    with open(pdb_path) as f:
        for line in f:
            if line.startswith("ATOM") and line[12:16].strip() == "CA":
                res_num = int(line[22:26].strip())
                x = float(line[30:38])
                y = float(line[38:46])
                z = float(line[46:54])
                b  = float(line[60:66])
                residues.append(res_num)
                coords.append([x, y, z])
                plddt.append(b)
    return (np.array(residues),
            np.array(coords),
            np.array(plddt))

residue_ids, ca_coords, plddt_vals = parse_ca_atoms(PDB_PATH)
n = len(ca_coords)
print(f"Parsed {n} Cα atoms  |  pLDDT mean={plddt_vals.mean():.1f}  min={plddt_vals.min():.1f}  max={plddt_vals.max():.1f}")

# ── 2. AlphaFold pLDDT colormap ──────────────────────────────────────────────

def plddt_color(val):
    """Return RGBA color following AlphaFold convention."""
    if val >= 90:
        return np.array([0, 83, 214, 255]) / 255      # blue
    elif val >= 70:
        return np.array([101, 203, 243, 255]) / 255    # cyan
    elif val >= 50:
        return np.array([255, 219, 19, 255]) / 255     # yellow
    else:
        return np.array([255, 125, 69, 255]) / 255     # orange

colors = np.array([plddt_color(v) for v in plddt_vals])

# ── 3. Build 3D Cα trace (colored line segments) ─────────────────────────────

def make_segments(coords):
    """Create (n-1, 2, 3) array of line segments for Line3DCollection."""
    pts = coords.reshape(-1, 1, 3)
    segs = np.concatenate([pts[:-1], pts[1:]], axis=1)
    return segs

segments = make_segments(ca_coords)
seg_colors = [(colors[i] + colors[i+1]) / 2 for i in range(n-1)]

# ── 4. Main structure plot ────────────────────────────────────────────────────

fig = plt.figure(figsize=(14, 10), facecolor='#0d1117')
ax  = fig.add_subplot(111, projection='3d', facecolor='#0d1117')

# Draw tube-like trace with varying line width by adding multiple thicknesses
lc = Line3DCollection(segments, colors=seg_colors, linewidths=2.5, alpha=0.95)
ax.add_collection3d(lc)

# Scatter Cα atoms colored by pLDDT
sc = ax.scatter(ca_coords[:,0], ca_coords[:,1], ca_coords[:,2],
                c=plddt_vals, cmap='cool_r', s=8,
                vmin=50, vmax=100, alpha=0.7, depthshade=True, zorder=5)

# Mark N-terminus (start) and C-terminus (end)
ax.scatter(*ca_coords[0],  c='lime',  s=120, marker='^', zorder=10, label='N-terminus')
ax.scatter(*ca_coords[-1], c='red',   s=120, marker='v', zorder=10, label='C-terminus')

# Axis styling
for pane in [ax.xaxis.pane, ax.yaxis.pane, ax.zaxis.pane]:
    pane.fill = False
    pane.set_edgecolor('#30363d')
ax.tick_params(colors='#555', labelsize=7)
ax.xaxis.label.set_color('#555')
ax.yaxis.label.set_color('#555')
ax.zaxis.label.set_color('#555')
ax.set_xlabel('X (Å)', color='#555', fontsize=8)
ax.set_ylabel('Y (Å)', color='#555', fontsize=8)
ax.set_zlabel('Z (Å)', color='#555', fontsize=8)
[line.set_color('#30363d') for line in ax.xaxis.get_gridlines()]
[line.set_color('#30363d') for line in ax.yaxis.get_gridlines()]
[line.set_color('#30363d') for line in ax.zaxis.get_gridlines()]

# Title
fig.text(0.5, 0.97, 'NADP-dependent Oxidoreductase (A0A6F8Z204)',
         ha='center', va='top', color='#58a6ff', fontsize=13, fontweight='bold')
fig.text(0.5, 0.935, 'Streptomyces violaceusniger  |  AlphaFold2 Monomer v2.0  |  339 residues',
         ha='center', va='top', color='#8b949e', fontsize=9)

# pLDDT legend (manual patches)
legend_elements = [
    Line2D([0],[0], color=np.array([0,83,214])/255,    lw=4, label='>90 Very high'),
    Line2D([0],[0], color=np.array([101,203,243])/255, lw=4, label='70-90 High'),
    Line2D([0],[0], color=np.array([255,219,19])/255,  lw=4, label='50-70 Low'),
    Line2D([0],[0], color=np.array([255,125,69])/255,  lw=4, label='<50 Very low'),
    Line2D([0],[0], marker='^', color='w', markerfacecolor='lime', markersize=10, label='N-terminus', lw=0),
    Line2D([0],[0], marker='v', color='w', markerfacecolor='red',  markersize=10, label='C-terminus', lw=0),
]
leg = ax.legend(handles=legend_elements, loc='upper left',
                framealpha=0.3, facecolor='#161b22',
                edgecolor='#30363d', labelcolor='#c9d1d9',
                fontsize=8, title='pLDDT Confidence',
                title_fontsize=8)
leg.get_title().set_color('#8b949e')

ax.set_box_aspect([1,1,1])
ax.view_init(elev=20, azim=45)

out1 = os.path.join(OUT_DIR, 'AF-A0A6F8Z204_structure.png')
plt.savefig(out1, dpi=200, bbox_inches='tight', facecolor=fig.get_facecolor())
print(f"Saved: {out1}")
plt.close()

# ── 5. pLDDT per-residue confidence plot ─────────────────────────────────────

fig2, ax2 = plt.subplots(figsize=(14, 4), facecolor='#0d1117')
ax2.set_facecolor('#0d1117')

# Filled area with color banding
for threshold, color, alpha in [(100, '#0053D6', 0.3), (90, '#65CBF3', 0.3),
                                  (70, '#FFDB13', 0.3), (50, '#FF7D45', 0.3)]:
    ax2.axhspan(threshold-10 if threshold > 50 else 0, threshold, color=color, alpha=0.08)

ax2.axhline(90, color='#0053D6', lw=0.7, ls='--', alpha=0.6)
ax2.axhline(70, color='#65CBF3', lw=0.7, ls='--', alpha=0.6)
ax2.axhline(50, color='#FFDB13', lw=0.7, ls='--', alpha=0.6)

# Color each point by pLDDT zone
bar_colors = [plddt_color(v) for v in plddt_vals]
ax2.bar(residue_ids, plddt_vals, color=bar_colors, width=1.0, alpha=0.9)

# Running average
window = 10
running_avg = np.convolve(plddt_vals, np.ones(window)/window, mode='same')
ax2.plot(residue_ids, running_avg, color='white', lw=1.2, alpha=0.6, label=f'{window}-res moving avg')

ax2.set_xlim(residue_ids[0]-1, residue_ids[-1]+1)
ax2.set_ylim(0, 105)
ax2.set_xlabel('Residue number', color='#8b949e', fontsize=10)
ax2.set_ylabel('pLDDT score', color='#8b949e', fontsize=10)
ax2.set_title('Per-residue pLDDT Confidence — A0A6F8Z204  (AlphaFold2)',
              color='#58a6ff', fontsize=12, fontweight='bold')
ax2.tick_params(colors='#8b949e', labelsize=8)
for spine in ax2.spines.values():
    spine.set_edgecolor('#30363d')
ax2.yaxis.set_tick_params(labelcolor='#8b949e')
ax2.xaxis.set_tick_params(labelcolor='#8b949e')
ax2.legend(fontsize=8, facecolor='#161b22', edgecolor='#30363d', labelcolor='#c9d1d9')

# Add zone labels on right
for label, y, color in [('Very high >90', 95, '#0053D6'),
                          ('High 70-90', 80,   '#65CBF3'),
                          ('Low 50-70', 60,    '#FFDB13'),
                          ('Very low <50', 35, '#FF7D45')]:
    ax2.text(residue_ids[-1]+2, y, label, color=color, fontsize=7, va='center')

plt.tight_layout()
out2 = os.path.join(OUT_DIR, 'AF-A0A6F8Z204_plddt.png')
plt.savefig(out2, dpi=200, bbox_inches='tight', facecolor=fig2.get_facecolor())
print(f"Saved: {out2}")
plt.close()

print("\nDone! Generated:")
print(f"  {out1}")
print(f"  {out2}")
Running Command

cd /home/daytona/workspace/protein-viz && python3 visualize_matplotlib.py

Reading File
Everything generated successfully. Here's what was created:

Generated Files

Static Images (rendered now, no software needed)

  • AF A0A6F8Z204 structure

    Image · PNG

    - 3D backbone trace colored by pLDDT
  • AF A0A6F8Z204 plddt

    Image · PNG

    - Per-residue confidence bar chart

Interactive Viewer (open in browser)

  • viewer 3dmol

    HTML File · HTML

    - Full interactive 3D viewer using 3Dmol.js (CDN-based, works offline for local files)
    • Load the PDB from the sidebar
    • Switch between Cartoon / Stick / Sphere / Surface / Line styles
    • Switch between pLDDT / Rainbow / Chain / Secondary Structure coloring
    • Rotate, zoom, pan with mouse

Visualization Scripts

FileToolUsage

visualize pymol

PML File · PML

PyMOLpymol visualize_pymol.pml

visualize chimerax

CXC File · CXC

UCSF ChimeraXchimerax --script visualize_chimerax.cxc

visualize matplotlib

Python File · PY

Python/matplotlibpython3 visualize_matplotlib.py

Key Stats from the PDB

MetricValue
Cα atoms parsed339
Mean pLDDT96.3 (very high confidence overall)
Min pLDDT50.1
Max pLDDT98.9
A mean pLDDT of 96.3 is excellent - almost the entire structure is predicted with very high confidence (>90), which is typical for compact enzyme domains. The few lower-confidence residues (near 50) are likely flexible loops.
For the HTML viewer: Copy viewer_3dmol.html to the same folder as the PDB file, open it in Chrome/Firefox, and use the "Load PDB file" button in the sidebar.
This is a shared conversation. Sign in to Orris to start your own chat.