[Chimera-users] Command-line equivalents of interative action

Elaine Meng meng at cgl.ucsf.edu
Thu Jul 13 09:33:41 PDT 2017

Hi Joe,
Glad you like the color-by-conservation tutorial!

Assuming that the structure associates with the alignment automatically, you can do all of this with Chimera commands, except worms, for which there is no command.  Somebody else would have to weigh in on whether it would be feasible to render worms with a python script.

In the script, just open the structure and alignment with the “open” command and do the coloring with the “rangecolor” command, like the example shown in the tutorial.  As in the Render by Attribute dialog, you are not limited to the built-in color palettes.  In the GUI you can click the color well and get the color editor and choose any color;  in the rangecolor command, you can specify any colors, whether built-in or custom-defined.

You can control the conservation method by setting your preferences beforehand, by opening some (any) sequence alignment, and in the Multalign Viewer (sequence window) menu: Preferences… Headers, then choosing the desired settings. If AL2CO, “gap fraction” is the maximum fraction of sequences with gaps in a column for conservation to still be calculated; for example, if the gap fraction is 0.25, conservation values will only be calculated for columns in which at least three-fourths of the sequences have residues (hence the “novalue” coloring in the rangecolor command below, for residues that don’t have a conservation value).  Also use Multalign Viewer menu Headers to ensure the Conservation line is shown, if it isn’t already.  I believe all of that is automatically saved for the next time you open an alignment.

Potential issues:
- does the structure associate automatically with the sequence?  you may be able to set laxer criteria if needed in the Multalign Viewer preferences, Structure section
- the potential ranges of conservation values could vary depending on the measure and alignments you use, so think about whether you would always want a specific color to go with a  specific conservation value, or just anchor the coloring to “min” “mid” “max” .  Try a few examples manually and see the min/mid/max values reported in the Reply Log when you run rangecolor, to get a feel for the variability of the values obtained with your data.

Here are lines for an example command file, but reasonable possibilities are much broader. The # lines are comments.

# to specify conservation method, set Multalign Viewer header preferences beforehand
set bgcolor white
set silhouette
# define colors same as used in the Render tool's cyan-maroon palette
colordef maroon2 .62 .125 .37
colordef cyan2 .059 .78 .81
# open structure
open 1hd2
# show ribbons only (hide atoms)
# open sequence alignment
open ~/Desktop/peroxiredoxinSFLD.afa
# color by conservation
rangecolor mavConservation min cyan2 0 white max maroon2 novalue gray

Further notes:
- “copy” command to save image, “save” to save session, “close session” to close both the sequence alignment and structure

I hope this helps,
Elaine C. Meng, Ph.D. 
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jul 13, 2017, at 3:40 AM, Healey, Joe <J.R.J.Healey at warwick.ac.uk> wrote:
> Hi Chimera Team,
> I've been following this great tutorial:
> https://www.cgl.ucsf.edu/chimera/data/tutorials/systems/outline.html#case1
> To render a structure by conservation. I'd like to run this non-interactively for a number of proteins though. Could you tell me what the python or 'chimera code' equivalents would be?
> For instance, I would provide a structure (or structures in a session) and MSA in fasta format already, so without interactive menus I'd like to:
> 	• Open the structure(s) and MSA
> 	• get the conservation from MultAlign (the actual conservation metric doesn't particularly matter to me at the moment)
> 	• Render any open models by conservation, say using the cyan-maroon colour scale
> 	• Additionall depict as smooth worms with defined min and max radii
> If this is possible!
> Thanks!
> Joe

More information about the Chimera-users mailing list