Hi,

I've found a solution that works, so I'm posting it here for posterity.
By forcing mol.SetChiralityPerceived(False) right after reading the molecule I 
can get the proper behavior restored:

   (3.1.0)
   0 True IsChiral()
   0 True HasTetrahedralStereo()

I think I can see why this can make sense, in the perspective of forcing to 
keep the information in the input.
An interesting behavior worth reporting in the docs.

Thanks,

S


On 10/10/20 11:27 PM, Stefano Forli wrote:
Hi all,

we've been looking at migrating our OB2 code to OB3 and we have found differences in how 
to deal with chirality, which I don't know how to sort out. I wrote the test code below, 
which returns different results for "C(Br)(Cl)F" depending on the version. In 
particular, with v2, the first carbon atom is:

   0 True IsChiral()
   0 True HasTetrahedralStereo()

while for v3:

   0 False IsChiral()
   0 False HasTetrahedralStereo()

While it would make more sense that no tetrahedral configuration is defined, I 
would expect the atom to be perceived as chiral. I've read the latest 
documentation I could find from Noel 
(https://open-babel.readthedocs.io/en/latest/Stereochemistry/stereo.html) with 
no success.
Since it seems that the OBMol.IsChiral() method does not exist anymore, I have 
no clues on how to detect if a molecule is chiral, and if so, which atoms are 
chiral.

Any suggestions?

Thanks,

S


----------
import sys
try: # 3
     from openbabel import openbabel as ob
except: # 2
     import openbabel as ob
print(ob.OBReleaseVersion())
conv = ob.OBConversion()
conv.SetInFormat("smi")
mol = ob.OBMol()
conv.ReadString(mol, "C(Br)(Cl)F")
try:
     # not available anymore in OB3
     print(mol.IsChiral(), "IsChiral()")
except:
     pass
facade = ob.OBStereoFacade(mol, True)
for a in ob.OBMolAtomIter(mol):
     idx = a.GetId()
     print(idx, a.IsChiral(), "IsChiral()")
     print(idx, facade.HasTetrahedralStereo(idx), "HasTetrahedralStereo()")
----------








--

 Stefano Forli, PhD

 Assistant Professor
 Dept. of Integrative Structural
 and Computational Biology, MB-112A
 Scripps Research
 10550  North Torrey Pines Road
 La Jolla,  CA 92037-1000,  USA.

    tel: +1 (858)784-2055
    email: fo...@scripps.edu
    http://www.scripps.edu/faculty/forli/



_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to