Hi Noel, that is an interesting issue and I believe would be good to clarify for future references.
I've tried to deal with it in the past, and I believe I resorted in using OBAtom.IsChiral() I've tried playing with the OBStereoFacade multiple times, but I never understood it, and the documentation is somehow cyclic: "Facade to simplify retrieval of OBStereoBase derived objects." While digging to write this message, I found a C++ example in the Stereochemistry classes summary (http://openbabel.org/dev-api/group__stereo.shtml), which could be roughly translated in Python: ------------------------------ import ob # load the molecule here facade = ob.OBStereoFacade() for atom in ob.OBMolAtomIter(mol): atom_id = atom.GetId() if facade.HasTetrahedralStereo(atom_id): print(facade.GetTetrahedralStereo(atom_id)) ------------------------------ If so, could you skip the floodfill algorithm step? Otherwise would be the purpose of it? Also, even if R/S chirality is not assigned, is there a way to invert it? I've tried OBTetrahedralStereo::GetConfig and OBStereo::Winding, but results were inconsistent, so I gave up. Thanks! S On 5/14/19 6:59 AM, Noel O'Boyle wrote: > Ah right. No - we don't do R and S assignment. But I don't see how a sensible > QSAR model could possibly relate the count of R and S centers to a physical > property. What does that even mean? > > OBAtom.IsChiral() does not do what you think it's doing. In fact, in the > development version it has been removed. > > I'm afraid you'll have to figure out the floodfill yourself unless someone > wants to help out. It's a standard graph algorithm that can be done with a > breadth first or depth first search using a stack. If you google it up, or > read Sedgewick's Algorithms you should be able to figure it out. > > Regards, > - Noel > > On Tue, 14 May 2019 at 03:59, Spencer Trinh <trinh.kc...@gmail.com > <mailto:trinh.kc...@gmail.com>> wrote: > > Hi Noel, > > > Thanks for response. The paper didn't really mention the R/S > configuration but their supplemental had it. Here is the first two rows of > their supplemental dataset. > > CID SMILES MW N O XLogP HBD HBA RotB > tPSA nStereo R S > Lipitor 60823 > CC(C)C1=C(C(=C(N1CC[C@H](C[C@H](CC(=O)O)O)O)C2=CC=C(C=C2)F)C3=CC=CC=C3)C(=O)NC4=CC=CC=C4 > 558,64 2 5 5,7 4 7 12 112,0 2 > 2 0 > Nexium 4594 CC1=CN=C(C(=C1OC)C)CS(=O)C2=NC3=C(N2)C=C(C=C3)OC > 345,42 3 3 0,6 1 6 5 77,1 1 1 > 0 > > > > For the stereocenters I wrote: > > nStereo=0 > for atom in mol: > if atom.OBAtom.IsChiral() and atom.OBAtom.GetAtomicNum() == 6: > nStereo+=1 > > Would that work just like OBStereoFacade? I'm not familiar with using > that class. > > I'm not sure how to conduct a floodfill search of a molecule. Are there > examples that you can point me to? I simply wrote this but I lack the > knowledge to carry on: > > mol = > pybel.readstring('smi','CC(=O)SC1CC2=CC(=O)CCC2(C3C1C4CCC5(C4(CC3)C)CCC(=O)O5)C') > for a in mol: > if a.OBAtom.IsInRing(): > print(f'{a.idx}, {a.atomicnum}, {a.cidx}') > > Can you provide further assistance? Thanks. > > > Best regards, > > > Spencer > > > Vào Th 2, 13 thg 5, 2019 vào lúc 09:45 Noel O'Boyle > <baoille...@gmail.com <mailto:baoille...@gmail.com>> đã viết: > > Hi Spencer, > > To count the number of ring systems, simply find a ring atom that you > have not yet visited (OBAtom.IsInRing()) and floodfill through all of the > adjacent ring atoms via bonds that are in a ring. That's ring system 1. > Repeat to find additional ring systems. > > In the reference you point to, they don't count the number of R > stereocenters and S stereocenters. They use "chiralCenterCount()", defined as > " Calculates the number of tetrahedral stereogenic centers" > (https://forum.chemaxon.com/ftopic2417.html). If you use the OBStereoFacade, > you should be able to count up the stereo centers. Hopefully this number is > the same as you are expecting. > > Regards, > Noel > > > > On Mon, 13 May 2019 at 02:03, Spencer Trinh <trinh.kc...@gmail.com > <mailto:trinh.kc...@gmail.com>> wrote: > > Hi Openbabel developers, > > I am trying to reproduce the data from this paper: > https://www.ncbi.nlm.nih.gov/pubmed/25618349 > > They listed 20 chemical descriptors used for a pca analysis. I am > having trouble figuring out how they calculated the ring system count. Is > there a way to count the number of ring systems as opposed to standard rings? > For example, spiro rings are considered one instead of two, etc. I simply > know how to get ring count through: mol.OBMol.GetSSSR(). Also, I don't know > how to count the number of R stereocenters and S stereocenters. Is this > possible with Openbabel? I would assume so since it can do a lot of things. > Thank you. > > > > Best regards, > > > Spencer > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > <mailto: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 > -- Stefano Forli, PhD Assistant Professor 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/faculty/forli/ _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss