<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><span class="Apple-tab-span" style="white-space:pre"> </span>The issue is that a bunch of the relevant code isn't in Python -- it's in C++. It might simply be easier to use the criteria outlined in the "Automatic Categories" table in the surface command help page (<a href="http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/surface.html">http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/surface.html</a>) to implement the ligand/solvent identification yourself.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Nonetheless, the Python part of the code that identifies ligands and solvent is in the 'categorize' method found in <your Chimera installation>/share/Categorizer/__init__.py. There are various calls into C++ but most of them are trivial and are obvious as to what they do and are only there to make the routine faster (since it is called for every model that is opened). The one that is not so obvious is "roots = model.roots(1)" which calculates the "roots" of each graph component of the molecule (i.e. each molecular fragment that is not connected by covalent bonds to any other fragment). The source code for computing roots is in Molecule::mg_traversalOrganize() in libs/_molecule/Molecule.cpp of the C++ source code. You can fetch the source code via git. Details about that are here:</div><div><br></div><div><a href="http://www.cgl.ucsf.edu/chimera/sourcecode.html">Source Code for UCSF Chimera</a></div><div><br></div><div>--Eric</div><div><br> Eric Pettersen<br> UCSF Computer Graphics Lab<br> <a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a><br><br><div><div>On Mar 2, 2014, at 5:24 PM, unwicky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Thank for your attention!I have found the two commands,and I did so,but to do this,I must load all of chimera,that's too heavy,I hope I can get the pure code,thank you again!<br><br><br><br><div></div><div id="divNeteaseMailCard"></div><br>At 2014-02-27 05:37:25,"Eric Pettersen" <pett@cgl.ucsf.edu> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div><div>On Feb 24, 2014, at 6:44 AM, unwicky <<a href="mailto:unwicky@126.com">unwicky@126.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">hello,i want to delete solvent and ligand from a pdb file,but to use chimera command line,it has to load to many components,can you show me the pure source code to to this?thank you</div></blockquote><br></div><div>Hi,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>I'm guessing your question means: "I have a bunch of PDB files that I need to remove the solvent and ligand from and therefore need to automate the process. How do I do that?". If that's not right, let me know. Anyway, the Chimera commands to remove solvent and ligand are:</div><div><br></div><div>del solvent</div><div>del ligand</div><div><br></div><div>and therefore in Python can be called by:</div><div><br></div><div>from chimera import runCommand as rc</div><div>rc("del solvent")</div><div>rc("del ligand")</div><div><br></div><div><br></div><div>In Chimera's 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>) there is a basic primer for looping through a bunch of data files and doing something on each one. You would just take the example in the basic primer and modify it to do the above (and write out the results). The direct link to the basic primer is here:</div><div><br></div><div><a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html</a></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; font-size: 16px; "><div style="margin: 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></div><div style="margin: 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></div><div style="margin: 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></div><br class="Apple-interchange-newline"></span>
</div>
<br></blockquote></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br></div><br><br><div apple-content-edited="true">
</div>
<br></body></html>