Eric,<br> You made my day 5 hour shorter. Yeah..I want to get good charges using chimera. <br>Thanks a lot for your help.<br>s<br><br><br><div class="gmail_quote">On Feb 4, 2008 4:00 PM, Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">
Hi Snoze,<div><span style="white-space: pre;"> </span>I'm going to guess, like Elaine, that your purpose is to add partial charges. If your 1000 compounds are in one big mol2 file, here is a script that would do the job:</div>
<div><br></div><div>from chimera import openModels, Molecule</div><div>from AddCharge import addNonstandardResCharges, estimateFormalCharge, ChargeError</div><div>mols = openModels.list(modelTypes=[Molecule])</div><div>log = open("errlog", "w")</div>
<div>for m in mols:</div><div><span style="white-space: pre;"> </span>residues = m.residues</div><div><span style="white-space: pre;"> </span>atoms = [a for r in residues for a in r.atoms]<br></div><div><span style="white-space: pre;"> </span>fc = estimateFormalCharge(atoms)</div>
<div><span style="white-space: pre;"> </span>try:</div><div><span style="white-space: pre;"> </span>addNonstandardResCharges(m.residues, fc)</div><div><span style="white-space: pre;"> </span>except ChargeError:</div><div>
<span style="white-space: pre;"> </span>print>>log, "Charge estimate (%d) or protonation wrong for %s (%s)" % (</div><div><span style="white-space: pre;"> </span>fc, <a href="http://m.name" target="_blank">m.name</a>, m.oslIdent())</div>
<div>from WriteMol2 import writeMol2</div><div>writeMol2(mols, "output.mol2")</div><div>log.close()</div><div><br></div><div>If you save the above in a file named script.py and your 1000 compounds are in a file named input.mol2, then running:</div>
<div><br></div><div><span style="white-space: pre;"> </span>chimera --nogui input.mol2 script.py</div><div><br></div><div>will produce a file named output.mol2 with the charges included. Any problems it had charging particular compounds will be saved in a file named errlog.</div>
<div><br></div><div>--Eric</div><div><br><div> <span style="border-collapse: separate; border-spacing: 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-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><p style="margin: 0px;">
<font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="5"><span> <span> </span></span>Eric Pettersen</font></p>
<p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="5"><span> <span> </span></span>UCSF Computer Graphics Lab</font></p>
<div class="Ih2E3d"><p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="5"><span> </span><a href="http://www.cgl.ucsf.edu" target="_blank">http://www.cgl.ucsf.edu</a></font></p>
<br></div></span> </div><br><div><div><div></div><div class="Wj3C7c"><div>On Feb 1, 2008, at 10:36 AM, Elaine Meng wrote:</div></div></div></div></div></div></blockquote></div><br>