
Dear Chimera Users! My simple bash script loops the folder with the pdbs and open it in Chimera for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI: 1- Apply "publications-2" preset 2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file 3- make a screen-shot of the colored cartoon figure in the selected output folder. I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell. James

Hi James, First, if you want to save images without showing the Chimera GUI then you have to use the “headless” version of Chimera, available on the download page. To do the other things you want, just put the equivalent commands in a file that ends in “.cmd” and just add that file to your invocation of Chimera, e.g.: chimera $pdb script.cmd The easiest way to handle the image file name is probably to used a fixed name in the Chimera “copy” command, and then in your bash script move that file to the final name you want. Also, "preset” is the command to apply presets — “help preset” in Chimera for more info. Hope this helps. —Eric Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2017, at 8:40 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera Users!
My simple bash script loops the folder with the pdbs and open it in Chimera
for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done
My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI:
1- Apply "publications-2" preset
2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file
3- make a screen-shot of the colored cartoon figure in the selected output folder.
I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell.
James _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thanks Eric! Everything works fine with the exception of the copy command. On the rendering stage I have: Opened AT1_dry_apo.1rep.step7_1.pdb containing 1 model, 57791 atoms, and 12661 residues Traceback (most recent call last): File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimeraInit.py", line 683, in init chimera.openModels.open(a, prefixableType=1) File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/__init__.py", line 1951, in open models = func(filename, *args, **kw) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/ChimeraExtension.py", line 31, in func processCommandFile(fileName) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 108, in processCommandFile _processFile(f, emulateRead, filename) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 143, in _processFile if makeCommand(line): File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 69, in makeCommand f(c, args) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 1786, in doRangeColor showKey=key) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/__init__.py", line 2526, in rangeColor from Ilabel.gui import IlabelDialog File "/home/gleb/.local/UCSF-Chimera64-batch/share/Ilabel/gui.py", line 13, in <module> from chimera import tkgui, chimage, CLOSE_SESSION File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl ImportError: No module named Togl Error while processing /home/gleb/Desktop/Scripts/MegaAnalysis/temp/script_AT1_dry_apo.1rep.step7_1.pdb.cmd: ImportError: No module named Togl File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl See reply log for Python traceback. I have found that it is due to some conflict in PYTHONPATH from my bash since I am running Chimera directly from BASH. The people also wrote that Its related to setting transparency- which was not a case there - I did not set in my script. Anyway how to fix it? Thanks you! James 2017-08-30 22:54 GMT+02:00 Eric Pettersen <pett@cgl.ucsf.edu>:
Hi James, First, if you want to save images without showing the Chimera GUI then you have to use the “headless” version of Chimera, available on the download page. To do the other things you want, just put the equivalent commands in a file that ends in “.cmd” and just add that file to your invocation of Chimera, e.g.:
chimera $pdb script.cmd
The easiest way to handle the image file name is probably to used a fixed name in the Chimera “copy” command, and then in your bash script move that file to the final name you want. Also, "preset” is the command to apply presets — “help preset” in Chimera for more info.
Hope this helps.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2017, at 8:40 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera Users!
My simple bash script loops the folder with the pdbs and open it in Chimera
for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done
My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI:
1- Apply "publications-2" preset
2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file
3- make a screen-shot of the colored cartoon figure in the selected output folder.
I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell.
James _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

