Yet Another basic Pymol Tutorial
I designed this tutorial with the objective to provide a general view of the basic functions and commands of the software Pymol. Far from being complete, the idea is to be a quick start for the non-experts.
Pre-script
(1): I consider Pymol a great
software to make great movies and
pics of molecules, however there are
other software more
user-friendly and more flexible
depending on the user level and user
objectives.
(i.e. VMD for MD calculations and
'user-friendliness', Chimera for
morphing and speed of graphics among
others).
Pre-script (2): Pymol is free... compiled free versions seemed to have vanished from the web, but you can allways go to Source forge and do it yourself.
The graphical user interface (GUI)
PyMOL software consists of 2 windows (Linux and MS versions in MAC the two windows are bound),
1. 3D screen (center of big black window) - molecules appear are displayed here.
2. Object list (top right of big black window) - loaded molecules and selections appear here. Each of them
can be toggled on and off by clicking on it once. Also, individual display modes can be selected clicking the [S]how, [H]ide, [L]abel and [C]olor buttons.
3. Command line (bottom of big black and small white windows) - Here, text commands can be entered.
4. Rendering menu (top right of small white window) – changes the quality of the current scene.
5. Settings menu (top of white small window) - colors and details of the display modes can be adjusted here.
6. Wizards & plugins menu (top of white small medium window) - contains advanced tools.
This tutorial, will focus on the command line operations as they are faster and more powerful.
The lines in italic represent the command to be typed in the command line. The commands in italic separated with ‘>’ indicate the flow that can be performed in the menus to execute a certain command.
Loading a molecule:
PyMOL can read the following file formats: ".ent", ".pdb", ".mol", ".xplor", ".mmod", ".ccp4", ".r3d", ".trj" and ".pse". Each new molecule will appear as a separate entry in the object list in the upper right corner. If one file contains more they one molecule they can only be differentiated using the select command.
This is done using via the menus – File –> Open… or by the command:
load example_1.pdb
In the following example the molecules on example_2.pdb will be named my_protein in Pymol object list (this does not changes the original pdb file name!)
load example_2.pdb, my_protein
If you have the number of your protein from the PDBdatabank:
Plugin –> PDB loader Service –> insert the pdb code
alternatively you can also simply type from the command line (you need to be connected to the internet in this case):
fetch 2cg9
(where 2cg9 is the pdb code of your favorite protein)
Setting display modes:
There is a number of commands for adjusting display and color of objects which are quite self-explanatory. They all work quite similarly, so the list of examples is not exhaustive: (these display modes are also available under the [S] button on the right side of the big black window)
show cartoon
hide lines, my_protein
show sticks
show spheres, my_protein
show surface, example_1
hide nonbonded
A list of colors is available from the 'Settings' menu or the [C] button in the object list. Custom colors can be defined using theset_color command.
Resetting the view:
If the molecules have slipped out-of-sight or the rotation centre is weird, everything (or a single molecule) can be centered again by typing
orient
orient my_protein
or just right-click on the mouse and select orient or center
Saving Session, scenes, molecules and images:
Pymol Sessions (.pse files) are very handy to keep a good trace of all your work. i.e. in these files all loaded molecules are saved, including selections, orientations, colors ... etc... moreover when you loaded you will obtain the view as when you saved it.
save my_session.pse
or simply – File –> Save session as…
if you want to save the work as a new pdb file:
save everything.pdb
save my_molecule.pdb, my_protein
or – File –> Save Molecule …
Images can be written in ".png" format:
png first_picture.png
or – File –> Save Image …
Pymol allows you to save scenes. These correspond to a kind of snapshot of what is shown in the screen and can be saved using:
scene F1,store
or - Scene>Store>F1...F2...
using this you can save several scenes and came back to them later by simply pressing the F# keys. Handy for movies and presentations.
Selecting parts of molecules
This is one of the most powerful characteristics in Pymol when compared to other molecular visualization softwares.
One straightforward way to do amino acid residues selection is to point them out from the sequence:
Display –> sequence
Now the sequence is displayed and one can select the residues with the left button. Use the Ctrl and Shift keys to select more than one. To change the attributes of the selected region, just right click on the selected region (in the sequence).
Command Select (Creates a named subset of one or several molecules or parts of molecules that can be manipulated as if it were a molecule object.)
select [selection_name],
[selection commands]
[selection commands] |
Subset |
Example |
Name |
Atom names |
name n+ca+cb+co+o |
Symbol |
Elements |
symbol o+n |
Resn |
Residue types |
resn asp+glu |
Chain |
Chain |
chain a+b |
Resi |
Residue numbers |
resi 101-110 |
Ss |
Secondary structure |
ss h+s+l |
Hydro |
Waters |
hydro |
Hetatm |
Non-protein atoms |
hetatm |
Within |
Nearby atoms |
1FSS within 10 of res 14 |
Around |
selection of atoms around a previous selection for X A |
resn asp around 5.0 |
Combination of different selections (using typical Boolean expressions):
select [selection_name], <expression> and <expression>
select [selection_name], <expression> or <expression>
select [selection_name], not <expression>
select [selection_name], (<expression>) and <expression>
Once you enter this command the selection object will appear on the object list (upper right corner of the black window), the names of selections are indicated by brackets. Clicking an objects name will hide/show it.
NOTE: To have a full description of the different chains, atoms, residues_names, residue_numbers and ligands of the macromolecules under study, check the contents of the pdb file your working on using your favorite text editor (e.g. notepad, vi, g/kedit). If using notepad in windows don’t forget to turn on the word wrap).
Distances
Measure the distance between two differente selections. These selections should be atoms. The distance will be measured and indicated on the screen:
distance [distance_name]= selection1, selection2
Examples:
select Calphas, chain a and name ca
(selection called "Calphas" that consists of all C_alfa atoms in chain A)
select OXI, elem O and chain A and not resn HOH
(selection called "OXI" that consists of all oxygens from chain A but no waters)
Try it out!
- Download the 1usu.pdb from the PDB databank (this is the X-ray of M domain of Hsp90 + AHA1)
- Load yeast Hsp90 from the pdb databank (2cg9).
- Fit the molecules in the pdb’s.
(Left click on [A]ctions – align – select molecule to align to)
(This allows to check how different (or not) the molecules are)
- Create a selection that includes all the C_gamma atoms from the Ile residues of chain A from Hsp90.
- Create a selection that includes all the C_gamma atoms from the Leu and Val residues of chain B from Hsp90 .
- Color both differently and display the different domains in different color schemes.
- Play around with the different ways to represent the molecule.
- How many Ile are up to 4A of distance from each other? And from Leu and Val?
- Find the hydrogen bonds that keep M domain and AHA1 together :
(Hint: select the 2 proteins that are bound and right click – find – polar contacts)
Hydrophobicity plots
You can plot the hydrophobicity of a molecule using the script h_color from the Pymol Wiki.
This color scheme is based on the paper Amino acid scale: Normalized consensus hydrophobicity scale Eisenberg D., Schwarz E., Komarony M., Wall R: J. Mol. Biol. 179:125-142 (1984) http://us.expasy.org/tools/pscale/Hphob.Eisenberg.html
just save it to a folder of you choice and using the Pymol command line:
run h_color (loads the script into Pymol)
color_h (runs the script)
Changing the
b-factor column of PDB files
This can be very useful when one wants to color the molecule by a specific physical and biological property (solvent accessibility, conservation, etc)
NOTE1: the 'txtfilewithnewbfactor' needs to be a txt file with only one column and with the same number of lines as the molecule description in the original pdb file.
NOTE2:
for conservation coloring, simply
align all the sequences in ClustalW2 >
start JalView > right click on
Conservation > save to txt file
> convert the one line file to a
one column file > follow the
lines bellow (in Pymol):
alter pdbfile, b=0
f = open('txtfilewithnewbfactor','r').readlines()
alter pdbfile and n. CA, b=f.pop(0)
spectrum b, selection=(pdbfile and n. CA)
Nice
pictures
Pymol is very powerful on making high
quality figures, this can lead to BIG
files and to long time waiting for the
final processing of the images so
prepare some coffee in the mean
while...
Raytracing:
PyMOL contains an efficient raytracer for high-quality rendering. By default, it calculates an image the size of the 3D window, but the size in pixels can also be given explicitly:
ray
or one can also specify a value for the ray: ray_val = size_in_inches * DPI
ray
2500,2500
(would correspond to a image with of 8,3 inches (~21.1 cm) side with 300dpi)
QuteMol style examples:
Movie made using Pymol and molecule in QuteMol style
There are lots of documentation on PyMOL available on the web:
http://www.pymol.org - The PyMOL manual, which is pretty extensive (150+ pages).
http://www.pymolwiki.org - The PyMOL wiki serves as a main gathering point for user-contributed documentation