<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi Ben,<div><span class="Apple-tab-span" style="white-space:pre"> </span>IDLE is basically for interactive debugging or discovery of information in the Python layer (the latter via the help() function). For what you want to do you either want to write a Chimera-command script (.cmd suffix) or a Python script (.py suffix). Either kind can be run by opening the script with File...Open or the "open" command or by supplying the filename as an argument on the Chimera startup command line (the latter typically used more in Linux or IRIX environments).</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>If what you want to do is no more complicated than what you outlined, you can get away with using a Chimera-command script. In particular you can use the "alias" command to construct a compound command that takes arguments. For example:</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>alias ^process open $1.pdb; sel :HIS; del sel; write 0 $1.mod.pdb; close 0</div><div><br class="webkit-block-placeholder"></div><div>creates an alias named "process" that if you execute it as "process 1gcn" will open the file 1gcn.pdb, select the histidines, delete the selected atoms, write the result to a file named 1gcn.mod.pdb, and then close the opened model. Aliases are saved in sessions and can be made available at startup. See the documention for the alias command for details on that.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>So you might make a command file like this:</div><div><br class="webkit-block-placeholder"></div><div>alias ^process open $1.pdb; sel :HIS; del sel; write 0 $1.mod.pdb; close 0</div><div>process 1gcn</div><div>process 3fx2</div><div>process 1www</div><div>...</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>You would have to use Python if you needed to loop through a range of values in your script, or only execute certain commands if some condition was true, or do something for which there is no equivalent Chimera command. We having some basic information for getting started in the Chimera Programmer's Guide: <a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html</a></div><div><br class="webkit-block-placeholder"></div><div>The programmer documentation isn't nearly as extensive as the user documentation, so feel to ask questions -- either here or on the chimera-dev mailing list.</div><div><br class="webkit-block-placeholder"></div><div>--Eric</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><br></div><div><br><div> <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; "><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"></span> </div><br><div><div>On Feb 6, 2008, at 12:41 PM, Ben Keshet wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div class="Section1"><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial">Hi,<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial"><o:p> </o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial">I am interested in performing the same actions several times on several different structures. For example: open a file, select the histidines, delete them, save and close. Is IDLE the right tool for that? I opened the python shell (Tools-> General Controls-> IDLE) but could not open files or manipulate them using the shell. I have no knowledge in python. What is the best way to write scripts to execute commands repeatedly? If IDLE is the tool, how can use it to do that? Is there a written source for that? Do I need to master python first?<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial"><o:p> </o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial">Many thanks,<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt; font-family:Arial">Ben<o:p></o:p></span></font></p> </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Chimera-users mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users">http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users</a></div> </blockquote></div><br></div></body></html>