Using ChimeraX in no-gui mode

Dear Chimera users! Would be possible to use new ChimeraX for execution of some simple scripts for structure visualisation and imaging via no-gui mode? I am using bash script to loop over pdbs and would like to 1) open each pdb which contains b-factors info in chimeraX 2) apply preset publication 3) colour the pdb using "color byattribute bfactor palette rainbow ave residue" 4) save high quality image at the selected directory using chimera render Would it be possible to do these things directly from linux terminal providing each time pdb and some script file with the list of the applied commands? chimerax-daily ${pdb} ${script} Thank you in advance!

Here is some update! :-) following tutorials found on the web, I have made a test.cxc file with all of the commands: # chimeraX script for B-factor coloring and saving of the image windowsize 800 600 open ./test.pdb view; zoom 1.0; turn x 90; turn z -80; preset 'overall look' publication color byattribute bfactor palette rainbow range 2,100 # make info 2dlab create title text "B-factors for" xpos .04 ypos .93 size 30 # options for light light depthcuestart .4 depthcueend .8; lighting full save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false exit Briefly it looks fine being executing in GUI interphace hovewer in the precence of --nogui i got the following error during image rendering: chimerax-daily --nogui test.cxc Executing: save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false Traceback (most recent call last): File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/ChimeraX_main.py", line 699, in init commands.run(sess, 'open %s' % arg) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 41, in open from_database=from_database, ignore_cache=ignore_cache, **kw)) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 117, in open models = handle_unknown_kw(session.models.open, paths, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 62, in handle_unknown_kw return f(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/models.py", line 601, in open session, filenames, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 467, in open_multiple_data models, status = open_data(session, fspec, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 421, in open_data models, status = open_func(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/scripting.py", line 115, in open_command_script run(session, text) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/save.py", line 61, in save fmt.export(session, filename, fmt.nicknames[0], **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 203, in export result = self.export_func(session, path, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/image.py", line 43, in save_image raise LimitationError("Unable to render images to save them") chimerax.core.errors.LimitationError: Unable to render images to save them is it a bug? пн, 15 апр. 2019 г. в 11:14, James Starlight <jmsstarlight@gmail.com>:
Dear Chimera users!
Would be possible to use new ChimeraX for execution of some simple scripts for structure visualisation and imaging via no-gui mode?
I am using bash script to loop over pdbs and would like to
1) open each pdb which contains b-factors info in chimeraX 2) apply preset publication 3) colour the pdb using "color byattribute bfactor palette rainbow ave residue" 4) save high quality image at the selected directory using chimera render
Would it be possible to do these things directly from linux terminal providing each time pdb and some script file with the list of the applied commands?
chimerax-daily ${pdb} ${script}
Thank you in advance!

P.S. just forgot also to ask - how it would be possible to place bar diagram to range b-factors colouring gradient in the manner of the "key" option in the previous version of chimera? пн, 15 апр. 2019 г. в 18:41, James Starlight <jmsstarlight@gmail.com>:
Here is some update! :-)
following tutorials found on the web, I have made a test.cxc file with all of the commands:
# chimeraX script for B-factor coloring and saving of the image windowsize 800 600 open ./test.pdb view; zoom 1.0; turn x 90; turn z -80;
preset 'overall look' publication color byattribute bfactor palette rainbow range 2,100
# make info 2dlab create title text "B-factors for" xpos .04 ypos .93 size 30 # options for light light depthcuestart .4 depthcueend .8; lighting full
save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false exit
Briefly it looks fine being executing in GUI interphace hovewer in the precence of --nogui i got the following error during image rendering: chimerax-daily --nogui test.cxc Executing: save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false Traceback (most recent call last): File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/ChimeraX_main.py", line 699, in init commands.run(sess, 'open %s' % arg) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 41, in open from_database=from_database, ignore_cache=ignore_cache, **kw)) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 117, in open models = handle_unknown_kw(session.models.open, paths, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 62, in handle_unknown_kw return f(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/models.py", line 601, in open session, filenames, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 467, in open_multiple_data models, status = open_data(session, fspec, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 421, in open_data models, status = open_func(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/scripting.py", line 115, in open_command_script run(session, text) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/save.py", line 61, in save fmt.export(session, filename, fmt.nicknames[0], **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 203, in export result = self.export_func(session, path, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/image.py", line 43, in save_image raise LimitationError("Unable to render images to save them") chimerax.core.errors.LimitationError: Unable to render images to save them
is it a bug?
пн, 15 апр. 2019 г. в 11:14, James Starlight <jmsstarlight@gmail.com>:
Dear Chimera users!
Would be possible to use new ChimeraX for execution of some simple scripts for structure visualisation and imaging via no-gui mode?
I am using bash script to loop over pdbs and would like to
1) open each pdb which contains b-factors info in chimeraX 2) apply preset publication 3) colour the pdb using "color byattribute bfactor palette rainbow ave residue" 4) save high quality image at the selected directory using chimera render
Would it be possible to do these things directly from linux terminal providing each time pdb and some script file with the list of the applied commands?
chimerax-daily ${pdb} ${script}
Thank you in advance!

