[chimerax-users] Color Model by Another Model

Elaine Meng meng at cgl.ucsf.edu
Fri Jan 14 19:00:58 PST 2022


Hi Jacob,
Yes, the workflow is similar to what you described, although with some tricky details because there isn't a per-chain color attribute:

(1) report values of the "color" atom attribute or "ribbon_color" residue attribute of one model  with the "info" command, see:
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/info.html>

If you have ribbons colored the way you want in the first model, you could use  attribute "ribbon_color" and command "info residues" ... if you only have atoms but not ribbons colored the way you want, you could use attribute "color" and command "info atoms".  

The tricky part:
Either way it will be a lot of lines to scroll through in the Log if you simply report the values of ALL of the atoms or residues.  If you have some idea of how to specify a subset of the atoms that includes at least one atom per chain, then do that in the command.

For example, if every chain of the model #1 whose colors you want to copy has a residue 10 with atom CA, you could use command:

info atoms #1:10 at ca attribute color

For example structure 4hhb with four chains, that gives something like this in the Log:
atom id /A:10 at CA color 0,0,255,255
atom id /B:10 at CA color 0,255,170,255
atom id /C:10 at CA color 170,255,0,255
atom id /D:10 at CA color 255,0,0,255

(2) use "color" command to apply those colors.  I can see that they are given in the Log as  R,G,B,A format on the scale of 0-255.  To apply them to model #2 you could use  commands:

color #2/A rgba(0,0,255,255)
color #2/B rgba(0,255,170,255)
[...etc...]

see "color" command
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/color.html#simple>

...and how to specify colors in command line
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/colornames.html>

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

> On Jan 14, 2022, at 5:57 PM, Anderson, Jacob via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> I have a use case where I would like to color chains of model X by the chains of model Y (they are duplicates). What might be the best way to do this?
> 
> For example, I thought there may be a way to run something like: "info colors #1 byChain" to get the colors of all chains printed to the log like "#1/A blue, #1/B red . . .". Then one could easily change #1 to #2 with sed in a text editor.  Does a tool like that exist in ChimeraX? Or has might anyone have tips for coloring a model's chain by another models chains?
> 
> jacob




More information about the ChimeraX-users mailing list