Problem using a python script to run chimeraX (installation?)

Hello, I am picking up an old code that used chimera and updating it to use ChimeraX. Our code writes a python script file that looks like : import chimera from chimera import runCommand runCommand("open ../4ZKC_H_reduce.pdb") runCommand("swapaa LYS #0:11.B&:LYS lib dynameomics") runCommand("swapaa TRP #0:51.B&:TRP lib dynameomics") runCommand("write #0 ../4ZKC_H_reduce.pdb") and executes chimera --nogui --nostatus --script python_script.py I installed ChimeraX on Ubuntu 22.01 with the .deb from your website and "sudo apt install chimerax.deb" When i execute ChimeraX with my script, i get : available bundle cache has not been initialized yet Executing: runscript chim_4ZKC_H_reduce.py Traceback (most recent call last): File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 84, in open_python_script _exec_python(session, code, argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 61, in _exec_python exec(code, sandbox.__dict__) File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/__main__.py", line 747, in init run(sess, 'runscript %s' % script) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 38, in run results = command.run(text, log=log, return_json=return_json) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2897, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/runscript.py", line 38, in runscript open_python_script(session, open(script_file, 'rb'), script_file, argv=argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 90, in open_python_script raise UserError('Error opening python file %s' % stream.name) chimerax.core.errors.UserError: Error opening python file chim_4ZKC_H_reduce.py I tried installing chimera using pip but it installs Chimera (the one in python 2.7) and crashes during the installation. Any ideas on how to fix this? Did i do something wrong somewhere? Thanks you very much for your help, Bar Collignon

Im sorry for my previous mail, i found the problem myself and using your extensive documentation. I do run into another problem : swapaa LYS #0:11.B&:LYS lib dynameomics which seems to still be how you run swapaa, says that "LYS" is not a valid residue. "lys" as well and i tried other residues as per your examples (thr, leu, tyr) and i get the same error everytime swapaa LYS #0:11.B&:LYS .......^ Missing or invalid "residues" argument: invalid residues specifier Thank you for your help Bar Collignon ________________________________ De : Collignon, Bar /FR Envoyé : mercredi 12 juillet 2023 12:02 À : chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Objet : Problem using a python script to run chimeraX (installation?) Hello, I am picking up an old code that used chimera and updating it to use ChimeraX. Our code writes a python script file that looks like : import chimera from chimera import runCommand runCommand("open ../4ZKC_H_reduce.pdb") runCommand("swapaa LYS #0:11.B&:LYS lib dynameomics") runCommand("swapaa TRP #0:51.B&:TRP lib dynameomics") runCommand("write #0 ../4ZKC_H_reduce.pdb") and executes chimera --nogui --nostatus --script python_script.py I installed ChimeraX on Ubuntu 22.01 with the .deb from your website and "sudo apt install chimerax.deb" When i execute ChimeraX with my script, i get : available bundle cache has not been initialized yet Executing: runscript chim_4ZKC_H_reduce.py Traceback (most recent call last): File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 84, in open_python_script _exec_python(session, code, argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 61, in _exec_python exec(code, sandbox.__dict__) File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/__main__.py", line 747, in init run(sess, 'runscript %s' % script) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 38, in run results = command.run(text, log=log, return_json=return_json) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2897, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/runscript.py", line 38, in runscript open_python_script(session, open(script_file, 'rb'), script_file, argv=argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 90, in open_python_script raise UserError('Error opening python file %s' % stream.name) chimerax.core.errors.UserError: Error opening python file chim_4ZKC_H_reduce.py I tried installing chimera using pip but it installs Chimera (the one in python 2.7) and crashes during the installation. Any ideas on how to fix this? Did i do something wrong somewhere? Thanks you very much for your help, Bar Collignon

Once again, i apologise for the continuous spams with useless questions. It is hard to differentiate between Chimera documents and ChimeraX. I have succeeded in applying rotamers using swapaa /B:51:TRP TRP rotLib dynameomics and swapaa /B:11:lys lys rotLib dynameomics My problem is now that all of my lys get rotated instead of just one. But i will work on it and stop sending you mails... Once again, please disregard my previous mails. Have a good day Bar Collignon ________________________________ De : Collignon, Bar /FR <Bar.Collignon@sanofi.com> Envoyé : mercredi 12 juillet 2023 12:28 À : chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Objet : RE: Problem using a python script to run chimeraX (installation?) Im sorry for my previous mail, i found the problem myself and using your extensive documentation. I do run into another problem : swapaa LYS #0:11.B&:LYS lib dynameomics which seems to still be how you run swapaa, says that "LYS" is not a valid residue. "lys" as well and i tried other residues as per your examples (thr, leu, tyr) and i get the same error everytime swapaa LYS #0:11.B&:LYS .......^ Missing or invalid "residues" argument: invalid residues specifier Thank you for your help Bar Collignon ________________________________ De : Collignon, Bar /FR Envoyé : mercredi 12 juillet 2023 12:02 À : chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Objet : Problem using a python script to run chimeraX (installation?) Hello, I am picking up an old code that used chimera and updating it to use ChimeraX. Our code writes a python script file that looks like : import chimera from chimera import runCommand runCommand("open ../4ZKC_H_reduce.pdb") runCommand("swapaa LYS #0:11.B&:LYS lib dynameomics") runCommand("swapaa TRP #0:51.B&:TRP lib dynameomics") runCommand("write #0 ../4ZKC_H_reduce.pdb") and executes chimera --nogui --nostatus --script python_script.py I installed ChimeraX on Ubuntu 22.01 with the .deb from your website and "sudo apt install chimerax.deb" When i execute ChimeraX with my script, i get : available bundle cache has not been initialized yet Executing: runscript chim_4ZKC_H_reduce.py Traceback (most recent call last): File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 84, in open_python_script _exec_python(session, code, argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 61, in _exec_python exec(code, sandbox.__dict__) File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/__main__.py", line 747, in init run(sess, 'runscript %s' % script) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 38, in run results = command.run(text, log=log, return_json=return_json) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2897, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/runscript.py", line 38, in runscript open_python_script(session, open(script_file, 'rb'), script_file, argv=argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 90, in open_python_script raise UserError('Error opening python file %s' % stream.name) chimerax.core.errors.UserError: Error opening python file chim_4ZKC_H_reduce.py I tried installing chimera using pip but it installs Chimera (the one in python 2.7) and crashes during the installation. Any ideas on how to fix this? Did i do something wrong somewhere? Thanks you very much for your help, Bar Collignon

Hi Bar, Glad you were able to figure most things out on your own. In case you haven't figured out this latest one yet, the atom spec "/B:11:lys" means residue 11 in chain B and all lysines in chain B, so you want just "/B:11". --Eric Eric Pettersen UCSF Computer Graphics Lab
On Jul 12, 2023, at 7:43 AM, Collignon, Bar /FR via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Once again, i apologise for the continuous spams with useless questions. It is hard to differentiate between Chimera documents and ChimeraX. I have succeeded in applying rotamers using
swapaa /B:51:TRP TRP rotLib dynameomics
and
swapaa /B:11:lys lys rotLib dynameomics
My problem is now that all of my lys get rotated instead of just one. But i will work on it and stop sending you mails... Once again, please disregard my previous mails.
Have a good day
Bar Collignon
De : Collignon, Bar /FR <Bar.Collignon@sanofi.com> Envoyé : mercredi 12 juillet 2023 12:28 À : chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Objet : RE: Problem using a python script to run chimeraX (installation?)
Im sorry for my previous mail, i found the problem myself and using your extensive documentation.
I do run into another problem :
swapaa LYS #0:11.B&:LYS lib dynameomics
which seems to still be how you run swapaa, says that "LYS" is not a valid residue. "lys" as well and i tried other residues as per your examples (thr, leu, tyr) and i get the same error everytime
swapaa LYS #0:11.B&:LYS .......^ Missing or invalid "residues" argument: invalid residues specifier
Thank you for your help
Bar Collignon De : Collignon, Bar /FR Envoyé : mercredi 12 juillet 2023 12:02 À : chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Objet : Problem using a python script to run chimeraX (installation?)
Hello,
I am picking up an old code that used chimera and updating it to use ChimeraX. Our code writes a python script file that looks like :
import chimera from chimera import runCommand runCommand("open ../4ZKC_H_reduce.pdb") runCommand("swapaa LYS #0:11.B&:LYS lib dynameomics") runCommand("swapaa TRP #0:51.B&:TRP lib dynameomics") runCommand("write #0 ../4ZKC_H_reduce.pdb")
and executes
chimera --nogui --nostatus --script python_script.py
I installed ChimeraX on Ubuntu 22.01 with the .deb from your website and "sudo apt install chimerax.deb" When i execute ChimeraX with my script, i get :
available bundle cache has not been initialized yet Executing: runscript chim_4ZKC_H_reduce.py Traceback (most recent call last): File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera'
Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 84, in open_python_script _exec_python(session, code, argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 61, in _exec_python exec(code, sandbox.__dict__) File "chim_4ZKC_H_reduce.py", line 2, in <module> from chimera import runCommand ModuleNotFoundError: No module named 'chimera'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/__main__.py", line 747, in init run(sess, 'runscript %s' % script) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/run.py", line 38, in run results = command.run(text, log=log, return_json=return_json) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/cli.py", line 2897, in run result = ci.function(session, **kw_args) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/commands/runscript.py", line 38, in runscript open_python_script(session, open(script_file, 'rb'), script_file, argv=argv) File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/chimerax/core/scripting.py", line 90, in open_python_script raise UserError('Error opening python file %s' % stream.name) chimerax.core.errors.UserError: Error opening python file chim_4ZKC_H_reduce.py
I tried installing chimera using pip but it installs Chimera (the one in python 2.7) and crashes during the installation. Any ideas on how to fix this? Did i do something wrong somewhere?
Thanks you very much for your help,
Bar Collignon _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Manage subscription:
participants (2)
-
Collignon, Bar /FR
-
Eric Pettersen