Should the -p option be removed from Open Babel? I dread to think how  
many people are blithely using it, unaware that it could be screwing  
up their results.


Quoting Stefano Forli <ntropia...@users.sf.net> on Wed, 13 Aug 2014  
20:27:46 +0000:

> I bumped in this bug report while trying to understand why I  
> couldn't generate the proper protonation state even for simple  
> molecules. I've tried to identify the source of the problem with the  
> version I'm using, v2.3.2 (Ubuntu).
> I hope I'm not missing something trivial in my tests...
> Hopefully it can be useful to debugging, I apologize for the long  
> post (and the horrible formatting... blame Markdown).
> I've tried the test case Noel reported, and while the charge issue  
> seems to be fixed, protonation state and atom typing are still  
> wrong. Besides, I found the following behavior to be rather puzzling:
> <pre><code>obabel -:"OC(=O)c1ccccc1" -omol2 --gen3D -p 7.4 -O  
> obabel_firstpass.mol2
> obabel -imol2 obabel_firstpass.mol2 -omol2  -p 7.4 -O obabel_secondpass.mol2
> </code></pre>The molecule obabel_secondpass.mol2 has correct typing  
> and charge (~-1).
> The following code replicates the behavior of obabel commands above,  
> generating the proper molecule only at the second pass:
> <pre><code>
> # Python Obabel/Pybel test
> import pybel
> ob = pybel.ob
> from sys import argv
> fp = open('benzoicAcid.smi', 'w')
> fp.write('OC(=O)c1ccccc1  benzoicAcid\n')
> fp.close()
> """read SMI and generate Mol2 (first pass)"""
> obc = ob.OBConversion()
> obc.SetInAndOutFormats('smi', 'mol2')
> obc.OpenInAndOutFiles('benzoicAcid.smi', 'wrong.mol2')
> mol = ob.OBMol()
> notatend = obc.Read(mol)
> while notatend:
>    """pybel shortcut"""
>    pmol = pybel.Molecule(mol)
>    pmol.make3D()
>    mol = pmol.OBMol
>    mol.CorrectForPH()
>    mol.AddHydrogens()
>    obc.Write(mol)
>    """XXX write molecule with wrong carboxylic atom typing: O.3 and O.2"""
>    print "Atoms count (first pass):", mol.NumAtoms()
>    mol = ob.OBMol()
>    notatend = obc.Read(mol)
> """ re-read the wrong molecule"""
> obc = ob.OBConversion()
> obc.SetInAndOutFormats('mol2', 'mol2')
> obc.OpenInAndOutFiles('op.mol2', 'right.mol2')
> mol = ob.OBMol()
> notatend = obc.Read(mol)
> while notatend:
>    """pybel shortcut"""
>    pmol = pybel.Molecule(mol)
>    #pmol.make3D()
>    mol = pmol.OBMol
>    mol.CorrectForPH()
>    mol.AddHydrogens()
>    obc.Write(mol)
>    """XXX write molecule with correct carboxylic atom typing: O.co2 """
>    print "Atoms count (second pass):", mol.NumAtoms()
>    mol = ob.OBMol()
>    notatend = obc.Read(mol)
> </code></pre>
> I've tried to dig into the problem a bit more, using the patterns  
> from the phmodel.txt, and they seem to fail to identify the 'COO-'  
> pattern in the mol2 files generated with the previous code.
> <pre><code>
> # pH model test
> import pybel
> from sys import argv
> """patterns from phmodel.txt"""
> pre = 'O=C[OD1-0:1]'
> post = 'O=C[O-:1]'
> transform = pybel.ob.OBChemTsfm()
> success = transform.Init(pre, post)
> mol = pybel.readfile('mol2', argv[1]).next()
> smart = pybel.Smarts(pre)
> print "PATTERN FOUND", smart.findall(mol)
> transform.Apply(mol.OBMol)
> mol.write('mol2', 'obpython.mol2', overwrite=1)
> </code></pre>.
>
>
> ---
>
> ** [bugs:#710] Gasteiger partial charges and the -p option**
>
> **Status:** open
> **Group:** 2.3.x
> **Labels:** Command-line Tools
> **Created:** Tue Mar 08, 2011 04:41 PM UTC by Douglas Houston
> **Last Updated:** Thu Feb 20, 2014 03:35 PM UTC
> **Owner:** Noel O'Boyle
>
> I have observed something curious about variations in the way  
> OpenBabel assigns Gasteiger charges.
>
> For example,
>
> babel -isdf molecule.sdf -omol2 molecule_H.mol2 -h
>
> produces a molecule with an overall charge that is essentially 0.  
> However, the command
>
> babel -isdf molecule.sdf -omol2 molecule_H.mol2 -p 7.4
>
> produces a molecule that has an overall charge of -9.0. Both output  
> files have had the same number of hydrogens added. Is this what's  
> supposed to happen?
>
> I have attached the input file for others to test. This seems to  
> happen with both 2.2.3 and 2.3.0,
>
>
>
>
> ---
>
> Sent from sourceforge.net because you indicated interest in  
> <https://sourceforge.net/p/openbabel/bugs/710/>
>
> To unsubscribe from further messages, please visit  
> <https://sourceforge.net/auth/subscriptions/>




_____________________________________________________
Dr. Douglas R. Houston
Lecturer
Institute of Structural and Molecular Biology
Room 3.23, Michael Swann Building
King's Buildings
University of Edinburgh
Edinburgh, EH9 3JR, UK
Tel. 0131 650 7358
http://tinyurl.com/douglasrhouston


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to