Hi James, ChimeraX does not have the ability to make a color key yet. if you are using the “composite” approach you mentioned before, <http://plato.cgl.ucsf.edu/pipermail/chimera-users/2019-March/015590.html> ...you could make the color key image in Chimera and composite it with the molecule images from ChimeraX. Elaine
On Apr 15, 2019, at 9:51 AM, James Starlight <jmsstarlight@gmail.com> wrote:
P.S. just forgot also to ask - how it would be possible to place bar diagram to range b-factors colouring gradient in the manner of the "key" option in the previous version of chimera?
пн

Thank you so much Elaine! I have some problems both with --nogui and --offscreen options with the python error message. I will now copy it to the ChimeraX mailing list. Just one question: assuming that in ChimeraX I color the structure according to B-factors using color byattribute bfactor palette rainbow range 2,100 what gradient colouring I should use in Chimera to obtain the "bar plot" with the rangecolor bfactor ? Thank youin advance! пн, 15 апр. 2019 г. в 23:31, Elaine Meng <meng@cgl.ucsf.edu>:
Hi James, ChimeraX does not have the ability to make a color key yet. if you are using the “composite” approach you mentioned before,
<http://plato.cgl.ucsf.edu/pipermail/chimera-users/2019-March/015590.html>
...you could make the color key image in Chimera and composite it with the molecule images from ChimeraX. Elaine
On Apr 15, 2019, at 9:51 AM, James Starlight <jmsstarlight@gmail.com> wrote:
P.S. just forgot also to ask - how it would be possible to place bar diagram to range b-factors colouring gradient in the manner of the "key" option in the previous version of chimera?
пн

