PyMol for Dummies

I feel particularly well-qualified to write this tutorial because I know almost nothing about PyMol other than it exists and claims to be Open Source (aka free software). It seems to fall short of my definition of open source in several ways, so if you start PyMol you'll see this begging notice on the load page. Let's just assume that we are still evaluating it. Click on that notice to make it go away.

PyMol is located in /Applications on the Apple/OSX machines and is called MacPyMol. You can drag it to the Dock if you wish.

You can surf the PyMol home page in search of further enlightenment. Matt in the Hughson lab is the resident PyMol expert, who will now hate me for having you all go and ask him questions. As with anything else, at least try and figure it out yourself before going to get someone else to do your work for you.

PyMol is written in Python (hence the name) an extendible scripting language. This language is also popular with the group that develops PHENIX and CCTBX. This means that PyMol can access the powerful scripting features of Python (i.e. you can use Python syntax within PyMol). Some of that is good news, and some of that is bad. PyMol is best controlled using the command syntax and thankfully it is a little better than Molscript in this regard. However PyMol is still basically a "picture" program and not much of an "analysis" program so I'm not about to replace O with it.

Simple Unix commands work:

Visual manipulation: The lower right hand corner of the graphics window shows the mapping of the mouse buttons and keys to various actions. Left mouse handles rotations, middle mouse handles XY translations, right mouse handles Z translations. Bear in mind that since PyMol does things in perspective mode by default, your molecule gets "bigger" as you move it toward you. (This does not happen in the orthoscopic mode).

Above the mouse control panel is a list of current objects and the A,S,H,L,C buttons for actions, show, hide, labels and colors that are shortcuts for most of the simple command syntax. The object "all" refers to all loaded PDB files. The (sele) line refers to the current graphical selection.

All the way to the far top right of the window are the buttons Reset (reset view), Zoom (reset zoom), Draw (what does this do?), Ray (ray-traces the current view) and Rock which waggles the structure slowly back and forth about the vertical axis. Below this are Unpick, Hide Sele and Get View which do fairly obvious things based on their names. On the last line are the movie controls.

The text window at the top right shows the output of the PyMol/Python interpreter as it responds to commands that you have typed. You can type these commands in the graphics window or up in the PyMol> text box just below the text panel. In fact pretty much anywhere you type a command, PyMol will try and read and interpret it.

Common PyMol commands:
load myfile.pdb Read a PDB file
@myscript.pml Read and execute commands from a file
show [style] [, selection] Show graphical elements
styles: spheres, sticks, cartoon
hide [style] [, selection] Hide graphical elements
color color [, selection] Color structure
colors: red, green, blue, yellow, cyan, orange, pink, violet, purple, brown - also accepts integers
create object [, selection]
set parameter=value [, selection] Set parameter values
parameters: too many to list
get_view Shows current view matrix
set_view Set to supplied view matrix
bg_color Background color
ray Raytrace
png Save to PNM/PNG file
zoom [selection] Reset zoom
h_add Add hydrogens
count_atoms [selection] Count atoms
remove selection Remove atoms
select name, selection Make a named selection

Example selections: