Hi Noel,
indeed, that was my initial attempt to figure out how to deal with stereogenic centers, and I still didn't have a decent understanding of Id vs Idx.
Incidentally, this is particularly clear in your documentation.

I have one suggestion.
In the section about the inversion of stereochemistry, it would be helpful if the example would show how to read the current winding.
For example, would this work?

--
if config.winding == ob.OBStereo.Clockwise:
    print("Clockwise winding")
elif config.winding==ob.OBStereo.AntiClockwise:
    print("Anti-clockwise winding")
else: # elif config.winding==ob.OBStereoUnknownWinding: ?
    print("Undefined winding winding")
--

Also, I know the support for non-tetrahedral chirality is not complete, but I'm wondering if there a way to use the OBStereo.Type with the facade to infer if it is recognized or not.

Thanks!

S

On 2020-02-09 12:36, Noel O'Boyle wrote:
Just a note on the code above. Many years ago Tim replaced the stereochemistry handling, and I helped a bit. But vestiges of the original handling were left lying around to avoid breaking the API. I guess we thought we'd remove them sooner than we did, as looking back it makes no sense to have them lying around confusing everyone.

Anyway, now with version 3.0, mol.FindChiralCenters() and atom.HasChiralitySpecified() have both been removed. atom.IsChiral() I kept (though I thought about removing it also) but changed the code so that it's now a convenience function that just calls the functions in the modern API.

And just to note that you should avoid subtracting 1 from the Idx to get the Id. Right now it works, but we don't guarantee that relationship, and it certainly won't be true if you delete atoms. Better to get the atom and then call GetId().

- Noel

On Thu, 6 Feb 2020 at 06:58, Stefano Forli <fo...@scripps.edu <mailto:fo...@scripps.edu>> wrote:

    Noel,
    this is great! I've been following the stereochemistry issue for a while in 
the mailing
    list and you addressed pretty much all the key aspects.

    One thing that seems to be missing is the discussion on how to invert 
chirality. In the
    past I've tried writing code to enumerate all possible enantiomers of 
molecules with
    unspecified chiral centers or to explicitly invert the defined ones.

    An issue found while digging into that was that  
OBAtom.HasChiralitySpecified(), and
    facade.GetTetrahedralStereo(idx).IsSpecified() were giving conflicting 
results.

    It's been a while since I tested it, but the code was this:
    ====================
    import pybel
    ob = pybel.ob
    mols = [ 'OCC1OC(O)C(O)C(O)C1O',
             'OC[C@H]1OC(O)[C@H](O)[C@@H](O)[C@@H]1O']
    for smi in mols:
            print "\nMOL->", smi
            m = pybel.readstring('smi', smi).OBMol
            m.FindChiralCenters()
            facade = ob.OBStereoFacade(m)
            for a in ob.OBMolAtomIter(m):
                if a.IsChiral():
                    idx = a.GetIdx()
                    print "ATOM", a.GetIdx(), a.IsChiral(),
                             a.HasChiralitySpecified(),
                    print facade.GetTetrahedralStereo(idx-1).IsSpecified()
    =======================

    It would be interesting to test it with the latest development code and see 
if there are
    still issues.

    Thas

    On 2020-02-05 14:51, Geoffrey Hutchison wrote:
     > Yes, Naruki and I were running into confusion when using these classes 
for the
    distance
     > geometry implementation.
     >
     > The key challenge is that we'd want to save the expected stereo 
configuration
    around atoms
     > and bonds - and then when generating 3D coordinates, test to see if the 
generated
     > configurations match the expected ones.
     >
     > I think we can probably go through the code and examine, but if you have
    suggestions on
     > how to save the expected configs for future comparison, that would be 
great.
     >
     > -Geoff
     >
     >
     >> On Feb 5, 2020, at 4:30 PM, Noel O'Boyle <baoille...@gmail.com
    <mailto:baoille...@gmail.com>
     >> <mailto:baoille...@gmail.com <mailto:baoille...@gmail.com>>> wrote:
     >>
     >> Hi there,
     >>
     >> I've been very slowly pulling together some docs on using the API for 
stereo. I
    remember
     >> someone on the list a few months back discussing difficulties with this 
part of the
     >> library - if anyone has any particular examples they'd like me to 
discuss, this
    would be
     >> a good time to mention them.
     >>
     >> Progress so far:
     >> 
https://github.com/baoilleach/documentation/blob/stereo/Stereochemistry/stereo.rst
     >>
     >> Regards,
     >> - Noel
     >> _______________________________________________
     >> OpenBabel-Devel mailing list
     >> OpenBabel-Devel@lists.sourceforge.net
    <mailto:OpenBabel-Devel@lists.sourceforge.net>
    <mailto:OpenBabel-Devel@lists.sourceforge.net
    <mailto:OpenBabel-Devel@lists.sourceforge.net>>
     >> https://lists.sourceforge.net/lists/listinfo/openbabel-devel
     >
     >
     >
     > _______________________________________________
     > OpenBabel-Devel mailing list
     > OpenBabel-Devel@lists.sourceforge.net 
<mailto:OpenBabel-Devel@lists.sourceforge.net>
     > https://lists.sourceforge.net/lists/listinfo/openbabel-devel
     >

--
       Stefano Forli, PhD

       Assistant Professor
       Center for Computational Structural Biology

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

          tel: +1 (858)784-2055
          fax: +1 (858)784-2860
          email: fo...@scripps.edu <mailto:fo...@scripps.edu>
    http://www.scripps.edu/~forli/


--

 Stefano Forli, PhD

 Assistant Professor
 Center for Computational Structural Biology

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

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



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

Reply via email to