[Chimera-users] saving coords from script

Eric Pettersen pett at cgl.ucsf.edu
Mon Dec 23 15:59:16 PST 2013

On Dec 20, 2013, at 1:58 AM, Tetsuro Fujisawa wrote:

> Hi,
> I found some strange behavior in saving pdb file by script file.
> I tried to modify the orientation of pdb file ‘tst.pdb’ (#1) in reference to axis coordinate (#0), then save the atomic coordinates in pdb file.
> When I typed in the commands through either command line window or IDLE, transformed coordinates were saved. It worked fine. However, the exact identical commands (inside the brancket) or lines (rc(’..’)) were run by script file shown in below, the untransformed coordinates were saved.  This is also the case for “Midas.write method”.  
> I wondered this might be a bug.
> Regards,
> Tetsuro
> Sample.py:
> ----------------------------------------------
> from chimera import runCommand as rc
> rc('open axis.bild')
> rc('open tst.pdb')
> rc('rock y 60 1 center #1 coord #0 models #1')
> # orientation of tst.pdb was modified
> rc('focus')
> rc('write relative #0 #1 tstA.pdb')
> # write current coordinates to tstA.pdb
> rc('open tstA.pdb')
> # opened tstA has original untransformed orientation
> -----------------------------------------------

Hi Tetsuro,
	The issue is that unlike using the command line or IDLE or running a chimera-command script, no frames get drawn during the execution of a Python script unless explicitly requested and therefore the "rock" command in your script doesn't actually do anything until after the entire script runs, and by that time your coordinate file has already been written.
	To get the rock command to complete before proceeding with the rest of the script you need to append "; wait" or "; wait 1" (since you are rocking for 1 frame) to the end of your rock command.


                        Eric Pettersen
                        UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20131223/a45d5268/attachment.html>

More information about the Chimera-users mailing list