[chimerax-users] color palette in transprency ?
Elaine Meng
meng at cgl.ucsf.edu
Fri Jan 20 08:52:08 PST 2023
Hi Vincent,
My first thought was simply to define the palette with transparent colors. However, to my surprise, this does not work (transparency in the palette is ignored)...
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/color.html#sequential>
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/color.html#palette-options>
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/colornames.html>
For example, to rainbow chains from opaque cyan to 80% transparent blue, I tried:
open 4hhb
rainbow chains palette rgba(0.0,1.0,1.0,1.0):rgba(0.0,0.0,1.0,0.2)
...but this ignores the "alpha" value (1-transparency).
The long way is instead to use a series of "transparency" commands, one for each structure. This will preserve their existing colors, just change their transparency, e.g.:
transparency #2 80 target ars
("ars" means atoms, ribbons, surface... if you don't include that, default is surface only)
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/transparency.html>
HOWEVER, the "perframe" command provides a sneaky way to loop and put the multiple transparency settings in a single command, e.g.
open 1plx
tile
style sphere
perframe 'transparency #1.$1 $2 target ars' range 1,80 range 0,80 frames 80
In this perframe command, the first range substitutes $1, so it goes from 1plx model #1.1 to #1.80, and the second range substitutes the transparency value from 0 to 80%. Fancy! But it takes some thought and usually some trial and error to fabricate the correct "perframe" command. See the help:
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/perframe.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 20, 2023, at 2:53 AM, vincent Chaptal via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi,
>
> I'm rendering a series of models using this command line (which works very well):
>
> rainbow #1 structures palette cyan:blue
>
> I would like to do the same but in a series of transparent models, with a range from 0 to 80 (or similar).
>
> Is there a command for this, I couldn't find it?
> Thanks a lot.
> Vincent
More information about the ChimeraX-users
mailing list