[chimerax-users] color palette in transprency ?
Elaine Meng
meng at cgl.ucsf.edu
Tue Jan 24 08:32:52 PST 2023
Hi Vincent,
Before I sent the previous reply I tried the exact commands in this example and they worked... so I don't know why they would not work for you.
> open 1plx
> tile
> style sphere
> perframe 'transparency #1.$1 $2 target ars' range 1,80 range 0,80 frames 80
However, yesterday we fixed the "rainbow" command to use palette transparency, so now the other example (which didn't work before) will now work to include the transparency, if you download and use the newest daily build:
> open 4hhb
> rainbow chains palette rgba(0.0,1.0,1.0,1.0):rgba(0.0,0.0,1.0,0.2)
... or in your case, something like this if you wanted blue 90% transparent to 5% transparent (the alpha value is 1-transparency):
rainbow #1.1-18 structures palette rgba(0.0,0.0,1.0,0.1):rgba(0.0,0.0,1.0,0.95)
I tried it just now and it works.
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 24, 2023, at 1:07 AM, vincent Chaptal via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi Elaine,
>
> thank you for your help.
>
> Unfortunately, I wasn't able to get it to work, the command transparency asks for a value (percent) and doesn't recognize the $2 range as this value.
>
> I was able to get it to work with this instead:
> color #1 blue
> transparency #1.1 90 cartoon
> transparency #1.2 85 cartoon
> transparency #1.3 80 cartoon
> transparency #1.4 70 cartoon
> transparency #1.5 70 cartoon
> transparency #1.6 65 cartoon
> transparency #1.7 60 cartoon
> transparency #1.8 55 cartoon
> transparency #1.9 50 cartoon
> transparency #1.10 45 cartoon
> transparency #1.11 40 cartoon
> transparency #1.12 35 cartoon
> transparency #1.13 30 cartoon
> transparency #1.14 25 cartoon
> transparency #1.15 20 cartoon
> transparency #1.16 15 cartoon
> transparency #1.17 10 cartoon
> transparency #1.18 5 cartoon
> graphics silhouettes true
>
> Brute force but it works...
>
> Best
> Vincent
>
>
> Le 20/01/2023 à 17:52, Elaine Meng a écrit :
>> 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
>>>
>
> --
> Vincent Chaptal, PhD
> Director of GdR APPICOM
> Drug Resistance and Membrane Proteins Lab
>
> MMSB -UMR5086
> 7 passage du Vercors
> 69007 LYON
> FRANCE
> +33 4 37 65 29 01
> http://www.appicom.cnrs.fr
> http://mmsb.cnrs.fr/en/
More information about the ChimeraX-users
mailing list