[Chimera-users] labeling residues
Elaine Meng
meng at cgl.ucsf.edu
Mon May 16 14:34:02 PDT 2011
Hi Dan,
Python isn't absolutely necessary for #2 - you only need give a separate "shape tube" command for each chain, as in the example in my previous message for chains A-D of the hemoglobin structure 4hhb. However, python would be required to handle the general case where you don't have prior knowledge of the number of chains and whether they are even proteins, i.e., to loop through all protein chains and make a separate tube for each. Alternatively you could just have one command that makes the tube for chain A only and assumes it is protein.
In general you can make a Chimera command alias that will then appear in a top-level Aliases menu. Multiple commands can be combined into a single alias with semicolons. However, aliases are comprised of Chimera commands, not python, and they are stored in preferences, so you'd have to supply the students with a pre-existing preferences file if you were to use this approach.
<http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/alias.html>
Small example:
alias ^doit ~disp;ribbon;ribsc licorice;rainbow;set bg_color tan
...then execute it by choosing menu item: Aliases... doit
The programmers on the team may be able to help with the python for custom labeling and looping through all chains of a structure, and once you have a python script that handles a sufficiently broad set of structures, how to buttonize it. Alternatively, you could give the students the script and tell them to open it (FIle... Open) in Chimera, but I agree that's not as friendly. Steps for which you already know the Chimera commands can be translated to Python using runCommand as described here:
<http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html#q2>
There is a big deadline today, so please bear with us if there is some lag before additional replies. Best,
Elaine
----------
Elaine C. Meng, Ph.D.
UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab
Department of Pharmaceutical Chemistry
University of California, San Francisco
On May 16, 2011, at 10:49 AM, Daniel Gurnon wrote:
> Elaine, this is very close to what I'm looking for (I hadn't heard of "shape tube", but its perfect for what I want to do).
>
> As I understand it, if the script is to work with any pdb structure, I will need two segments of python code:
>
> 1) custom residue labeling to display only 1-letter code and number, and
> 2) something that creates a separate tube for each chain in a model, without connecting one tube to the next.
>
> I would love to wrap this into a button (e.g., http://www.cgl.ucsf.edu/chimera/1.4/docs/ProgrammersGuide/Examples/Main_ToolbarButton.html) that a student could push once he or she has loaded a structure. If its easy to do and someone else could give me the python snippet for 1) and 2) above, that would be great.
>
> Thanks as always for the help.
> Dan
>
> On Mon, May 16, 2011 at 12:55 PM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
> 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:
> <http://plato.cgl.ucsf.edu/pipermail/chimera-users/2010-October/005622.html>
>
> (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:
> <http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/ribbonstyle/ribbonstyle.html#offset>
>
> ... 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:
> rainbow
> 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:
>
> <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/shape.html>
> <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/shape.html#tube>
>
> I hope this helps,
> Elaine
>
> 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