<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 4, 2010, at 11:50 AM, Elisabeth Ortega wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear all,<div><br></div><div><br></div><div>I need to read some parameters that are write in the same file that I have opened. For exemple, I had a python script that parses the author of the PDB file and I want to run it in a chimera script to use it in other part of the script. To open the file I use:</div> <div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">from openSave import osOpen</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div> <div><font class="Apple-style-span" face="'courier new', monospace">f=osOpen("/home/eortega/data.pdb")</font></div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">code ....</font></div> <div><br></div><div><br></div><div>I want to do that more "polite". I mean, without write the entire route of the file. Saying to chimera that reads the same file that it has open and appears in the screen.</div></blockquote><br></div><div>Hi Elisabeth,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Although the entire text of a PDB file isn't preserved in Chimera when the file is opened, the header lines are, which should be good enough for your purpose. So what you need to do is locate the Molecule object corresponding to the structure you want, and then:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mol.pdbHeaders['AUTHOR']</div><div><br></div><div>will return a list of the PDB AUTHOR header lines (only one line in this case of course).</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Locating the Molecule object depends a bit on what your script does. If your script opened the PDB file itself with:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>chimera.openModels.open("/home/eortega/data.pdb")</div><div><br></div><div>then the return value of that is a list of Molecule objects (it's a list because some kinds of files cause multiple Molecules to be created [e.g. NMR ensembles]). Similarly:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>chimera.openModels.list(modelTypes=[chimera.Molecule])</div><div><br></div><div>will return a list of all currently open Molecule objects. Lastly, if the structure is selected then:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>chimera.selection.currentMolecules()</div><div><br></div><div>will return a list of selected Molecules.</div><div><br></div><div>--Eric</div><div><br></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>