PLAYMOL LOGO
 

pyMol - The Basics

Here is a list of some of the basic stuff in pyMol that can be useful to know.
  1. Color Space
  2. Background Color
  3. Representations
  4. Colors
  5. Selections

1. Color Space

Actually I do not see this covered so often, but I think it is important to think about what type of color space you prefer. First of all because your images will look quite different dependending on what you choose, and secondly because the colors can be differently converted when using softwares such as photoshop. It is further nice to be aware of this to create figures that are consistent with each other.

There are three options for the color space in pyMol: RGB (default), CMYK (for publications) and pymol (for video & web). Personally I prefer the CMYK color space which forces PyMOL to restrict its use of the RGB color space to a subset that can be reliably converted to CMYK using common tools such as Adobe Photoshop. Here follow some examples:

PyMol> space rgb

RGB color space (default).

PyMol> space cmyk

CMYK color space.

PyMol> space pymol

Pymol color space.

As you can see, the colors that are (at least visually) the most affected by these settings are green, blue and yellow. Actually, when doing more detailed images, these effects become quite visible. So if you ever find yourself in a situation wondering why you can not get the same color on a figure as before, try changing the color space.

2. Background Color

Changing the background color is very basic, and in many cases this is something you want to do as black is not always the best choice for articles etc. To change the background color to white for example, simply type:

PyMol> bg_color white

3. Representations

Now, representing molecular structures is what pyMol is all about. Here follows a list of commands for the most basic representations with example images. There are of course more technical and interesting ways of representing molecules, and I will cover this in another tutorial.

Lines

PyMol> show lines, all

Lines.

Sticks

PyMol> show sticks, all

Sticks.

Ribbon

PyMol> show ribbon, all

Ribbon.

Cartoon

PyMol> show cartoon, all

Cartoon.

Sausage view

PyMol> show cartoon, all

PyMol> cartoon putty

PyMol> unset cartoon_smooth_loops

PyMol> unset cartoon_flat_sheets

Sausage/putty representation

Dots

PyMol> show dots, all

Dots.

Wire

PyMol> show wire, all

Wire.

Spheres

PyMol> show spheres, all

Spheres.

Surface

PyMol> show surface, all

Surface.

4. Colors

Changing the object color is easily done through the 'color' command followed by the name of a color or the color code. For example, to color an object green, type:

PyMol> color green, objectName

Object colored in green.

Maybe a bit more interesting is the possibility to color based on the secondary structure. You access the secondary structure elements throught the 'ss' keyword followed by 'h', 's' or 'l+' for helix, sheet and loop, respectively.

PyMol> color gray, ss l+

PyMol> color red, ss h

PyMol> color sand, ss s

Coloring by secondary structure.

5. Selections

Being able to select atoms, residues, chains and entire objects is by all means one of the most important features of pyMol. With selctions you can for example add a unique color to each residue:

PyMol> color "color", i. "residueNumber"

Coloring each residue with different colors.

Here is a list of examples using different selectors:

Object displayed with ribbon and all CA atoms displayed as spheres.

Using 'or' and 'and' enables you to do more flexible selctions. Here it is important to understand the difference between the two. Using 'a and b' for example means that both 'a' and 'b' need to be true for the selection to work. Specifying

PyMol> show spheres, name C and name CB

will never work because 'C' and 'CB' are different atoms, and can not be the same. However, specifying

PyMol> show spheres, name C or name CB

will successfully display spheres on both 'C' and 'CB'. Another example:

PyMol> show spheres, i. 21-90 and name CA

This will display spheres on all CA atoms for residues 21 to 90.