
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 -- Fabian Glaser, PhD Bioinformatics Knowledge Unit, The Lorry I. Lokey Interdisciplinary Center for Life Sciences and Engineering Technion - Israel Institute of Technology Haifa 32000, ISRAEL Web: http://bku.technion.ac.il Email: fglaser@tx.technion.ac.il Tel: +972-(0)4-8293701 Cel: +972-(0)54-4772396

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! ATTRIBUTES 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 automatic. http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/defineattrib/ defineattrib.html#attribdef http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/ multalignviewer/multalignviewer.html#mavAttributes COLORING 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). http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/render/ render.html#render http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/rangecolor.html 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 "rangecolor." 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. http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/defineattrib/ defineattrib.html#attrfile 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 ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html

Hi Fabian, I had failed to notice you are one of the ConSurf developers, so my reply focused more on what an outside user could do. However, if you are thinking of providing Chimera scripts from the server, that would be great!! If so, you probably do want discontinuous coloring with exactly the same colors and sets of residues, so that all the graphics programs would show the same thing. Thus the Chimera script should contain "colordef" to define the colors and "color" to apply them to the residues. There are different possibilities for specifying the residues in the color command, however. (a) simply specify the residues by their residue numbers, like in the Consurf rasmol scripts (b) use "alias" to name sets of residues and then specify the residues by the alias string (c) make an attribute definition file (this file is read using the command "defattr") and then specify residues by attribute value. Disadvantage is an extra file. Advantages are that the Chimera script could stay the same and only a new attribute definition file made for each structure, and that a user could later decide to use a different coloring scheme for the attribute. Both the normalized score attribute and the 1-9 category score could be assigned in the same file. I can provide more details on any of these if you would like. Sorry about the length of the previous mail - I was trying to cover all the possibilities since I wasn't sure what you wanted! Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html

If the conservation scores are already in the b-factor field of the PDB, then you can skip the defattr part and use commands like: color red @/bfactor>3.0 & @/bfactor<=4.0 to color atoms. --Eric On Apr 17, 2008, at 11:14 AM, Elaine Meng wrote:
Hi Fabian, I had failed to notice you are one of the ConSurf developers, so my reply focused more on what an outside user could do. However, if you are thinking of providing Chimera scripts from the server, that would be great!!
If so, you probably do want discontinuous coloring with exactly the same colors and sets of residues, so that all the graphics programs would show the same thing.
Thus the Chimera script should contain "colordef" to define the colors and "color" to apply them to the residues. There are different possibilities for specifying the residues in the color command, however.
(a) simply specify the residues by their residue numbers, like in the Consurf rasmol scripts
(b) use "alias" to name sets of residues and then specify the residues by the alias string
(c) make an attribute definition file (this file is read using the command "defattr") and then specify residues by attribute value. Disadvantage is an extra file. Advantages are that the Chimera script could stay the same and only a new attribute definition file made for each structure, and that a user could later decide to use a different coloring scheme for the attribute. Both the normalized score attribute and the 1-9 category score could be assigned in the same file.
I can provide more details on any of these if you would like. Sorry about the length of the previous mail - I was trying to cover all the possibilities since I wasn't sure what you wanted! Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

Dear Elaine, This is very very useful and infomative, I meant indeed to use the exact discontinued color-coding to write a script and offer it to ConSurf users as an alternative to create high quality pictures. Thanks a lot! Fabian On 17/04/2008, Elaine Meng <meng@cgl.ucsf.edu> wrote:
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!
ATTRIBUTES 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 automatic. http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/defineattrib/define... http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/multalignviewer/mul...
COLORING 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). http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/render/render.html#... http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/rangecolor.html
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 "rangecolor."
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. http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/defineattrib/define...
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 ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
-- ___________________________________ Fabian Glaser, PhD Bioinformatics Knowledge Unit, The Lorry I. Lokey Interdisciplinary Center for Life Sciences and Engineering Technion - Israel Institute of Technology Haifa 32000, ISRAEL E-mail: fglaser@tx.technion.ac.il Tel: +972-4-829-3701 Cell: +972-52-2357731
participants (4)
-
Elaine Meng
-
Eric Pettersen
-
Fabian Glaser
-
Fabian Gmail