In Chimera start Color Key (menu: Tools… Utilities… Color Key) and change number of colors to 5 and make them the same as what is in the Rainbow tool (Menu: Tools.. Depiction… Rainbow). E.g. you can click on the color square in Rainbow and drag over to release on the color square in Color Key to make them the same. I see that currently there is a minor bug in the Rainbow tool that the green is the darker CSS “green" and not standard bright green (CSS name “lime green”). So you should change the green square to lime green, for example by clicking its border to open the Color Editor and entering “lime green” for the Color name. I will make a bug report for this issue. Elaine
On Apr 16, 2019, at 1:27 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Thank you so much Elaine! I have some problems both with --nogui and --offscreen options with the python error message. I will now copy it to the ChimeraX mailing list.
Just one question: assuming that in ChimeraX I color the structure according to B-factors using color byattribute bfactor palette rainbow range 2,100
what gradient colouring I should use in Chimera to obtain the "bar plot" with the rangecolor bfactor ?
Thank youin advance!
пн, 15 апр. 2019 г. в 23:31, Elaine Meng <meng@cgl.ucsf.edu>:
Hi James, ChimeraX does not have the ability to make a color key yet. if you are using the “composite” approach you mentioned before,
<http://plato.cgl.ucsf.edu/pipermail/chimera-users/2019-March/015590.html>
...you could make the color key image in Chimera and composite it with the molecule images from ChimeraX. Elaine
On Apr 15, 2019, at 9:51 AM, James Starlight <jmsstarlight@gmail.com> wrote:
P.S. just forgot also to ask - how it would be possible to place bar diagram to range b-factors colouring gradient in the manner of the "key" option in the previous version of chimera?
пн
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thank you so much, Elaine! This aproach works very good with ChimeraX also! вт, 16 апр. 2019 г. в 18:26, Elaine Meng <meng@cgl.ucsf.edu>:
In Chimera start Color Key (menu: Tools… Utilities… Color Key) and change number of colors to 5 and make them the same as what is in the Rainbow tool (Menu: Tools.. Depiction… Rainbow). E.g. you can click on the color square in Rainbow and drag over to release on the color square in Color Key to make them the same.
I see that currently there is a minor bug in the Rainbow tool that the green is the darker CSS “green" and not standard bright green (CSS name “lime green”). So you should change the green square to lime green, for example by clicking its border to open the Color Editor and entering “lime green” for the Color name. I will make a bug report for this issue.
Elaine
On Apr 16, 2019, at 1:27 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Thank you so much Elaine! I have some problems both with --nogui and --offscreen options with the python error message. I will now copy it to the ChimeraX mailing list.
Just one question: assuming that in ChimeraX I color the structure according to B-factors using color byattribute bfactor palette rainbow range 2,100
what gradient colouring I should use in Chimera to obtain the "bar plot" with the rangecolor bfactor ?
Thank youin advance!
пн, 15 апр. 2019 г. в 23:31, Elaine Meng <meng@cgl.ucsf.edu>:
Hi James, ChimeraX does not have the ability to make a color key yet. if you are using the “composite” approach you mentioned before,
<http://plato.cgl.ucsf.edu/pipermail/chimera-users/2019-March/015590.html>
...you could make the color key image in Chimera and composite it with the molecule images from ChimeraX. Elaine
On Apr 15, 2019, at 9:51 AM, James Starlight <jmsstarlight@gmail.com> wrote:
P.S. just forgot also to ask - how it would be possible to place bar diagram to range b-factors colouring gradient in the manner of the "key" option in the previous version of chimera?
пн
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Hi James, As mentioned in my previous message <http://plato.cgl.ucsf.edu/pipermail/chimera-users/2019-April/015686.html> ...you have to use the “offscreen” option together with “nogui” (and linux) if you want to save images. <http://rbvi.ucsf.edu/chimerax/docs/user/options.html> Elaine
On Apr 15, 2019, at 9:41 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Here is some update! :-)
following tutorials found on the web, I have made a test.cxc file with all of the commands:
# chimeraX script for B-factor coloring and saving of the image windowsize 800 600 open ./test.pdb view; zoom 1.0; turn x 90; turn z -80;
preset 'overall look' publication color byattribute bfactor palette rainbow range 2,100
# make info 2dlab create title text "B-factors for" xpos .04 ypos .93 size 30 # options for light light depthcuestart .4 depthcueend .8; lighting full
save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false exit
Briefly it looks fine being executing in GUI interphace hovewer in the precence of --nogui i got the following error during image rendering: chimerax-daily --nogui test.cxc Executing: save image ./test.png format png width 800 height 600 supersample 4 transparentBackground false Traceback (most recent call last): File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/ChimeraX_main.py", line 699, in init commands.run(sess, 'open %s' % arg) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 41, in open from_database=from_database, ignore_cache=ignore_cache, **kw)) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 117, in open models = handle_unknown_kw(session.models.open, paths, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 62, in handle_unknown_kw return f(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/models.py", line 601, in open session, filenames, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 467, in open_multiple_data models, status = open_data(session, fspec, format=format, name=name, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 421, in open_data models, status = open_func(*args, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/scripting.py", line 115, in open_command_script run(session, text) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/commands/save.py", line 61, in save fmt.export(session, filename, fmt.nicknames[0], **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/io.py", line 203, in export result = self.export_func(session, path, **kw) File "/usr/lib/ucsf-chimerax-daily/lib/python3.7/site-packages/chimerax/core/image.py", line 43, in save_image raise LimitationError("Unable to render images to save them") chimerax.core.errors.LimitationError: Unable to render images to save them
is it a bug?

Hi James, There is a different email address for asking ChimeraX questions (CC’d here). Yes, you can script imaging in ChimeraX with nogui if you are using Linux and start with the “nogui” and “offscreen” options on the system command line (they have dash-dash in front but my Mail keeps editing it to a long hyphen instead). <http://rbvi.ucsf.edu/chimerax/docs/user/options.html> In ChimeraX the command script filenames end in .cxc <http://rbvi.ucsf.edu/chimerax/docs/user/commands/usageconventions.html#cxc-files> The commands may be different than in Chimera. Open is with “open” save is with “save” and there is no publication preset but you can change to white background and show silhouettes with the “set” command. See the individual command help pages <http://rbvi.ucsf.edu/chimerax/docs/user/index.html#commands> making images <http://rbvi.ucsf.edu/chimerax/docs/user/images.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 Apr 15, 2019, at 2:14 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera users!
Would be possible to use new ChimeraX for execution of some simple scripts for structure visualisation and imaging via no-gui mode?
I am using bash script to loop over pdbs and would like to
1) open each pdb which contains b-factors info in chimeraX 2) apply preset publication 3) colour the pdb using "color byattribute bfactor palette rainbow ave residue" 4) save high quality image at the selected directory using chimera render
Would it be possible to do these things directly from linux terminal providing each time pdb and some script file with the list of the applied commands?
chimerax-daily ${pdb} ${script}
Thank you in advance!
participants (2)
-
Elaine Meng
-
James Starlight