[chimerax-users] Converting Chimera movie script

Tom Goddard goddard at sonic.net
Fri Jun 26 17:43:37 PDT 2020


Hi Vid,

 The "clip hither -0.5 120" command in the Chimera script you mentioned moves the near clip plane away in 120 steps of 0.5 Angstroms.  To do the same in ChimeraX which does not have the "frames" option for the clip command:

	perframe "clip near 0.5" frames 120

This isn't the same if the near clip plane is not yet enabled then the "clip near 0.5" sets the position 0.5 Angstroms behind the center of the displayed models, while if the near clip plane is enabled it moves it 0.5 Angstroms further away.  So you could set the starting position 30 Angstroms in front of the center, then move 60 Angstroms back in 0.5 Angstrom steps use:

	clip near -30
	perframe "clip near 0.5" frames 120

In the future we plane to add the frames option to the clip command.

	Tom


> On Jun 26, 2020, at 3:50 PM, Vid Sustar <vid.sustar at abo.fi> wrote:
> 
> The following bug report has been submitted:
> Platform:        Linux-5.3.0-61-generic-x86_64-with-debian-buster-sid
> ChimeraX Version: 1.0 (2020-06-04 23:15:07 UTC)
> Description
> Hello!
> 
> I have tried to adapt the cliping script from 
> http://www.rbvi.ucsf.edu/chimera/data/movie-howto-mar2012/scripts/clip.cmd
> to work in ChimeraX (because my structure is too big, to be loaded properly in earlier Chimera)
> I tried to convert the old commands to the ChimeraX, but I get an error in the line  "clip front -0.5 120": Expected a keyword
> Please advise me how to change the code to work with ChimeraX to create a movie 
> or to simply save a series of images of cliped planes
> 
> Best regards,
> Vid Sustar
> 
> Log:
> UCSF ChimeraX version: 1.0 (2020-06-04)  
> © 2016-2020 Regents of the University of California. All rights reserved.  
> How to cite UCSF ChimeraX  
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.py
> 
> Traceback (most recent call last):  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/dialog.py", line 150, in _qt_safe  
> if data_format is None else " format " +
> StringArg.unparse(data_format.nicknames[0])))  
> File "/usr/lib/ucsf-chimerax/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/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 101, in cmd_open  
> Command(session, registry=registry).run(provider_cmd_text, log=log)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 152, in provider_open  
> name or model_name_from_path(fi.file_name)), provider_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 365, in collated_open  
> return func(*func_args, **func_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core_formats/__init__.py", line 48, in open  
> return open_python_script(session, data, file_name)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 82, in open_python_script  
> _exec_python(session, code, argv)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 59, in _exec_python  
> exec(code, sandbox.__dict__)  
> File "clip2.py", line 3, in <module>  
> ModuleNotFoundError: No module named 'chimera'  
> 
> ModuleNotFoundError: No module named 'chimera'  
> 
> File "clip2.py", line 3, in  
> 
> See log for complete Python traceback.  
> 
> 
>> ui tool show Shell
> 
> /usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/IPython/core/history.py:226: UserWarning: IPython History requires
> SQLite, your history will not be saved  
> warn("IPython History requires SQLite, your history will not be saved")  
> 
>> select up
> 
> Nothing selected  
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.py
> 
> Traceback (most recent call last):  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/dialog.py", line 150, in _qt_safe  
> if data_format is None else " format " +
> StringArg.unparse(data_format.nicknames[0])))  
> File "/usr/lib/ucsf-chimerax/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/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 101, in cmd_open  
> Command(session, registry=registry).run(provider_cmd_text, log=log)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 152, in provider_open  
> name or model_name_from_path(fi.file_name)), provider_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 365, in collated_open  
> return func(*func_args, **func_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core_formats/__init__.py", line 48, in open  
> return open_python_script(session, data, file_name)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 82, in open_python_script  
> _exec_python(session, code, argv)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 59, in _exec_python  
> exec(code, sandbox.__dict__)  
> File "clip2.py", line 3, in <module>  
> ModuleNotFoundError: No module named 'chimera'  
> 
> ModuleNotFoundError: No module named 'chimera'  
> 
> File "clip2.py", line 3, in  
> 
> See log for complete Python traceback.  
> 
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/writeMol2.py
> 
> Traceback (most recent call last):  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/dialog.py", line 150, in _qt_safe  
> if data_format is None else " format " +
> StringArg.unparse(data_format.nicknames[0])))  
> File "/usr/lib/ucsf-chimerax/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/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 101, in cmd_open  
> Command(session, registry=registry).run(provider_cmd_text, log=log)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 152, in provider_open  
> name or model_name_from_path(fi.file_name)), provider_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 365, in collated_open  
> return func(*func_args, **func_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core_formats/__init__.py", line 48, in open  
> return open_python_script(session, data, file_name)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 82, in open_python_script  
> _exec_python(session, code, argv)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 59, in _exec_python  
> exec(code, sandbox.__dict__)  
> File "writeMol2.py", line 2, in <module>  
> ModuleNotFoundError: No module named 'chimera'  
> 
> ModuleNotFoundError: No module named 'chimera'  
> 
> File "writeMol2.py", line 2, in  
> 
> See log for complete Python traceback.  
> 
> 
>> help help:user
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.py
> 
> Traceback (most recent call last):  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/dialog.py", line 150, in _qt_safe  
> if data_format is None else " format " +
> StringArg.unparse(data_format.nicknames[0])))  
> File "/usr/lib/ucsf-chimerax/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/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 101, in cmd_open  
> Command(session, registry=registry).run(provider_cmd_text, log=log)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/commands/cli.py", line 2805, in run  
> result = ci.function(session, **kw_args)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 152, in provider_open  
> name or model_name_from_path(fi.file_name)), provider_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/open_command/cmd.py", line 365, in collated_open  
> return func(*func_args, **func_kw)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core_formats/__init__.py", line 48, in open  
> return open_python_script(session, data, file_name)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 82, in open_python_script  
> _exec_python(session, code, argv)  
> File "/usr/lib/ucsf-chimerax/lib/python3.7/site-
> packages/chimerax/core/scripting.py", line 59, in _exec_python  
> exec(code, sandbox.__dict__)  
> File "clip2.py", line 4, in <module>  
> ImportError: cannot import name 'runCommand' from 'chimerax' (unknown
> location)  
> 
> ImportError: cannot import name 'runCommand' from 'chimerax' (unknown
> location)  
> 
> File "clip2.py", line 4, in  
> 
> See log for complete Python traceback.  
> 
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.cxc
> 
>> open /home/user/MASTERS/Chimera_files/testPDBfiles/Sys1nanopart.pdb
> 
>> select :wat
> 
> 157584 atoms, 157584 bonds, 1 model selected  
> 
>> hide sel target a
> 
>> select ~sel
> 
> 37869 atoms, 34860 bonds, 1 model selected  
> 
>> surface sel
> 
>> color (#!1 & sel) white
> 
>> select ::name="OQL"
> 
> 2380 atoms, 2520 bonds, 1 model selected  
> 
>> color (#!1 & sel) red
> 
>> select ::name="ONC"
> 
> 4200 atoms, 3920 bonds, 1 model selected  
> 
>> color (#!1 & sel) blue
> 
>> select ::name="NP"
> 
> 2869 atoms, 1 model selected  
> 
>> color (#!1 & sel) yellow
> 
>> lighting flat
> 
>> lighting shadows false
> 
>> graphics silhouettes false
> 
>> movie record supersample 3
> 
>> clip front -0.5
> 
>> wait
> 
> wait requires a frame count argument unless motion is in progress  
> 
>> movie encode clip.mp4 bitrate 200
> 
> Movie encoding failed because no images were recorded.  
> 
>> close session
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.cxc
> 
>> open /home/user/MASTERS/Chimera_files/testPDBfiles/Sys1nanopart.pdb
> 
>> select :wat
> 
> 157584 atoms, 157584 bonds, 1 model selected  
> 
>> hide sel target a
> 
>> select ~sel
> 
> 37869 atoms, 34860 bonds, 1 model selected  
> 
>> surface sel
> 
>> color (#!1 & sel) white
> 
>> select ::name="OQL"
> 
> 2380 atoms, 2520 bonds, 1 model selected  
> 
>> color (#!1 & sel) red
> 
>> select ::name="ONC"
> 
> 4200 atoms, 3920 bonds, 1 model selected  
> 
>> color (#!1 & sel) blue
> 
>> select ::name="NP"
> 
> 2869 atoms, 1 model selected  
> 
>> color (#!1 & sel) yellow
> 
>> lighting flat
> 
>> lighting shadows false
> 
>> graphics silhouettes false
> 
>> movie record supersample 3
> 
>> clip front -0.5 120
> 
> Expected a keyword  
> 
>> close session
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.cxc
> 
>> open /home/user/MASTERS/Chimera_files/testPDBfiles/Sys1nanopart.pdb
> 
>> select :wat
> 
> 157584 atoms, 157584 bonds, 1 model selected  
> 
>> hide sel target a
> 
>> select ~sel
> 
> 37869 atoms, 34860 bonds, 1 model selected  
> 
>> surface sel
> 
>> color (#!1 & sel) white
> 
>> select ::name="OQL"
> 
> 2380 atoms, 2520 bonds, 1 model selected  
> 
>> color (#!1 & sel) red
> 
>> select ::name="ONC"
> 
> 4200 atoms, 3920 bonds, 1 model selected  
> 
>> color (#!1 & sel) blue
> 
>> select ::name="NP"
> 
> 2869 atoms, 1 model selected  
> 
>> color (#!1 & sel) yellow
> 
>> lighting flat
> 
>> lighting shadows false
> 
>> graphics silhouettes false
> 
>> windowsize 200 150
> 
>> copy file clip.jpg
> 
> Unknown command: copy file clip.jpg  
> 
>> copy
> 
> Unknown command: copy  
> 
>> save /home/user/Desktop/image1.png supersample 3
> 
>> movie record
> 
> Already recording a movie  
> 
>> open /home/user/Desktop/gbpmovie.cxc
> 
> No such file/path: /home/user/Desktop/gbpmovie.cxc  
> 
>> close session
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.cxc
> 
>> open /home/user/MASTERS/Chimera_files/testPDBfiles/Sys1nanopart.pdb
> 
>> select :wat
> 
> 157584 atoms, 157584 bonds, 1 model selected  
> 
>> hide sel target a
> 
>> select ~sel
> 
> 37869 atoms, 34860 bonds, 1 model selected  
> 
>> surface sel
> 
>> color (#!1 & sel) white
> 
>> select ::name="OQL"
> 
> 2380 atoms, 2520 bonds, 1 model selected  
> 
>> color (#!1 & sel) red
> 
>> select ::name="ONC"
> 
> 4200 atoms, 3920 bonds, 1 model selected  
> 
>> color (#!1 & sel) blue
> 
>> select ::name="NP"
> 
> 2869 atoms, 1 model selected  
> 
>> color (#!1 & sel) yellow
> 
>> lighting flat
> 
>> lighting shadows false
> 
>> graphics silhouettes false
> 
>> movie record supersample 3
> 
> Already recording a movie  
> 
>> movie stop
> 
>> movie record supersample 3
> 
>> movie stop
> 
>> movie stop
> 
> Not currently recording  
> 
>> close session
> 
>> open /home/user/MASTERS/Chimera_files/PythonScripts/clip2.cxc
> 
>> open /home/user/MASTERS/Chimera_files/testPDBfiles/Sys1nanopart.pdb
> 
>> select :wat
> 
> 157584 atoms, 157584 bonds, 1 model selected  
> 
>> hide sel target a
> 
>> select ~sel
> 
> 37869 atoms, 34860 bonds, 1 model selected  
> 
>> surface sel
> 
>> color (#!1 & sel) white
> 
>> select ::name="OQL"
> 
> 2380 atoms, 2520 bonds, 1 model selected  
> 
>> color (#!1 & sel) red
> 
>> select ::name="ONC"
> 
> 4200 atoms, 3920 bonds, 1 model selected  
> 
>> color (#!1 & sel) blue
> 
>> select ::name="NP"
> 
> 2869 atoms, 1 model selected  
> 
>> color (#!1 & sel) yellow
> 
>> lighting flat
> 
>> lighting shadows false
> 
>> graphics silhouettes false
> 
>> movie record supersample 3
> 
>> clip front -0.5 120 ; wait 120 ; movie encode clip.mp4 bitrate 200
> 
> Expected a keyword  
> 
>> help help:contact.html
> 
> 
> 
> 
> OpenGL version: 3.3.0 NVIDIA 440.100
> OpenGL renderer: GeForce RTX 2060/PCIe/SSE2
> OpenGL vendor: NVIDIA Corporation
> Manufacturer: Micro-Star International Co., Ltd.
> Model: GL63 8SE
> OS: Ubuntu 18.04 bionic
> Architecture: 64bit ELF
> CPU: 12 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
> Cache Size: 9216 KB
> Memory:
> 	              total        used        free      shared  buff/cache   available
> 	Mem:            31G        6.1G         18G        662M        6.6G         24G
> 	Swap:          2.0G          0B        2.0G
> 
> Graphics:
> 	00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:3e9b]	
> 	Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:126a]	
> 	Kernel driver in use: i915
> PyQt version: 5.12.3
> Compiled Qt version: 5.12.4
> Runtime Qt version: 5.12.8
> File attachment: clip2.cxc
> <clip2.cxc>_______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users




More information about the ChimeraX-users mailing list