You must have the given the "key" argument to the rangecolor command. That option tries to display the Color Key tool which want you to use the mouse to position the color key in the graphics window. That is not possible in batch mode. You'll need to add the color key afterwards with an image editor if you need it. HTH, Greg On 08/31/2017 01:00 AM, James Starlight wrote:
Thanks Eric!
Everything works fine with the exception of the copy command. On the rendering stage I have:
Opened AT1_dry_apo.1rep.step7_1.pdb containing 1 model, 57791 atoms, and 12661 residues Traceback (most recent call last): File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimeraInit.py", line 683, in init chimera.openModels.open(a, prefixableType=1) File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/__init__.py", line 1951, in open models = func(filename, *args, **kw) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/ChimeraExtension.py", line 31, in func processCommandFile(fileName) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 108, in processCommandFile _processFile(f, emulateRead, filename) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 143, in _processFile if makeCommand(line): File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 69, in makeCommand f(c, args) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 1786, in doRangeColor showKey=key) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/__init__.py", line 2526, in rangeColor from Ilabel.gui import IlabelDialog File "/home/gleb/.local/UCSF-Chimera64-batch/share/Ilabel/gui.py", line 13, in <module> from chimera import tkgui, chimage, CLOSE_SESSION File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl ImportError: No module named Togl
Error while processing /home/gleb/Desktop/Scripts/MegaAnalysis/temp/script_AT1_dry_apo.1rep.step7_1.pdb.cmd: ImportError: No module named Togl
File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl
See reply log for Python traceback.
I have found that it is due to some conflict in PYTHONPATH from my bash since I am running Chimera directly from BASH. The people also wrote that Its related to setting transparency- which was not a case there - I did not set in my script. Anyway how to fix it?
Thanks you!
James
2017-08-30 22:54 GMT+02:00 Eric Pettersen <pett@cgl.ucsf.edu>:
Hi James, First, if you want to save images without showing the Chimera GUI then you have to use the “headless” version of Chimera, available on the download page. To do the other things you want, just put the equivalent commands in a file that ends in “.cmd” and just add that file to your invocation of Chimera, e.g.:
chimera $pdb script.cmd
The easiest way to handle the image file name is probably to used a fixed name in the Chimera “copy” command, and then in your bash script move that file to the final name you want. Also, "preset” is the command to apply presets — “help preset” in Chimera for more info.
Hope this helps.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2017, at 8:40 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera Users!
My simple bash script loops the folder with the pdbs and open it in Chimera
for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done
My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI:
1- Apply "publications-2" preset
2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file
3- make a screen-shot of the colored cartoon figure in the selected output folder.
I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell.
James _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

now the errors of the execution of the script using headless chimera: Opening rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb... The following problems occurred while reading PDB file for rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb warning: Ignored bad PDB record found on line 2 Opened rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb containing 1 model, 903 atoms, and 301 residues Rendering high resolution image... ./run.sh: line 113: 14479 Segmentation fault (core dumped) chimera_batch $pdb "${temp}"/script_${name}.cmd the same with a pow-ray render Opened rmsf_visu_AT1_wat_Na.3rep.step7_1.pdb containing 1 model, 903 atoms, and 301 residues Generating POV-Ray data file Exporting POV-Ray data to /home/gleb/Desktop/Scripts/MegaAnalysis/output/plots/rmsf/rmsf_AT1_wat_Na.3rep.pov Ignoring CHIMERA environment variable Parse error at line 1: no element found here is my script: preset apply publication 2 rangecolor bfactor 2 blue 30 red 50 yellow copy file /home/gleb/Desktop/Scripts/MegaAnalysis/output/plots/rmsf/AT1_wat_apo.3rep.png png width 800 height 600 I have made the same images in chimera GUI and it worked very well. Is it possible to run same script using in chimera-gui but from batch mode? 2017-08-31 22:04 GMT+02:00 Greg Couch <gregc@cgl.ucsf.edu>:
You must have the given the "key" argument to the rangecolor command. That option tries to display the Color Key tool which want you to use the mouse to position the color key in the graphics window. That is not possible in batch mode. You'll need to add the color key afterwards with an image editor if you need it.
HTH,
Greg
On 08/31/2017 01:00 AM, James Starlight wrote:
Thanks Eric!
Everything works fine with the exception of the copy command. On the rendering stage I have:
Opened AT1_dry_apo.1rep.step7_1.pdb containing 1 model, 57791 atoms, and 12661 residues Traceback (most recent call last): File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimeraInit.py", line 683, in init chimera.openModels.open(a, prefixableType=1) File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/__init__.py", line 1951, in open models = func(filename, *args, **kw) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/ChimeraExtension.py", line 31, in func processCommandFile(fileName) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 108, in processCommandFile _processFile(f, emulateRead, filename) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 143, in _processFile if makeCommand(line): File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 69, in makeCommand f(c, args) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 1786, in doRangeColor showKey=key) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/__init__.py", line 2526, in rangeColor from Ilabel.gui import IlabelDialog File "/home/gleb/.local/UCSF-Chimera64-batch/share/Ilabel/gui.py", line 13, in <module> from chimera import tkgui, chimage, CLOSE_SESSION File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl ImportError: No module named Togl
Error while processing
/home/gleb/Desktop/Scripts/MegaAnalysis/temp/script_AT1_dry_apo.1rep.step7_1.pdb.cmd: ImportError: No module named Togl
File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl
See reply log for Python traceback.
I have found that it is due to some conflict in PYTHONPATH from my bash since I am running Chimera directly from BASH. The people also wrote that Its related to setting transparency- which was not a case there - I did not set in my script. Anyway how to fix it?
Thanks you!
James
2017-08-30 22:54 GMT+02:00 Eric Pettersen <pett@cgl.ucsf.edu>:
Hi James, First, if you want to save images without showing the Chimera GUI then you have to use the “headless” version of Chimera, available on the download page. To do the other things you want, just put the equivalent commands in a file that ends in “.cmd” and just add that file to your invocation of Chimera, e.g.:
chimera $pdb script.cmd
The easiest way to handle the image file name is probably to used a fixed name in the Chimera “copy” command, and then in your bash script move that file to the final name you want. Also, "preset” is the command to apply presets — “help preset” in Chimera for more info.
Hope this helps.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2017, at 8:40 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera Users!
My simple bash script loops the folder with the pdbs and open it in Chimera
for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done
My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI:
1- Apply "publications-2" preset
2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file
3- make a screen-shot of the colored cartoon figure in the selected output folder.
I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell.
James _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

