Complete Guide from Installation to Creating High-Quality Molecular Images
PyMOL is a powerful molecular visualization system used to create high-quality 3D molecular structure images and animations. This tutorial will guide you through the installation and basic usage of PyMOL.
PyMOL has both open-source and commercial versions. This tutorial mainly covers the open-source version.
# Install using conda
conda install -c conda-forge pymol
# Or install using apt
sudo apt-get install pymol
# Install using Homebrew
brew install pymol
# Load structure from PDB
fetch 1AKI
# Load from local file
load myprotein.pdb
# Display as lines
show lines
# Display as ball and stick
show sticks
# Display as surface
show surface
# Display as cartoon
show cartoon
# Color by secondary structure
color structure
# Color by B-factor
color bfactor
# Custom colors
color red, chain A
color blue, chain B
# Create new object
create new_obj, 1AKI
# Select specific residues
select active_site, resi 20-30
# Measure distance
distance dist, active_site, new_obj
# Set image quality
set ray_trace_frames, 1
set ray_trace_color, black
# Save image
ray 1024, 1024
png myimage.png
# Set animation frames
mset 1 x60
# Create rotation animation
mview store, 1
turn y, 360
mview store, 60
mview reinterpolate
# Save animation
mpng frame
Molecular Visualization
Molecular Visualization
Molecular Visualization