Script to color zone a map according to the underlying model

Dear All, As an exercise in scripting, I am trying to write a script to imitate the appearance a published figure (from Toropova et al 2017). I would like to display a semi-transparent map which has been color zoned to match the underlying model in surface view. ChimeraX does everything in the script apart from the last two commands, in which I color zone the map, and then make it transparent. I don't get any errors in the log to give me a clue what to change. If I omit these last two commands from the script and then make them manually from the command line after the script is finished, it works. Is there something I can change that would allow me to include the final two commands in the script? Any pointers would be much appreciated. # ChimeraX script to imitate dynein 2 tail Toropova et al 2017 figure style # Adds custom colours to the ChimeraX session # Open model and set camera view and model rotation open 6RLB windowsize 775 775 view matrix camera -0.30533,0.56038,0.76991,623.53,0.82837,-0.24247,0.50499,467.83,0.46967,0.79195,-0.39016,-7.3434 models #1,1,0,0,0,0,1,0,0,0,0,1,0 # Work with model representation surface #1 set bgColor white lighting soft graphics silhouettes true # Define custom colours color name midblue #6b80b5 color name midgreen #a0c497 color name midyellow #f9ef87 color name midtomato #f97054 color name midmagenta #a4449b # Recolour model using custom colours defined above select #1/A; color sel midblue select #1/B; color sel skyblue select #1/C; color sel midtomato select #1/D; color sel midmagenta select #1/E/F; color sel midgreen select #1/G/H; color sel lightpink select #1/I-N; color sel midyellow select clear # Open map and modify color and transparency open emdb:4918 volume #2 step 1 volume #2 level 0.0172 surface dust #2 size 10 color zone #2 near #1 distance 15 volume #2 transparency 0.75 Best wishes, Caroline

