[Chimera-users] redirecting runCommands output
Eric Pettersen
pett at cgl.ucsf.edu
Thu Jun 10 13:53:32 PDT 2010
On Jun 10, 2010, at 4:36 AM, Bala subramanian wrote:
> Friends,
> I wrote a small script to calculate the distance between two atoms
> in a list of pdb files. I would like to know how i can redirect the
> message that appears in replyobj to a text file. Some chimera
> commands like findhbon has option to save the result in file. But
> distance command dosent have the same.
>
> import glob
> from chimera import runCommand as rc
>
>
> filenames=[ fn for fn in glob.glob('*.pdb.*')]
>
> for fn in filenames:
> rc("open " + fn)
> rc("distance :1 at CA :166 at CA") # I have to write this distance
> to a file.
> rc("close all")
Hi Bala,
Since you are using a Python script, you can use the saveReplyLog
method in the chimera.tkgui module to save the contents of the reply
log to a file, e.g.:
for fn in filenames:
rc("open " + fn)
rc("distance :1 at ca :166 at ca")
rc("close all")
from chimera.tkgui import saveReplyLog
saveReplyLog("distances")
In tomorrow's build there will also be a clearReplyLog method, so you
would be able to save a distance file for each structure with:
from chimera.tkgui import saveReplyLog, clearReplyLog
for fn in filenames:
rc("open " + fn)
clearReplyLog()
rc("distance :1 at ca :166 at ca")
saveReplyLog(fn[:-3] + "distance")
rc("close all")
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20100610/51971a80/attachment.html>
More information about the Chimera-users
mailing list