[Chimera-users] command line mode

snoze pa snoze.pa at gmail.com
Mon Feb 4 14:31:04 PST 2008


Eric,
 You made my day 5 hour shorter. Yeah..I want to get good charges using
chimera.
Thanks a lot for your help.
s


On Feb 4, 2008 4:00 PM, Eric Pettersen <pett at cgl.ucsf.edu> wrote:

> Hi Snoze, 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:
>
> from chimera import openModels, Molecule
> from AddCharge import
> addNonstandardResCharges, estimateFormalCharge, ChargeError
> mols = openModels.list(modelTypes=[Molecule])
> log = open("errlog", "w")
> for m in mols:
> residues = m.residues
> atoms = [a for r in residues for a in r.atoms]
> fc = estimateFormalCharge(atoms)
> try:
> addNonstandardResCharges(m.residues, fc)
> except ChargeError:
> print>>log, "Charge estimate (%d) or protonation wrong for %s (%s)" % (
> fc, m.name, m.oslIdent())
> from WriteMol2 import writeMol2
> writeMol2(mols, "output.mol2")
> log.close()
>
> If you save the above in a file named script.py and your 1000 compounds
> are in a file named input.mol2, then running:
>
> chimera --nogui input.mol2 script.py
>
> 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.
>
> --Eric
>
>                         Eric Pettersen
>
>                         UCSF Computer Graphics Lab
>
>                         http://www.cgl.ucsf.edu
>
>
> On Feb 1, 2008, at 10:36 AM, Elaine Meng wrote:
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20080204/468defc0/attachment.html>


More information about the Chimera-users mailing list