Try adding the line: wait ... before those two commands. That will tell ChimeraX to draw a frame and do all the associated processing before moving on. On 2020-05-07 13:52, Caroline Stone wrote:
Dear All,
As an exercise in scripting, I am trying to write a script to imitate the appearance a published figure (from Toropova et al 2017). I would like to display a semi-transparent map which has been color zoned to match the underlying model in surface view.
ChimeraX does everything in the script apart from the last two commands, in which I color zone the map, and then make it transparent. I don't get any errors in the log to give me a clue what to change. If I omit these last two commands from the script and then make them manually from the command line after the script is finished, it works. Is there something I can change that would allow me to include the final two commands in the script? Any pointers would be much appreciated.
# ChimeraX script to imitate dynein 2 tail Toropova et al 2017 figure style # Adds custom colours to the ChimeraX session
# Open model and set camera view and model rotation open 6RLB windowsize 775 775 view matrix camera -0.30533,0.56038,0.76991,623.53,0.82837,-0.24247,0.50499,467.83,0.46967,0.79195,-0.39016,-7.3434 models #1,1,0,0,0,0,1,0,0,0,0,1,0
# Work with model representation surface #1 set bgColor white lighting soft graphics silhouettes true
# Define custom colours color name midblue #6b80b5 color name midgreen #a0c497 color name midyellow #f9ef87 color name midtomato #f97054 color name midmagenta #a4449b
# Recolour model using custom colours defined above select #1/A; color sel midblue select #1/B; color sel skyblue select #1/C; color sel midtomato select #1/D; color sel midmagenta select #1/E/F; color sel midgreen select #1/G/H; color sel lightpink select #1/I-N; color sel midyellow select clear
# Open map and modify color and transparency open emdb:4918 volume #2 step 1 volume #2 level 0.0172 surface dust #2 size 10 color zone #2 near #1 distance 15 volume #2 transparency 0.75
Best wishes, Caroline
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Caroline, Tristan is right, although I think the command may need to be "wait 1" which means draw one frame. (The wait command without arguments waits until ongoing motions complete and I'm not sure if it draws a frame when there are no ongoing motions.) The reason you need to draw a frame is because the volume surface for your new threshold level is not calculated until a frame is drawn. In a script graphics are not normally drawn until the end unless the wait command is used. We saw this problem before and I put in a fix where volume surfaces are recomputed when the level changes when running a script. So your script should work without any changes in the current ChimeraX daily build. That fix was made April 7, so I guess you are using a ChimeraX older than that. I'd suggest updating ChimeraX instead of adding "wait 1" to your script. Tom
On May 7, 2020, at 6:02 AM, Tristan Croll <tic20@cam.ac.uk> wrote:
Try adding the line:
wait
... before those two commands. That will tell ChimeraX to draw a frame and do all the associated processing before moving on.
On 2020-05-07 13:52, Caroline Stone wrote:
Dear All,
As an exercise in scripting, I am trying to write a script to imitate the appearance a published figure (from Toropova et al 2017). I would like to display a semi-transparent map which has been color zoned to match the underlying model in surface view.
ChimeraX does everything in the script apart from the last two commands, in which I color zone the map, and then make it transparent. I don't get any errors in the log to give me a clue what to change. If I omit these last two commands from the script and then make them manually from the command line after the script is finished, it works. Is there something I can change that would allow me to include the final two commands in the script? Any pointers would be much appreciated.
# ChimeraX script to imitate dynein 2 tail Toropova et al 2017 figure style # Adds custom colours to the ChimeraX session
# Open model and set camera view and model rotation open 6RLB windowsize 775 775 view matrix camera -0.30533,0.56038,0.76991,623.53,0.82837,-0.24247,0.50499,467.83,0.46967,0.79195,-0.39016,-7.3434 models #1,1,0,0,0,0,1,0,0,0,0,1,0
# Work with model representation surface #1 set bgColor white lighting soft graphics silhouettes true
# Define custom colours color name midblue #6b80b5 color name midgreen #a0c497 color name midyellow #f9ef87 color name midtomato #f97054 color name midmagenta #a4449b
# Recolour model using custom colours defined above select #1/A; color sel midblue select #1/B; color sel skyblue select #1/C; color sel midtomato select #1/D; color sel midmagenta select #1/E/F; color sel midgreen select #1/G/H; color sel lightpink select #1/I-N; color sel midyellow select clear
# Open map and modify color and transparency open emdb:4918 volume #2 step 1 volume #2 level 0.0172 surface dust #2 size 10 color zone #2 near #1 distance 15 volume #2 transparency 0.75
Best wishes, Caroline
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu <mailto:ChimeraX-users@cgl.ucsf.edu> Manage subscription: http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Tom, That is interesting, I see what you mean. I'll go ahead and update my installation. Thanks for the explaination! Best wishes, Caroline On 07/05/2020 17:18, Tom Goddard wrote:
Hi Caroline,
Tristan is right, although I think the command may need to be "wait 1" which means draw one frame. (The wait command without arguments waits until ongoing motions complete and I'm not sure if it draws a frame when there are no ongoing motions.) The reason you need to draw a frame is because the volume surface for your new threshold level is not calculated until a frame is drawn. In a script graphics are not normally drawn until the end unless the wait command is used.
We saw this problem before and I put in a fix where volume surfaces are recomputed when the level changes when running a script. So your script should work without any changes in the current ChimeraX daily build. That fix was made April 7, so I guess you are using a ChimeraX older than that. I'd suggest updating ChimeraX instead of adding "wait 1" to your script.
Tom
On May 7, 2020, at 6:02 AM, Tristan Croll <tic20@cam.ac.uk <mailto:tic20@cam.ac.uk>> wrote:
Try adding the line:
wait
... before those two commands. That will tell ChimeraX to draw a frame and do all the associated processing before moving on.
On 2020-05-07 13:52, Caroline Stone wrote:
Dear All,
As an exercise in scripting, I am trying to write a script to imitate the appearance a published figure (from Toropova et al 2017). I would like to display a semi-transparent map which has been color zoned to match the underlying model in surface view.
ChimeraX does everything in the script apart from the last two commands, in which I color zone the map, and then make it transparent. I don't get any errors in the log to give me a clue what to change. If I omit these last two commands from the script and then make them manually from the command line after the script is finished, it works. Is there something I can change that would allow me to include the final two commands in the script? Any pointers would be much appreciated.
# ChimeraX script to imitate dynein 2 tail Toropova et al 2017 figure style # Adds custom colours to the ChimeraX session
# Open model and set camera view and model rotation open 6RLB windowsize 775 775 view matrix camera -0.30533,0.56038,0.76991,623.53,0.82837,-0.24247,0.50499,467.83,0.46967,0.79195,-0.39016,-7.3434 models #1,1,0,0,0,0,1,0,0,0,0,1,0
# Work with model representation surface #1 set bgColor white lighting soft graphics silhouettes true
# Define custom colours color name midblue #6b80b5 color name midgreen #a0c497 color name midyellow #f9ef87 color name midtomato #f97054 color name midmagenta #a4449b
# Recolour model using custom colours defined above select #1/A; color sel midblue select #1/B; color sel skyblue select #1/C; color sel midtomato select #1/D; color sel midmagenta select #1/E/F; color sel midgreen select #1/G/H; color sel lightpink select #1/I-N; color sel midyellow select clear
# Open map and modify color and transparency open emdb:4918 volume #2 step 1 volume #2 level 0.0172 surface dust #2 size 10 color zone #2 near #1 distance 15 volume #2 transparency 0.75
Best wishes, Caroline
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu <mailto:ChimeraX-users@cgl.ucsf.edu> Manage subscription: http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu <mailto:ChimeraX-users@cgl.ucsf.edu> Manage subscription: http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
participants (3)
-
Caroline Stone
-
Tom Goddard
-
Tristan Croll