| name | binding-site-visualization |
| description | Use when visualizing protein-ligand binding sites, drug binding pockets, active sites, or protein-small molecule interactions through PyMOL. |
| version | 0.1.0 |
Binding Site Visualization
Workflows for visualizing and analyzing protein-ligand interactions.
Send all cmd.* code via: ~/.pymol-agent-bridge/bin/pymol-agent-bridge exec "..." (or heredoc for multi-line). See @pymol-fundamentals for details.
Identifying the Ligand
Common Selection Patterns
cmd.select("ligand", "organic")
cmd.select("ligand", "organic and not solvent")
cmd.select("ligand", "resn ATP")
cmd.select("ligand", "resn NAD")
cmd.select("het", "hetatm")
Verification
count = cmd.count_atoms("ligand")
print("Ligand atoms: " + str(count))
cmd.iterate("ligand", "print(resn)", quiet=0)
Defining the Binding Pocket
Distance-Based Selection
cmd.select("pocket", "byres (polymer.protein within 4 of ligand)")
cmd.select("pocket_wide", "byres (polymer.protein within 5 of ligand)")
cmd.select("contact_atoms", "polymer.protein within 3.5 of ligand")
Counting Pocket Residues
count = cmd.count_atoms("pocket and name CA")
print("Pocket residues: " + str(count))
Standard Visualization
Basic Binding Site View
cmd.show("cartoon", "polymer.protein")
cmd.color("gray80", "polymer.protein")
cmd.hide("lines")
cmd.show("sticks", "ligand")
cmd.util.cbag("ligand")
cmd.show("sticks", "pocket")
cmd.util.cbaw("pocket")
cmd.zoom("ligand", 8)
With Surface
cmd.show("surface", "polymer.protein")
cmd.set("transparency", 0.7)
cmd.set("surface_color", "white", "polymer.protein")
cmd.show("surface", "pocket")
cmd.set("transparency", 0.5, "pocket")
With Labels
cmd.label("pocket and name CA", "resn+resi")
cmd.set("label_size", 14)
cmd.set("label_color", "black", "pocket")
Showing Interactions
Polar Contacts (Hydrogen Bonds)
cmd.distance("hbonds", "ligand", "pocket", mode=2)
cmd.set("dash_color", "yellow", "hbonds")
cmd.set("dash_gap", 0.2)
cmd.set("dash_length", 0.4)
All Contacts
cmd.distance("contacts", "ligand", "pocket", cutoff=4.0, mode=0)
Coloring Strategies
By Interaction Type
cmd.util.cbag("ligand")
cmd.color("cyan", "pocket and resn ARG+LYS")
cmd.color("salmon", "pocket and resn ASP+GLU")
cmd.color("yellow", "pocket and resn PHE+TYR+TRP")
By Distance from Ligand
cmd.spectrum("pc", "blue_white_red", "pocket", byres=1)
Complete Workflow
Standard Binding Site Figure
cmd.delete("all")
cmd.fetch("1hsg")
cmd.select("lig", "organic")
cmd.select("prot", "polymer.protein")
cmd.select("pocket", "byres (prot within 4 of lig)")
cmd.show("cartoon", "prot")
cmd.color("gray80", "prot")
cmd.hide("lines")
cmd.show("sticks", "lig")
cmd.util.cbag("lig")
cmd.show("sticks", "pocket")
cmd.util.cbaw("pocket")
cmd.distance("hbonds", "lig", "pocket", mode=2)
cmd.set("dash_color", "yellow", "hbonds")
cmd.zoom("lig", 6)
cmd.bg_color("white")
Publication-Quality Figures
Settings for Print/Publication
cmd.set("antialias", 2)
cmd.set("ray_trace_mode", 1)
cmd.set("ray_shadows", 0)
cmd.set("depth_cue", 0)
cmd.set("spec_reflect", 0.2)
cmd.set("ambient", 0.5)
cmd.set("cartoon_transparency", 0.3)
cmd.bg_color("white")
Two-Figure Strategy
Always create BOTH overview and detail figures:
Overview Figure - Shows binding site in protein context:
cmd.center("ligand")
cmd.zoom("ligand", buffer=12)
cmd.ray(1200, 900)
cmd.png("binding_overview.png")
Detail Figure - Close-up of interactions:
cmd.zoom("ligand", buffer=5)
cmd.ray(1200, 900)
cmd.png("binding_detail.png")
Key Residue Highlighting
Highlight biologically important residues with distinct colors:
cmd.select("gatekeeper", "resi 529")
cmd.color("tv_blue", "gatekeeper and elem C")
cmd.select("mutation", "resi 600")
cmd.color("salmon", "mutation and elem C")
H-Bond Styling for Figures
cmd.distance("hbonds", "ligand", "pocket", mode=2)
cmd.set("dash_color", "yellow", "hbonds")
cmd.set("dash_gap", 0.3, "hbonds")
cmd.set("dash_width", 2.0, "hbonds")
cmd.hide("labels", "hbonds")
Tips
organic is the reliable selector for ligands
- Use
byres to expand selections to complete residues
- 4 Angstroms is typical for binding pocket definition
mode=2 in distance shows polar contacts only
- White carbons (
util.cbaw) for pocket, colored carbons for ligand helps distinguish
- Gray protein cartoon keeps focus on binding site
- Always ray-trace for publication - OpenGL is for exploration only
- Multiple views tell a complete story - don't settle for just one angle