
Dear Chimera Users, How can I use chimera in --nogui mode to screen 1000 compunds from ZINC database and save them in to mol2 format. Is there any script so that I can convert preselected 1000 compound from ZINC database and convert them t o mol2 format so that I can use them in DOCK program. thanks in advance

Hi Snoze, One of the main uses of the ZINC database is to generate ligand sets for DOCK; I believe you can download mol2 format directly from ZINC, and that the molecules already have hydrogens and charges. See http://zinc.docking.org/ But maybe you wanted to use Antechamber inside of Chimera to get different charges. If so, somebody else will have to answer the scripting part of your question! Best Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html On Feb 1, 2008, at 9:47 AM, snoze pa wrote:
Dear Chimera Users, How can I use chimera in --nogui mode to screen 1000 compunds from ZINC database and save them in to mol2 format. Is there any script so that I can convert preselected 1000 compound from ZINC database and convert them t o mol2 format so that I can use them in DOCK program. thanks in advance

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:
Hi Snoze, One of the main uses of the ZINC database is to generate ligand sets for DOCK; I believe you can download mol2 format directly from ZINC, and that the molecules already have hydrogens and charges. See http://zinc.docking.org/
But maybe you wanted to use Antechamber inside of Chimera to get different charges. If so, somebody else will have to answer the scripting part of your question! Best Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html
On Feb 1, 2008, at 9:47 AM, snoze pa wrote:
Dear Chimera Users, How can I use chimera in --nogui mode to screen 1000 compunds from ZINC database and save them in to mol2 format. Is there any script so that I can convert preselected 1000 compound from ZINC database and convert them t o mol2 format so that I can use them in DOCK program. thanks in advance
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

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@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
On Feb 1, 2008, at 10:36 AM, Elaine Meng wrote:

Hi Eric, The scripts is not working.. It is giving me following error message. Is it possible to call the minimization step inside the script so that i can use the bcc charges? Thanks a lot for your help. chimera --nogui x.mol2 script.py Sorry: IndentationError: ('expected an indented block', ('script.py', 6, 8, 'residues = m.residues\n'))Opening x.mol2...Compiling script.py...Compiling script.py succeededExecuting script.py... Traceback (most recent call last): File "/usr/local/chimera/share/__main__.py", line 59, in ? value = chimeraInit.init(sys.argv) File "CHIMERA/share/chimeraInit.py", line 350, in init chimera.openModels.open(a, prefixableType=1) File "CHIMERA/share/chimera/__init__.py", line 1378, in open File "CHIMERA/share/chimera/__init__.py", line 865, in _openPython IndentationError: expected an indented block (script.py, line 6) Error while processing script.py: IndentationError: expected an indented block (script.py, line 6) (see reply log for Python traceback info) On Mon, Feb 4, 2008 at 4:00 PM, Eric Pettersen <pett@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
On Feb 1, 2008, at 10:36 AM, Elaine Meng wrote:

Hi Snoze, In the Python language, indentation is significant. It seems you didn't preserve the indentation levels when you copied what I sent. In particular, I'm guessing that line 6 ("residues = m.residues") and all following lines lack indentation. I have _attached_ a copy of the script so that when you use it the indentation will be correct. --Eric On Feb 26, 2008, at 12:24 PM, snoze pa wrote:
Hi Eric, The scripts is not working.. It is giving me following error message. Is it possible to call the minimization step inside the script so that i can use the bcc charges? Thanks a lot for your help.
chimera --nogui x.mol2 script.py Sorry: IndentationError: ('expected an indented block', ('script.py', 6, 8, 'residues = m.residues\n'))Opening x.mol2...Compiling script.py...Compiling script.py succeededExecuting script.py... Traceback (most recent call last): File "/usr/local/chimera/share/_ _main__.py", line 59, in ? value = chimeraInit.init(sys.argv) File "CHIMERA/share/chimeraInit.py", line 350, in init chimera.openModels.open(a, prefixableType=1) File "CHIMERA/share/chimera/__init__.py", line 1378, in open File "CHIMERA/share/chimera/__init__.py", line 865, in _openPython IndentationError: expected an indented block (script.py, line 6) Error while processing script.py: IndentationError: expected an indented block (script.py, line 6) (see reply log for Python traceback info)
On Mon, Feb 4, 2008 at 4:00 PM, Eric Pettersen <pett@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

participants (3)
-
Elaine Meng
-
Eric Pettersen
-
snoze pa