<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jun 10, 2010, at 4:36 AM, Bala subramanian wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Friends,<br>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.<br> <br> import glob<br> from chimera import runCommand as rc<br><br> <br> filenames=[ fn for fn in glob.glob('*.pdb.*')]<br> <br> for fn in filenames:<br> rc("open " + fn)<br><b> rc("distance :1@CA :166@CA") # I have to write this distance to a file.</b><br> rc("close all")</blockquote><br></div><div>Hi Bala,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>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, <i>e.g.</i>:</div><div><br></div><div>for fn in filenames:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("open " + fn)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("distance :1@ca :166@ca")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("close all")</div><div>from chimera.tkgui import saveReplyLog</div><div>saveReplyLog("distances")</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>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:</div><div><br></div><div>from chimera.tkgui import saveReplyLog, clearReplyLog</div><div>for fn in filenames:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("open " + fn)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>clearReplyLog()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("distance :1@ca :166@ca")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>saveReplyLog(fn[:-3] + "distance")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>rc("close all")</div><div><br></div><div>--Eric</div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></div></span> </div><br></body></html>