I have taken the liberty of responding on the public list. My apologies if you 
did mean this as private, but I don't think that was the case.

On Dec 17, 2009, at 3:21 AM, Abhinav Chawade wrote:
> My question is, when a SMILES is parsed, how does the parser detect atoms 
> which are in the ring? Looking at SMILES, it's easy to detect start and end 
> of the ring. But how to detect all the other atoms which are part of the 
> ring? What algorithm can be used to detect these atoms? 

In SMILES in general is is not easy to determine which atoms are the start and 
end of the ring. Some rather unusual SMILES are possible, like

CC1.CCC12CC.CC2

which contains no cycles. No one writes these sort of SMILES in real life.

There are two questions here. One is identifying ring bonds for a ring closure, 
as needed to generate the SMILES, can be done in O(n) time. That's done with a 
depth first search and if a bond goes to an atom which has already been visited 
then it is a ring bond and everything in the current stack (up to where the 
ring bond connects) is in the ring.


Many of the toolkits need to find not just which atoms and bonds are in a ring 
but also identify the rings themselves. Cubane, for example, has lots of 
different ways to make up the rings. The goal is often to find the Smallest Set 
of Smallest Rings (SSSR). The code in RDKit is in GraphMol/FindRings.cpp and 
this is the reference:


  
/*******************************************************************************
   * SUMMARY:
   *  this again is a modified version of the BFS algorihtm  in Figueras paper 
to find
   *  the smallest ring with a specified root atom.
   *    JCICS, Vol. 30, No. 5, 1996, 986-991
   *  The follwing are changes from the original algorithm
   *   - find all smallest rings around a node not just one
   *   - once can provided a list of node IDs that should not be include in the 
discovered rings


                                Andrew
                                [email protected]



------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to