[Chimera-users] labeling residues

Elaine Meng meng at cgl.ucsf.edu
Mon May 16 09:55:06 PDT 2011

Hi Dan,
You'd probably also want to undisplay atoms/bonds, so something like

~disp; ribbon; ribsc licorice

(A) label positioning.  You could either use residue labels with "primary atom" positioning or atom labels at CA showing residue info, i.e. :

rlabel; setattr m residueLabelPos 2
- OR -
disp @ca; labelopt info residue; la @ca

(the balloon help on the attributes panel gives the attribute name and its allowed values for use with "setattr," and "m" indicates it is an attribute of molecule models). Even though you might expect "centroid" residue label positioning to be the same as "primary atom" when only the CA is displayed, it is different because the latter includes an offset.

(B) custom label content.  I don't think it can be done with Chimera commands, but the Chimera command file could open a python snippet.  Somebody else would need to give the exact code for what you describe, but this previous message gives something similar for custom residue labeling:

(C) color ribbon near CA.  I believe you can only color the segment representing the whole residue.  I don't think there is any way to color a shorter segment of ribbon than that.  An alternative, however, is to abandon ribbons entirely and make a tubular surface that follows the path of the backbone instead.  This allows coloring a narrow band of tube and has the added advantage of following the true locations of the atoms instead of making a smooth interpolation like the ribbon.  More details here:

... but briefly, something like:

~ribbon; rainbow
shape tube :.a at ca radius 0.35 bandLength 2 modelId 1

... where I just used rainbow to color the invisible alpha-carbons so you can see the colored bands on the resulting tube.  The above only makes a tube for chain a (:.a).  If there are multiple chains, you'd want to do them separately, or else the tube would connect the end of one to the beginning of the next.  modelId is the model number for the resulting output surface.

To label alpha-carbons, you would need to display them along with the tube but turn off auto-chaining so that Chimera won't draw straight lines between them:

disp @ca; setattr m autochain 0

So, if you went with the tube approach your overall script could be something like

open 4hhb
~ribbon; show @ca; setattr m autochain 0
rlabel; setattr m residueLabelPos 2
# open python file for custom labeling, not incl here
# color alpha-carbons as you like:
shape tube :.a at ca radius 0.35 bandLength 2 modelId 1
shape tube :.b at ca radius 0.35 bandLength 2 modelId 2
shape tube :.c at ca radius 0.35 bandLength 2 modelId 3
shape tube :.d at ca radius 0.35 bandLength 2 modelId 4

Image attached.  You may want to take a look at the tube options and try different values:


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tube.png
Type: image/png
Size: 62031 bytes
Desc: not available
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20110516/3be7e6c9/attachment.png>
-------------- next part --------------

On May 15, 2011, at 10:56 AM, Daniel Gurnon wrote:

> Hi all,
> A student of mine wants to make a wire sculpture of a protein, and I'm thinking of ways Chimera could make the task easier. Ideally, I would create a script that would display any protein in wire-form, with residue positions clearly and unobtrusively labeled. 
> I'd like to use the command line to display a backbone as a licorice ribbon with residue numbers and 1-letter codes at the alpha carbon of each residue.
> so starting out, I would use:
> ribscale licorice; ribbackbone; rlabel @ca;
> But instead of "ALA 24.B", I want "A 24". Though I can get what I want using the Actions menu, I can't find a way to create custom rlabels via the command line. Is there a way to do this? 
> If possible, I would also like to position each label near the spot on the ribbon closest to the alpha carbon (the "primary atom"). I can see how to do this with the molecule attributes panel, but I'm having difficulty setting the placement through the command line.
> And while I'm at it...is there a way to color a spot on the ribbon closest to the alpha carbon a different color than the rest of the ribbon?
> Thanks for the help!
> Dan

More information about the Chimera-users mailing list