Dear Igor, On Sat, May 17, 2008 at 1:10 AM, Igor Filippov [Contr] <ig...@helix.nih.gov> wrote: > > I was wondering if you could advise me how to obtain the following > counts with RDKit: > - The number of aromatic rings > - The number of 3,4,5,6,7-member rings > > There doesn't seem to be an API function that I can find to get those > numbers, is it possible to do this with some simple SMARTS patterns?
There's not a single API function to do what you want and I don't think it would be straightforward to express eiterh as a query. It's pretty easy to do anyway. From C++ the ring counting looks something like: // count the number of rings of size 4: unsigned int nRingsSize4=0; for(VECT_INT_VECT_CI ringIt=atomRings.begin(); ringIt!=atomRings.end();++ringIt){ if(ringIt->size()==4) nRingsSize4++; } For the aromatic rings (defined to be rings where every bond is aromatic): unsigned int nAromaticRings=0; for(VECT_INT_VECT_CI ringIt=bondRings.begin(); ringIt!=bondRings.end();++ringIt){ bool isAromatic=true; for(INT_VECT_CI bondIt=ringIt->begin(); bondIt!=ringIt->end();++bondIt){ if(!mol->getBondWithIdx(*bondIt)->getIsAromatic()){ isAromatic=false; break; } } if(isAromatic) nAromaticRings++; } Both of these are building on the earlier sample code, which has been updated in subversion: http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/Demos/RDKit/GettingStarted/sample.cpp?view=markup Note that in each case the symmetrized set of smallest rings is used, so cubane would give you 6 four membered rings and nothing else. I hope this helps, -greg