PyMol Tutorial :: Animation of an enzyme active site

Back to Teaching & tutorials

Quick link to all PyMol tutorials:

  • Tutorial 1: Basic principles of animation. Using PyMol to animate structural superimposition of biological macromolecules.
  • Tutorial 2: Overview of protein structural and functional features using Pymol animation.

Tutorial 2: Overview of protein structural and functional features using Pymol animation
With an example on the glutathione S-transferases.

Today I had to give a brief overview of common and subfamily-specific features of the glutathione S-transferase enzymes to my students. In particular, I had to explain the organisation of the active site that has two subsites - to bind glutathione and a xenobiotic. In this tutorial I describe in details how to create an animated PyMol movie with a general overview of you protein to explain its structural features.

This tutorial is based on Tutorial 1: Basic principles of animation that you should read before you continue.

Glutathione-S-transferases represent a wide group of dimeric enzymes whose common feature is catalysing the nucleophilic attack of glutathione (GSH) on the electrophilic groups of a wide range of hydrophobic toxic compounds. The GST superfamily has been sub-grouped into an ever-increasing number of classes according to a variety of criteria. Members of the superfamily generally share low sequence identity but have a common structural organisation. Each subunit of GST dimer possesses two structurally distinct domains and contains independent catalytic center that consists of a G-site for binding physiological substrate GSH and an H-site for binding structurally diverse endogenous and xenobiotic substances.
Bioinformatic analysis of Glutathione-S-transferases has been previously discussed.

Internet bandwidth notice
This tutorial page contains animated GIF movies that weight about 20 MB in total. Depending on the speed of your internet connection it can take time for them to download to your computer. Until that, the animations can play in a slow mode or not play at all. Do not reload the page and let all files to download to your computer.

I used three animation methods from Tutorial 1 - roll() to rotate my protein around its axis, setView() to set my camera view and changeView() to reposition the camera. However, this time I wanted to freeze some scenes and give myself more time to speak on them. To do so I modified the ray() method to include an option of duplicating some frames - that means that selected scenes will be represented by multiple identical frames to pause the animation. I have also removed an option to setup the ambient light because I felt ok with default lighting I saw in the viewer.
#Ray trace the scene and save the image required number of times
#@frames: number of frames to duplicate for current view
def ray(frames):
    global ray_x, ray_y, ray_mode, ray_antialias, ray_save_dpi, frame_number
    cmd.set("ray_shadows", ray_shadows)
    cmd.set("ray_trace_mode", ray_mode)
    #Ray trace the image
    cmd.ray(ray_x, ray_y, ray_antialias)
    #And now save it the required number of times to create still animation
    while frame <= frames:        
	cmd.png("mov"+`frame_number`, dpi=ray_save_dpi)

Writing user-defined animation scenario
Like in the first tutorial, I started from setting the initial position of my camera to capture the GST homodimer and requested a one-time 360-degrees rotation around Y-axis. This gave me opportunity to talk about general structure composition.

setView([-0.292040080,    0.100425251,    0.951092422,
    -0.286197424,   -0.958059013,    0.013270494,
     0.912562191,   -0.268329442,    0.308541417,
     0.000048757,    0.000942180, -170.841262817,
    24.145578384,   16.194761276,   20.027019501,
   130.490020752,  210.363708496,  -20.000000000])

roll(120, 'y', '2gst')

Now, I wanted to show that each protein chain contains a separate, but not independent, active site. The crystallographic PDB structure 2GST that I have selected for this animation contained bound reaction product of the addition of glutathione to phenanthrene 9,10-oxide (GPS). Therefore, I decided to highlight this crystallographic reaction product to show the location of the two active sites. Below you can find the API commands to be included into the script that will show the GPS product as ball-and-sticks and color carbon atoms in magenta."sticks", "GPS")"spheres", "GPS")
cmd.set("sphere_scale", "0.15")
cmd.set("stick_radius", "0.12")
cmd.color("magenta", "GPS and elem c")

