Re: [Open Babel] Chirality perception

2020-10-12 Thread Stefano Forli

Hi Noel,

thanks for the clarification, but I made a mistake when reading the docs.
I had tried obabel with the command-line option "aS" to see if it would make a 
difference and write a chiral canonical SMILES, but it didn't work. So I've tried passing 
that option to the in my script like this:

conv.AddOption("aS", ob.OBConversion.INOPTIONS)

but it didn't work either (note the extra "a" before the "S" option, which should not be there). 
When I forced "mol.SetChiralityPerceived(False)" I was doing my "poor man" version of what the 
correct approach should have been.
Now that I've noticed the error, the code generates the correct results. Not 
sure if it's worth updating the docs, but at least now I understand it better.

Cheers,

s



On 10/12/20 12:48 PM, Noel O'Boyle wrote:

Hi Stefano,

This is documented in the "0D structures" section: "if you wish to identify 
additional stereocenters whose stereo configuration is unspecified, ...then you may wish to trigger 
perception." The reason we don't do this by default is simply for speed.

Regards,
Noel

On Mon, 12 Oct 2020 at 19:40, Stefano Forli mailto:fo...@scripps.edu>> wrote:

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 




--

 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


Re: [Open Babel] Chirality perception

2020-10-12 Thread Noel O'Boyle
Hi Stefano,

This is documented in the "0D structures" section: "if you wish to identify
additional stereocenters whose stereo configuration is unspecified, ...then
you may wish to trigger perception." The reason we don't do this by default
is simply for speed.

Regards,
Noel

On Mon, 12 Oct 2020 at 19:40, Stefano Forli  wrote:

> 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
>
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Chirality perception

2020-10-12 Thread Stefano Forli

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