My guess is it is a graphics driver problem. We haven't updated the software OpenGL driver that is bundled with the headless Chimera in ages (Mesa 7.6.1), but we have updated Chimera's use of OpenGL. Chances are that your Linux server has newer version. So assuming you don't have a graphics driver installed, you should try moving aside the libGL.so* and libOSMesa.so* files in your /home/gleb/.local/UCSF-Chimera64-batch/lib directory so chimera will use the system versions. You might need to install those libraries on your system. On CentOS/RHEL, they are the mesa-libOSMesa and mesa-libGL packages. On Debian/Ubuntu, they are the libosmesa6 and libgl1-mesa-dev packages. If you have an AMD/NVIDIA graphics driver installed, then you will want to copy the Mesa versions of libGL.so and libOSMesa.so to your /home/gleb/.local/UCSF-Chimera64-batch/lib directory. On CentOS/RHEL, the AMD/NVIDIA installers should have moved the Mesa versions aside somewhere, so they could be restored with the driver is uninstalled -- it will take some detective work to find them. On Ubuntu, the libGL.so* files are in /usr/lib/x86_64-linux-gnu/mesa/. HTH, Greg On 9/1/2017 1:23 AM, James Starlight wrote:
now the errors of the execution of the script using headless chimera:
Opening rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb... The following problems occurred while reading PDB file for rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb warning: Ignored bad PDB record found on line 2
Opened rmsf_visu_AT1_dry_apo.2rep.step7_1.pdb containing 1 model, 903 atoms, and 301 residues Rendering high resolution image... ./run.sh: line 113: 14479 Segmentation fault (core dumped) chimera_batch $pdb "${temp}"/script_${name}.cmd
the same with a pow-ray render
Opened rmsf_visu_AT1_wat_Na.3rep.step7_1.pdb containing 1 model, 903 atoms, and 301 residues Generating POV-Ray data file Exporting POV-Ray data to /home/gleb/Desktop/Scripts/MegaAnalysis/output/plots/rmsf/rmsf_AT1_wat_Na.3rep.pov Ignoring CHIMERA environment variable Parse error at line 1: no element found
here is my script:
preset apply publication 2 rangecolor bfactor 2 blue 30 red 50 yellow copy file /home/gleb/Desktop/Scripts/MegaAnalysis/output/plots/rmsf/AT1_wat_apo.3rep.png png width 800 height 600
I have made the same images in chimera GUI and it worked very well.
Is it possible to run same script using in chimera-gui but from batch mode?
2017-08-31 22:04 GMT+02:00 Greg Couch <gregc@cgl.ucsf.edu>:
You must have the given the "key" argument to the rangecolor command. That option tries to display the Color Key tool which want you to use the mouse to position the color key in the graphics window. That is not possible in batch mode. You'll need to add the color key afterwards with an image editor if you need it.
HTH,
Greg
On 08/31/2017 01:00 AM, James Starlight wrote:
Thanks Eric!
Everything works fine with the exception of the copy command. On the rendering stage I have:
Opened AT1_dry_apo.1rep.step7_1.pdb containing 1 model, 57791 atoms, and 12661 residues Traceback (most recent call last): File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimeraInit.py", line 683, in init chimera.openModels.open(a, prefixableType=1) File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/__init__.py", line 1951, in open models = func(filename, *args, **kw) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/ChimeraExtension.py", line 31, in func processCommandFile(fileName) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 108, in processCommandFile _processFile(f, emulateRead, filename) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 143, in _processFile if makeCommand(line): File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 69, in makeCommand f(c, args) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/midas_text.py", line 1786, in doRangeColor showKey=key) File "/home/gleb/.local/UCSF-Chimera64-batch/share/Midas/__init__.py", line 2526, in rangeColor from Ilabel.gui import IlabelDialog File "/home/gleb/.local/UCSF-Chimera64-batch/share/Ilabel/gui.py", line 13, in <module> from chimera import tkgui, chimage, CLOSE_SESSION File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl ImportError: No module named Togl
Error while processing
/home/gleb/Desktop/Scripts/MegaAnalysis/temp/script_AT1_dry_apo.1rep.step7_1.pdb.cmd: ImportError: No module named Togl
File "/home/gleb/.local/UCSF-Chimera64-batch/share/chimera/tkgui.py", line 74, in <module> import Togl
See reply log for Python traceback.
I have found that it is due to some conflict in PYTHONPATH from my bash since I am running Chimera directly from BASH. The people also wrote that Its related to setting transparency- which was not a case there - I did not set in my script. Anyway how to fix it?
Thanks you!
James
2017-08-30 22:54 GMT+02:00 Eric Pettersen <pett@cgl.ucsf.edu>:
Hi James, First, if you want to save images without showing the Chimera GUI then you have to use the “headless” version of Chimera, available on the download page. To do the other things you want, just put the equivalent commands in a file that ends in “.cmd” and just add that file to your invocation of Chimera, e.g.:
chimera $pdb script.cmd
The easiest way to handle the image file name is probably to used a fixed name in the Chimera “copy” command, and then in your bash script move that file to the final name you want. Also, "preset” is the command to apply presets — “help preset” in Chimera for more info.
Hope this helps.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2017, at 8:40 AM, James Starlight <jmsstarlight@gmail.com> wrote:
Dear Chimera Users!
My simple bash script loops the folder with the pdbs and open it in Chimera
for pdb in ${output}/xtc_proc/*.pdb ; do name=$(basename "$pdb") echo "I am sending ${name} to Chimera!" chimera $pdb done
My question - can I use with chimera some batch file which will apply the following commands to each of the loaded pdbs without opening of Chimera GUI:
1- Apply "publications-2" preset
2 - rangecolor bfactor key 2 blue 30 red 50 yellow # color pdb according to b-factor provided in the pdb file
3- make a screen-shot of the colored cartoon figure in the selected output folder.
I thanks so much for the example of batch file and the syntax accepted by chimera from the linux shell.
James _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (3)
-
Eric Pettersen
-
Greg Couch
-
James Starlight