Thank you, Dr. Forli. It worked! -Tayeb
-----Original Message----- From: Stefano Forli <fo...@scripps.edu> Sent: Thursday, September 13, 2018 10:09 PM To: tayeb...@gmail.com; openbabel-disc...@lists.sf.net Cc: Cesar Plascencia <plasc...@chemistry.msu.edu> Subject: Re: [Open Babel] Ring Perception Using Pybel I don't know how to do that with PyBel only, but you can access OB from it and get roughly the same results with something like this: import pybel ob=pybel.ob pmol=pybel.readfile('sdf', 'filename.sdf').next() mol=pmol.OBMol ring_list=list(mol.GetSSSR()) size=len(ring_list) print "size", size for ring in ring_list: members=tuple(ring._path) print "members", members On 09/13/2018 06:01 PM, tayeb...@gmail.com wrote: > Hi, > > Does anybody know how I can use pybel to find rings (sssr) in compounds and output the indices of the atoms in those rings? > > I have already figured out how to do it using rdkit, but I am interested in accomplishing the same thing with pybel: > > >>> *m = Chem.MolFromMolFile('temp.mol')* > > >>> *ssr = Chem.GetSymmSSSR(m)* > > # and then I can print the indices of the atoms in the rings: > > >>> *list(ssr[0])*# print for the first ring for example > > [6, 5 , 2, 1, 3, 0] > > >>> *len(ssr)*# or print the number of rings > > 3 > > > > > > _______________________________________________ > 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