Advanced colouring

From CUC3
Jump to navigation Jump to search

You can do all sorts of weird and wonderful colouring with Pymol - but the syntax is slightly cryptic. You can find some examples on the Pymol Wiki here and here.

Shading with a spectrum representing an atomic property

Say you have the AMBER topology files for a small drug molecule which has been parametrised in two different ways, and you would like to compare the partial atomic charges on each molecule. For this example. there are three files required - OTV_bcc.top and OTV_resp.top are actually AMBER .prmtop files. I have renamed them .top as this is what Pymol expects. You can force a file format with the load command however. Finally, min1.rst is an amber coordinate file. If you have problems using .rst files, compare them to an equivalent .inpcrd file and check the spacing.

Firstly - you'll need to load the structures into Pymol. For topology files, you first need to define the topology object, and then load the coordinates in.

Defining the topology object for each:

load OTV_bcc.top , OTVbcc
load OTV_resp.top , OTVresp

We now need to load the coordinates for each topology into the appropriate object. For a charge comparison, it makes sense to use the same coordinates for both topologies:

load min1.rst , OTVbcc
load min1.rst , OTVresp

You should now see both structures. Once you have altered their appearance to your satisfaction, you need to do the colouring. Partial charge is contained in the pc. array (N.B. the . character must be present). For example, you can select all atoms with partial charge greater than 0.1 using:

sele pc. > 0.1 

You could use this approach to sequentially select sets of atoms and colour them manually, but the spectrum command saves you a lot of work:

cmd.spectrum("pc.", 'red_white_blue', selection="all");

This shades atoms in the selection (object) 'all in a spectrum from red, through white, to blue - by the value of pc..

The list of possible spectra (from the PyMolWiki) is:

blue_green, green_white_magenta, red_cyan, blue_magenta, green_white_red, red_green, blue_red, green_white_yellow, red_white_blue, blue_white_green, green_yellow, red_white_cyan, blue_white_magenta,
green_yellow_red, red_white_green, blue_white_red, magenta_blue, red_white_yellow, blue_white_yellow, magenta_cyan, red_yellow, blue_yellow, magenta_green, red_yellow_green, cbmr, 
magenta_white_blue, rmbc, cyan_magenta, magenta_white_cyan, yellow_blue, cyan_red, magenta_white_green, yellow_cyan, cyan_white_magenta, magenta_white_yellow, yellow_cyan_white, cyan_white_red,  
magenta_yellow, yellow_green, cyan_white_yellow, rainbow, yellow_magenta, cyan_yellow, rainbow2, yellow_red, gcbmry, rainbow2_rev, yellow_white_blue, green_blue, rainbow_cycle, yellow_white_green, 
green_magenta, rainbow_cycle_rev, yellow_white_magenta, green_red, rainbow_rev, yellow_white_red, green_white_blue, red_blue, yrmbcg 


NOTE: this will not work if you load in a .pdb as it does not contain charge information!

There probably is a way around this with a pdb file. The pdb files can be colored on a residue by residue basis by using the temperature factor field.