[Chimera-users] CHIMERA script for CONSURF

Elaine Meng meng at cgl.ucsf.edu
Thu Apr 17 10:25:27 PDT 2008

On Apr 17, 2008, at 12:11 AM, Fabian Gmail wrote:
> Hi all,
> I am very interested to write a script to deal with  the color- 
> coding of
> CONSURF server (http://consurf.tau.ac.il/index.html), a 9 layer colour
> from maroon-to-cyan. I basically would like to know how I could
> translate the code into RGB colors and color the structure  
> accordingly.
> Any suggestions will be greatly appreciated,
> Fabian Glaser
Hi Fabian,
Do you mean you want to take the ConSurf results and show them in  
Chimera, using the same colors that the ConSurf Web server uses?  Or  
do you simply want to use that color scheme with conservation values  
or other properties calculated in Chimera?

Either way, Chimera has some nice features for working with  
"attributes" (named properties with values).  First I'll describe  
attributes, then how to show their values with colors.  I will try to  
be brief, but there are many things that may be relevant!

Examples of attributes are atom B-factors read from a PDB file, and  
amino acid hydrophobicities.  Those are created automatically by  
Chimera, but you can create your own attributes arbitrarily using  
Define Attribute.  If you open a sequence alignment, a residue  
Conservation attribute is automatically added to the associated  
structure(s).  There are several options (entropy, variation, sum-of- 
pairs, with or without sequence weighting) for calculating the  
conservation attribute values.  That flexibility is why I thought you  
might want to use values calculated in Chimera.  It is very easy to  
just open your sequence alignment and structure; association is  

When the structure has a numerical attribute of interest, you can map  
colors to the values with "Render by Attribute" (under Tools...  
Depiction) or the command "rangecolor."  The former has a graphical  
interface with a histogram of the values.  You can place several  
vertical bars on the histogram and give each a color to define the  
color mapping.  This is also very flexible and convenient.   
Rangecolor does the same thing but without a graphical interface.   
"Render by Attribute" can also show residue values with a  
"worm" (tube that varies in fatness).

One difference between coloring this way and with ConSurf is that the  
methods above will color continuously, shading from one color to  
another, whereas ConSurf colors discontinuously.  You could also  
color discontinuously with Chimera... more on that below.

Just now I used the ConSurf server on PDB:2mnr, viewed the results in  
Jmol, and downloaded some results.   One result file is "PDB File  
with Conservation Scores in the tempFactor field."  Thus, you don't  
even have to use Define Attribute - if you just open that PDB file in  
Chimera you will already have the ConSurf scores available as the  
atom attribute "bfactor".  Start "Render by Attribute" and show the  
"atom" attribute "bfactor" ... then change to "residue" and there  
will also be an attribute "average -> bfactor" (average of the atomic  
values).  Either way you have a histogram of values and can define a  
color mapping.  To color ribbons or show worms, you need to use the  
residue attribute, not the atom one.

If I add two additional sliders to the histogram (Ctrl-click) and  
make the colors from left to right: violet red, hot pink, white,  
cyan, dark cyan, it is an approximate visual match to the ConSurf  
scheme.  Apparently negative scores reflect more conserved  
positions.  Of course, you are not limited to the named colors - you  
can generate whatever colors you want in the Color Editor - but it is  
easier to describe here, and you could also use those color names in  
a "rangecolor" command, for example:

rangecolor bfactor,a,r -2 violet red -1 hot pink 0 white 1 cyan 2  
dark cyan

You can also create new color names with "colordef" and use those in  

If you want the EXACT ConSurf colors, they are in the rasmol scripts  
from ConSurf.  Here is a rasmol color: [240,125,171]  To define the  
same color in Chimera, divide each number by 255, e.g. with the command:

colordef mycol2 0.94 0.49 0.67

If you want discontinuous coloring, you could either write a program  
to generate Chimera command scripts from the Consurf rasmol scripts  
or create an attribute assignment file (a simple text format)
to assign a residue attribute with values 1-9 (or 0-9?) to match  
those ConSurf groups.

If converted rasmol script, the commands would then look something like

colordef mycol2 0.94 0.49 0.67
color mycol2 :140,143,164,168,105,117,122,126

If you had defined/assigned a new residue attribute named conSurf,  
the commands would look something like

colordef mycol2 0.94 0.49 0.67
color mycol2 :/conSurf=2

FINALLY, instead of using the ConSurf scores, you could just open the  
multiple sequence alignment from Consurf in Chimera (you can even  
load the tree from Consurf too!), open the structure, and work with  
the residue Conservation attribute as mentioned above.

Phew! I hope this helps somebody!
Elaine C. Meng, Ph.D.                          meng at cgl.ucsf.edu
UCSF Computer Graphics Lab and Babbitt Lab
Department of Pharmaceutical Chemistry
University of California, San Francisco

More information about the Chimera-users mailing list