Chapter 2: Molecular Visualization with PyMOL & ChimeraX
Tested Stacks:
GATK 4.6.1
Samtools 1.21
Nextflow 24.10
Seurat v5.1
Python 3.12
Prerequisites: Basic Linux CLI & Sequencing Formats
📚 Chapter 2 of 13
0% Course Completed
Chapter 2: Molecular Visualization with PyMOL & ChimeraX
Visualizing 3D structures is vital for analyzing catalytic active sites, protein-ligand interactions, mutations, and conformational changes. PyMOL and UCSF ChimeraX are the standard visualization and rendering engines used across structural biology.
PyMOL Scripting Philosophy
Never rely solely on mouse clicks for publication figures. Writing reproducible PyMOL command scripts (.pml) guarantees consistent camera angles, color palettes, and surface representations across structures.
1. Production PyMOL Scripting (pml)
# save as render_complex.pml and run via: pymol -c render_complex.pml
reinitialize
# Fetch crystal structure of SARS-CoV-2 main protease bound to nirmatrelvir (PDB: 7VH8)
fetch 7vh8, type=mmtf, async=0
# Clean display
hide everything
bg_color white
set ray_shadows, 0
set antialias, 2
# Show protein cartoon
show cartoon, chain A
color grey85, chain A
# Highlight catalytic dyad residues: Cys145 and His41
select catalytic_dyad, (chain A and resi 41+145)
show sticks, catalytic_dyad
color firebrick, catalytic_dyad
# Show small molecule inhibitor (organic)
select inhibitor, org
show sticks, inhibitor
set stick_radius, 0.25, inhibitor
color marine, inhibitor and elem C
# Find hydrogen bonds between inhibitor and protein active site
distance hbonds, inhibitor, (chain A and not elem C), 3.2, mode=2
color dash, yellow
# Set camera and ray-trace high-resolution figure
orient inhibitor
zoom inhibitor, 6
ray 2400, 1800
png binding_pocket_hires.png, dpi=3002. UCSF ChimeraX for Cryo-EM & Large Complexes
UCSF ChimeraX provides next-generation GPU rendering, interactive ambient occlusion lighting, and native tools to fit atomic models into cryo-EM electron density volumes.
# ChimeraX command line
open 6zsl
open 11145 from emdb
volume #2 style surface level 0.035 color #80b3ff transparency 0.5
fitmap #1 inMap #2
⚠️
Common Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.