PyMol Tutorial
PyMol Tutorial
Stephen Curry
31 March 2006
What are we going to do this morning?
• System requirements:
– computer (faster is better): PC (Windows/Linux), Mac (OS X)
– a 3-button scroll mouse
– works with hardware stereo
• How do I...?
– Load a pdb file: (1) pdb loader; (2) open file
– Some display settings
– Create an object
– Use the mouse to move, zoom, slab, rotate (modifier keys)
– Use the object menus: A, S, H, L, C
Display options
Colour an object
– Navigate contextual menus
– Display the sequence
– Select residues
– Save my work
How do I start the program?
Double-click the
application icon (?)
or
From a terminal
window, type “pymol”
DEMO
How do I load a PDB file
• Download a pdb file directly into pymol
– Make sure you are connected to the internet
– Plugin > PDB Loader Service
– type in the PDB ID (e.g. 2bhg)
– object appears with this PDB ID
DEMO
Useful display settings...
chain A
new
object brackets
required Boolean
name
operator
comma
required
DEMO
Using the mouse in the graphics window
• Unmodified controls
– Left - rotate molecule (x, y and, at edges, z)
– Middle - translate molecule (x, y)
– Right - zoom (=MovZ)
– Wheel - slab/clip
Menu at bottom right
• With shift key
– Right - up/down: clip front
- left/right: clip back
DEMO
Object menus: A, S, H, L, C
A is for Action
Navigation tools
Quick-draw tools
DEMO
S is for Show
Useful representations
H is for Hide
L is for Label
DEMO
C is for Color
Lots of options
Mostly self-explanatory
DEMO
Contextual menus
• Left double click or right single
click to activate
– click on object or part of object
you want to manipulate
– more or less the same menus as
ASHLC
DEMO
Display the sequence
From menu:
Display > Sequence
or
click on “S” in mouse menu
DEMO
The settings menu
Secondary structure
CPK
Sticks
Surfaces
H-bonds
Domain colouring
Selection of residues
and atoms
Fig. 1 script - pt1
# Script name: hms1-pbz.pml (hsa-myristate-site1-phenylbutazone)
#
# Close-up of drug site 1 in hsa-myr-pbz
#
#define initial, view, cartoon parameters
@pymol_setup.mac Set global parameters (see next)
# pymol_setup.mac
#
#initial setup
viewport 600, 600 ---size of graphics window
set auto_zoom, off ---don’t zoom in on new objects
set auto_show_lines, off ---don’t automatically display loaded pdb files
set auto_show_selections, off ---don’t automatically display selections
#cartoon parameters
set cartoon_fancy_helices,1 ---nicer helices (personal choice)
set cartoon_discrete_colors,1 ---can’t remember
set cartoon_highlight_color, grey60 ---inside of helices light gray
set cartoon_dumbbell_length,1.0 ---defines width of helix ribbon!
set cartoon_rect_length,1.40000 ---defines width of β-strands
set cartoon_loop_radius,0.3 ---width of tube used for loops
set cartoon_smooth_loops=0 ---no smoothing (if sidechains needed)
Global settings
pymol_setup.mac continued...
#create dom2 and dom3 based on single structure loaded above Create an object
@hm.dom23.mac containing domains
#define drug colour scheme 2 and 3
@drug_colours.mac
#draw drugs as sticks and colour by atom type Create an object called “drugs”
create drugs, (hsa and (i;2001 or i;1009)) that displays two ligand
show sticks, drugs
@drugs-stick-rad.mac
molecules as sticks
color pbz_col, (i;2001 and e;C)
color fa_col, (i;1009 and e;C) Colour by atom type
color blue, (drugs and e;N)
color red, (drugs and e;O)
color green, (drugs and n;CL)
Selection syntax - some examples
#drug_colours.mac #drug_stick_rad.mac
# site 1 (primary) set stick_radius, 0.22, drugs
set_color aza_col, [1.0, 1.0, 0.75]
set_color cpf_col, [0.75, 0.75, 0.25]
set_color dzp_col, [1.0, 0.75, 1.0]
set_color hal_col, [0.25, 0.25, 0.25]
set_color imn_col, [1.0, 1.0, 0.5]
set_color iod_col, [1.0, 0.5, 0.5]
set_color oxy_col, [0.25, 0.75, 0.5]
set_color pbz_col, [0.0, 0.75, 1.0]
etc...
Fig. 1 script - pt3
Create an object called “surf”
create surf, (hsa and i;2001)
show surface, surf which shows the surface of
colour lilac, surf residue 2001 (=pbz).
set transparency, 0.6, surf Make semi-transparent.
create surf1, (hsa and i;1009)
show surface, surf1 Create an object called “surf1”
set_color light_yellow, [1.0, 1.0, 0.2] which shows the surface of
colour light_yellow, surf1 residue 1009 (=FA).
set transparency, 0.5, surf1 Colour it differently
# add FA2 Make semi-transparent.
create fa-c, (i;1002 and e;C)
set sphere_scale, 1, fa-c Draw a FA molecule as a CPK
show spheres, fa-c
model by creating 2 objects
create fa-o, (i;1002 and e;O) (“fa-c” and “fa-o”).
set sphere_scale, 0.78, fa-o
show spheres, fa-o Make O atoms smaller than C
atoms (VdW)
color grey70, ((fa-c or fa-o) and e;C)
color red, ((fa-c or fa-o) and e;O)) Colour by atom type.
Fig. 1 script - pt4
# add sidechains for site 1 (sc1.mac) Create an object called “sc”
@sc1.mac
which shows selected
show sticks, sc
@sc-stick-rad.mac sidechains as sticks.
color grey70, (sc and (e;C and not n;CA)) Colour by atom type - but do
color blue, (sc and e;N) not re-colour the CA atom
color red, (sc and e;O)
color yellow, (sc and e;S)
#sc1.mac
#drug site 1 sidechains
create sc, ((i;150 or i;195 or i;199 or i;202 or i;211 or i;214:215 or i;218:219 or
i;222:223 or i;234 or i;238 or i;242 or i;257 or i;264 or i;291)
and not (n;O or n;C or n;N))
All one line!
#set view
@s1-hm-cuview.mac
Define the viewpoint (see next)
#ray 1200,1200
Ray-trace and write out file (remove ‘#’ when ready)
#png hms1-pbz.png
Setting the viewpoint
You don’t have to type
# s1-hm-cuview.mac
this!
# close-up view of site 1 in hsa-myr
#
set_view (\ • Set the view you want
0.847002089, 0.519193769, -0.113906674,\ in the graphics window
-0.408921719, 0.773371875, 0.484395087,\ • Click on the “Get View”
0.339599967, -0.363719672, 0.867373824,\ button
-0.001291693, 0.898808300, -70.790878296,\
31.465492249, 12.112967491, 12.206689835,\ • Cut and paste the
52.887966156, 87.986236572, 1.000000000 ) set_view matrix into
your script (or macro)
Fig. 2 - protein with electron density
Loading maps
Display as mesh and/or surface
Controlling extent of map displayed
Fig. 2 script - pt1
# script: 3C_loopmap.pml
#
#setup global parameters Setup and load pdb file
@pymol_setup.mac
load wat4a_060310.2.A.pdb, 3C
#ray 1000,1000
#png k51e_loopmap.cu.png