MD trajectory play by commandline

Dear Chimera developers and users: I am using Chimera (production version 1.8 (build 38824) 2013-06-07 21:09:20 UTC). I wanted to process MD trajectories to extract their detailed H-bond information. To do so, I would like to process by script with Hbond.py file. $ chimera --script Hbond.py #---[Hbond.py] from chimera import runCommand # pr trajectory movie with open("metafile", 'w') as m: meta_input = """amber mypdb.prmtop pr_dry_netcdf.crd """ print >> m, meta_input # runCommand("open movie:metafile") runCommand("alias ^myhb hbond relax true savefile hbond.$1") runCommand("perframe myhb") runCommand("coordset #0 1,1000,10; wait 100") #----------------------- As I have many MD trajectories to be processed, I was looking for a commandline in lieu of actually clicking buttons in MD movie GUI to play. I thought that "coordset #0 1,10000,10; wait 100" may operate like automatically starting the MD movie to load frame 1 to 1000 at every 100 interval. But resulting saved H-bond files contain same information all about the first frame (because graphically displayed was the first frame without any update unless clicking the button in MD movie GUI). Is there a way to achieve an automatic play via commandline? Thank you, inhee park

Dear Inhee Park, A big limitation of the "coordset" command is that most formats of MD trajectory would have to be played through entirely using the graphical interface before it would work to use "coordset", as mentioned here: <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/coordset.html> In other words, probably the frame is not updating when you use coordset. Another thing that confuses me in your script is the use of "wait". I don't think it is needed. Assuming "coordset" is working, I'd use something like perframe myhb; coordset #0 1,1000,10 ~perframe Sorry about that limitation. Maybe someone else can suggest how to use python to play the trajectory. Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Jan 13, 2014, at 5:18 PM, inhee park <ipark.c@gmail.com> wrote:
Dear Chimera developers and users:
I am using Chimera (production version 1.8 (build 38824) 2013-06-07 21:09:20 UTC).
I wanted to process MD trajectories to extract their detailed H-bond information. To do so, I would like to process by script with Hbond.py file. $ chimera --script Hbond.py
#---[Hbond.py] from chimera import runCommand
# pr trajectory movie with open("metafile", 'w') as m: meta_input = """amber mypdb.prmtop pr_dry_netcdf.crd """ print >> m, meta_input # runCommand("open movie:metafile") runCommand("alias ^myhb hbond relax true savefile hbond.$1") runCommand("perframe myhb") runCommand("coordset #0 1,1000,10; wait 100") #-----------------------
As I have many MD trajectories to be processed, I was looking for a commandline in lieu of actually clicking buttons in MD movie GUI to play. I thought that "coordset #0 1,10000,10; wait 100" may operate like automatically starting the MD movie to load frame 1 to 1000 at every 100 interval. But resulting saved H-bond files contain same information all about the first frame (because graphically displayed was the first frame without any update unless clicking the button in MD movie GUI).
Is there a way to achieve an automatic play via commandline?
Thank you, inhee park _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Yes, as Elaine says you need all the frames loaded. Since you are using a Python script it is not hard to do this with a few additional lines before your coordset command: from chimera import openModels, Molecule m = openModels.list(modelTypes=[Molecule])[0] m.loadAllFrames() --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Jan 14, 2014, at 11:06 AM, Elaine Meng wrote:
Dear Inhee Park, A big limitation of the "coordset" command is that most formats of MD trajectory would have to be played through entirely using the graphical interface before it would work to use "coordset", as mentioned here:
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/coordset.html>
In other words, probably the frame is not updating when you use coordset. Another thing that confuses me in your script is the use of "wait". I don't think it is needed. Assuming "coordset" is working, I'd use something like
perframe myhb; coordset #0 1,1000,10 ~perframe
Sorry about that limitation. Maybe someone else can suggest how to use python to play the trajectory. Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 13, 2014, at 5:18 PM, inhee park wrote:
Dear Chimera developers and users:
I am using Chimera (production version 1.8 (build 38824) 2013-06-07 21:09:20 UTC).
I wanted to process MD trajectories to extract their detailed H-bond information. To do so, I would like to process by script with Hbond.py file. $ chimera --script Hbond.py
#---[Hbond.py] from chimera import runCommand
# pr trajectory movie with open("metafile", 'w') as m: meta_input = """amber mypdb.prmtop pr_dry_netcdf.crd """ print >> m, meta_input # runCommand("open movie:metafile") runCommand("alias ^myhb hbond relax true savefile hbond.$1") runCommand("perframe myhb") runCommand("coordset #0 1,1000,10; wait 100") #-----------------------
As I have many MD trajectories to be processed, I was looking for a commandline in lieu of actually clicking buttons in MD movie GUI to play. I thought that "coordset #0 1,10000,10; wait 100" may operate like automatically starting the MD movie to load frame 1 to 1000 at every 100 interval. But resulting saved H-bond files contain same information all about the first frame (because graphically displayed was the first frame without any update unless clicking the button in MD movie GUI).
Is there a way to achieve an automatic play via commandline?
Thank you, inhee park _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Dear Elaine and Eric: Thank you for your help. Actually the following previous posts were directly helpful to accomplish what I wanted to do, i.e. utilizing MoveDialog. http://www.cgl.ucsf.edu/pipermail/chimera-dev/2013/000968.html http://plato.cgl.ucsf.edu/pipermail/chimera-users/2011-August/006634.html Now hbond information seems properly saved upon updated frame with LoadFrame. Thanks a lot! #chimera --script Hbond.py # from chimera import runCommand from Movie.gui import MovieDialog from chimera.extension import manager # pr trajectory movie open by metafile meta = open("metafile", 'w') meta_input = """ amber mypdb.prmtop pr.crd """ meta.write(meta_input) meta.close() ##### def findMDMovie(): mdms = [inst for inst in manager.instances if isinstance(inst, MovieDialog)] if not mdms: raise AssertionError("No MD Movie Instances!") return mdms[-1] ##### runCommand("open movie:metafile; sel protein") mdm = findMDMovie() for x in range(1,1000+1,5): frame = x mdm.LoadFrame(x) runCommand("hbond selRestrict any relax true savefile hbond.%s" % x) runCommand("wait") runCommand("stop") # move onto next MD trajectory On Tue, Jan 14, 2014 at 11:06 AM, Elaine Meng <meng@cgl.ucsf.edu> wrote:
Dear Inhee Park, A big limitation of the "coordset" command is that most formats of MD trajectory would have to be played through entirely using the graphical interface before it would work to use "coordset", as mentioned here:
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/coordset.html>
In other words, probably the frame is not updating when you use coordset. Another thing that confuses me in your script is the use of "wait". I don't think it is needed. Assuming "coordset" is working, I'd use something like
perframe myhb; coordset #0 1,1000,10 ~perframe
Sorry about that limitation. Maybe someone else can suggest how to use python to play the trajectory. Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 13, 2014, at 5:18 PM, inhee park <ipark.c@gmail.com> wrote:
Dear Chimera developers and users:
I am using Chimera (production version 1.8 (build 38824) 2013-06-07 21:09:20 UTC).
I wanted to process MD trajectories to extract their detailed H-bond information. To do so, I would like to process by script with Hbond.py file. $ chimera --script Hbond.py
#---[Hbond.py] from chimera import runCommand
# pr trajectory movie with open("metafile", 'w') as m: meta_input = """amber mypdb.prmtop pr_dry_netcdf.crd """ print >> m, meta_input # runCommand("open movie:metafile") runCommand("alias ^myhb hbond relax true savefile hbond.$1") runCommand("perframe myhb") runCommand("coordset #0 1,1000,10; wait 100") #-----------------------
As I have many MD trajectories to be processed, I was looking for a commandline in lieu of actually clicking buttons in MD movie GUI to play. I thought that "coordset #0 1,10000,10; wait 100" may operate like automatically starting the MD movie to load frame 1 to 1000 at every 100 interval. But resulting saved H-bond files contain same information all about the first frame (because graphically displayed was the first frame without any update unless clicking the button in MD movie GUI).
Is there a way to achieve an automatic play via commandline?
Thank you, inhee park _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- _________ inhee park

Hi Inhee, I think the "wait 100" command is needed after the "coordset" command because the coordset command does not wait for the 100 frames to be shown before going on to the next command. This weird behavior is for making animations where you want to start coordset, and maybe start spinning the model at the same time. Tom On Jan 14, 2014, at 11:06 AM, Elaine Meng wrote:
Dear Inhee Park, A big limitation of the "coordset" command is that most formats of MD trajectory would have to be played through entirely using the graphical interface before it would work to use "coordset", as mentioned here:
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/coordset.html>
In other words, probably the frame is not updating when you use coordset. Another thing that confuses me in your script is the use of "wait". I don't think it is needed. Assuming "coordset" is working, I'd use something like
perframe myhb; coordset #0 1,1000,10 ~perframe
Sorry about that limitation. Maybe someone else can suggest how to use python to play the trajectory. Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 13, 2014, at 5:18 PM, inhee park <ipark.c@gmail.com> wrote:
Dear Chimera developers and users:
I am using Chimera (production version 1.8 (build 38824) 2013-06-07 21:09:20 UTC).
I wanted to process MD trajectories to extract their detailed H-bond information. To do so, I would like to process by script with Hbond.py file. $ chimera --script Hbond.py
#---[Hbond.py] from chimera import runCommand
# pr trajectory movie with open("metafile", 'w') as m: meta_input = """amber mypdb.prmtop pr_dry_netcdf.crd """ print >> m, meta_input # runCommand("open movie:metafile") runCommand("alias ^myhb hbond relax true savefile hbond.$1") runCommand("perframe myhb") runCommand("coordset #0 1,1000,10; wait 100") #-----------------------
As I have many MD trajectories to be processed, I was looking for a commandline in lieu of actually clicking buttons in MD movie GUI to play. I thought that "coordset #0 1,10000,10; wait 100" may operate like automatically starting the MD movie to load frame 1 to 1000 at every 100 interval. But resulting saved H-bond files contain same information all about the first frame (because graphically displayed was the first frame without any update unless clicking the button in MD movie GUI).
Is there a way to achieve an automatic play via commandline?
Thank you, inhee park _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (4)
-
Elaine Meng
-
Eric Pettersen
-
inhee park
-
Tom Goddard