PyMOL for Molecular Visualization
This tutorial shows how to effectively use the program PyMOL for visualizing biological macromolecules. You will learn about the layout and functionality of the program through a set of guided tasks. According to the program's author, Dr. Warren DeLano, PyMOL is a molecular graphics system with an embedded Python interpreter designed for real-time visualization and rapid generation of high-quality molecular graphics images and animations. It can also perform many other valuable tasks (such as editing PDB files) that assist you in your research.
The strengths of PyMOL arise from the emphasis on high-quality graphics, the use of the powerful programming language (Python), and the extendability with Plugins. During the early development, emphasis was placed on providing functionality, and not on intuitive user interface. As a result, it takes some time to learn the program. The PyMOL commands are explained in the PyMOL Wiki. Examples of PyMOL images with commands used to generate these views are available in the Biomolecular Images and Movies for Teaching page. In more difficult cases you can ask help from PyMOL users via the PyMOL forum. PyMOL is available for many computer platforms either as a pre-compiled binary or in the free source code form. As of early 2010, development of PyMOL is continued by Schrodinger, LLC.
You can interact with the program via four complimentary ways:
- Pull-down menus provide access to the file functions, the molecular editor, the program options, and a few more advanced tasks. For example, you can save the graphical representation of the molecule into an image file.
- A task bar on the right side of the screen allows one to select how to display selected objects. For example, you can show one of the molecules as a grey surface and the other one as green sticks if you have previously separated them into two different objects.
- The molecular display area allows to one view and interactively manipulate molecules. Your three-button mouse allows you to rotate, move, and zoom in/out by holding down the left, middle, or right button, respectively. Furthermore, you can select and perform specific tasks via mouse and keyboard shortcuts. For example, you can select two atoms (first by CTRL-SHIFT/left-clicking, second by CTRL-SHIFT/right-clicking ) and create a covalent bond by pressing CTRL-T.
- The command line allows you to type in commands that can accomplish almost any of PyMOL's functions. For example, you can type set cartoon_ring_mode, 1 in order to display the nucleobases inside the DNA double helix when the cartoon representation is used. This is the most powerful way to interact with the program, but requires that you are familiar with the logic and syntax of PyMOL commands.
So, lets get started. Open the PyMOL program either by clicking on its icon or by typing pymol in Terminal. Load a structure of a protein-DNA complex (PDB code 1B01 (this is one-b-zero-one)). You can load the structures via the PDB Loader Service from the Plugin menu.
One of the strengths of PyMOL lies in the ability to create intricate and beautiful graphical representations of complex objects. The program comes with several presets that can be accessed from the Actions menu. Try some of these.
Enough of the easy stuff! You can interact with the program via several complimentary ways:
- Pull-down menus provide access to the file functions, the molecular editor, the program options, and a few more advanced tasks. For example, you can change the display quality settings, the background color, the size of your spheres, or the transparency of the surface from the pull-down menus. The Wizard menu guides you through some of the tasks that require higher level of interactivity. For example, you can easily measure distances between atoms by selecting them on the screen using the Measurement Wizard. The Mutagenesis Wizard allows to make point mutations in the selected residues of the protein. Try these. PyMOL is aware of rotamer libraries of side-chains; you can walk through different rotamers with the "VCR Player" forward and reverse buttons at the bottom right.
- The sequence area in the PyMOL Viewer allows one to understand the composition of the molecular system being displayed. For example, by selecting Sequence from the Display pull-down menu, and specifying Chains as the Sequence Mode in the same menu, one can see that there are four chains in the structure 1B01. Clicking on each chain reveals that chains A and B define the protein while chains E and F make up the DNA double helix. Create a new selection containing only protein atoms. This shows up as (sele) in the right-hand toolbar. Rename this section to protein (click on the Actions: to see possible operations). Click on the black background to de-select the chains A and B. Now create another selection that contains only DNA atoms. Rename this selection to dna.
- The molecular graphics area in the PyMOL Viewer allows one to view and interactively manipulate molecules. Your three-button mouse allows you to rotate, move, and zoom in/out by holding down the left, middle, or right button, respectively. Clicking on the atom usually selects the atom, the associated residue, or the whole molecule depending on the value in the Selecting field. However, the behavior is different in the Viewing and Editing modes. When in Viewing Mode, clicking on an atom creates a new object or adds residues to the existing objects. When in editing mode, clicking on an atom creates a family of selections, with the selected atom stored in (pk1), the selected residue in (pkres), and the selected chain in (pkchain). Here, clicking on the next atom will create a new selection (pk2). After selecting atom(s) with mouse you can perform specific tasks via the keyboard shortcuts. For example, you can select two atoms into (pk1) and (pk2) and create a covalent bond by pressing CTRL-T. Take a notice of the lack of Undo functionality in current versions of PyMOL.
- A task bar on the top right side of the screen allows one to manipulate objects and selected items. You can tell if something is an object or selected item because the selected items are in parenthesis. For example, you may have an object 1B01 and a selection (protein). The selections and objects behave little different in some cases but we treat them as same for now. The top area is divided into a grid with different objects as rows and operations as columns. In the absence of a molecule, the only object is "all". The six columns allow to show and hide the object, apply actions on the object, determine what is shown about the object, determine what is hidden about the object, and what color scheme is associated with the object. In PyMOL, it is often helpful to group different parts of the system into objects. For example, if you have created an object for the protein, and another object for the DNA, you can easily show your protein as a yellow surface and the DNA as cyan spheres. This allows one to clearly see if the protein binds to the small or the large groove of DNA.
- A task area on the bottom right changes the behaviour of the program depending on the task you wish to perform. Here, you can switch between the viewing and editing modes, or determine if clicking on an atom will select just this atom or the whole residue.
- The command line allows you to type in commands that can accomplish almost any of PyMOL's functions. For example, if you have previously created selections or objects called "protein" and "dna", you can create dashed lines between polar atoms in the protein and the DNA components using a command "dist (protein and (name o* or name n*)), (dna and (name o* or name n*)), 3.0". This could be a good way to visualize hydrogen bonds. Or you can break a bond by first selecting the two atoms in the Mouse editing mode into (pk1) and (pk2) and then issuing a command unbond pk1, pk2. The command line is the most powerful way to interact with the program, but requires that you are familiar with the logic and syntax of PyMOL commands.
Play few minutes with this structure until you feel comfortable with the basic selection and rendering options.