Now I wanted to get some time to talk to the audience about what they see. So I used the new ray() method to freeze the scene for couple of seconds.


Now it was time to make a zoom on the active site and explain different sub-sites for binding two substrates. I needed only one chain of the homodimer for this, so the second chain was hidden from the viewer. Then I changed the position of my camera.

cmd.hide("everything", "chain b")

[-0.292040080,    0.100425251,    0.951092422,
    -0.286197424,   -0.958059013,    0.013270494,
     0.912562191,   -0.268329442,    0.308541417,
     0.000048757,    0.000942180, -170.841262817,
    24.145578384,   16.194761276,   20.027019501,
   130.490020752,  210.363708496,  -20.000000000],
[   -0.123555824,    0.616804600,    0.777319372,
    -0.183663949,    0.755576491,   -0.628760815,
    -0.975177765,   -0.220461115,    0.019931845,
     0.000000000,    0.000000000,  -42.888347626,
    17.172000885,   18.573999405,   31.329000473,
     9.882720947,   75.894050598,  -20.000000000])

Then I showed surface representation of the protein chain A in the active site and colored the sub-sites according to binding preference."surface", "2gst and chain a")

cmd.color("cyan", "GPS and name CA4+CA5+CB5+CG5+CD5+CE5+CZ5+CH5+CH4+CB4+CG4+CZ4+CE4+CD4+CG4")
cmd.color("magenta", "2gst within 5 from GPS")
cmd.color("cyan", "2gst within 5 from (GPS and name O5+CA4+CA5+CB5+CG5+CD5+CE5+CZ5+CH5+CH4+CB4+CG4+CZ4+CE4+CD4+CG4)")

Running it yourself
1. Download the starting structure here. Its a PyMol pse-session file created with PyMol v.
2. Download the animation script
3. Open pse file in pymol, switch to the command line and type


Before doing this make sure that you PyMol viewer is switched to image mode, not the command line mode! Press 'Esc' key to toggle between the modes. If the viewer is in the command line mode when ray-tracing you will result with beautiful frames of your command line interpreter.

4. The frame tracing step will take time. If you run a new script for the first time you can use low resolution settings for ray traces (check the ray() method) but be sure to keep the proportions. For example, you can create a test set with 640x512 or even 320x256 resolution and eventually use 1280x1024 or 2560x2048 to get final HQ images. Alternatively, you can comment out the cmd.ray() command in the ray() method. This will make raw untraced images to be saved to the disk in screen resolution. This is the fastest option but if the screen resolution has different proportions with the target resolution you would finally use than the viewer can fail to capture the compete scene.

5. If you have done everything correctly, you should have 453 images in PNG format on your hard drive. In linux OS use the following command to convert PNG files and create animated GIF:

convert -delay 7 -loop 0 `ls *png | sort -V` full.gif

Animated GIF is the most flexible format and never fails to play in presentations (to my experience). Use larger "delay" numbers to slow down your animation or smaller ones - to speed it up. Loop '0' means that once the animation reaches the end frame it will be played again from the beginning. If you want it to stop at the last frame use '-loop 1'. Finally the ls *png | sort -V trick will arrange your files by frame version number from 1-st to 453-rd - this is the way you need it. Alternatively, you can use something more complicated like convert -delay 7 -loop 0 `i=1; while [ "$i" -lt "454" ];do echo -n mov$i.png" "; let i=i+1; done` full_hq.gif. Wondering why not to use "*png" instead? Try out ls *png in your linux command line interpreter. You will see that your frames are arranged according to general numeric order: mov100.png, mov101.png, mov102.png, ..., mov99.png, mov9.png. Merging frames in this order will screw up the movie.
Of course, you can use any other software to merge these files to any movie format.

Hope this was a helpful reading.
More to come.
Questions and comments appreciated to

Flag Counter