On Mar 21, 2013, at 9:50 PM, mbloodforsythe wrote:
> When I search for "[r5]" OpenBabel correctly identifies all 45 atoms that are 
> part
> of of 5-membered rings, ... 
> However, when I search for "[r5]1[r5][r5][r5][r5]1"  or "[r5][r5]", one of
> the bonds (C62-C63) is not recognized so only 11 pentagon rings are found
> out of the possible 12.

Noel pointed out fundamental problem, which is that [r5] doesn't
do what you think it does, because of the SSSR.

You can get an equivalent solution through the more complex
recursive SMARTS.

The pattern  *~1~*~*~*~*1  matches all rings with 5 atoms. 
The pattern  [$(*~1~*~*~*~*1)] matches an atom which is in a ring with 5 atoms.

The pattern 
  
[$(*~1~*~*~*~*1)]~1~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]1
matches a ring of size 5 where each atom is in a ring of size 5.

Notice that I'm using "~" to match any bond, while your pattern uses
the default of "match single or aromatic bond". I don't know if that
makes a difference to your search.

Here's an example of it in use with your structure.

>>> import pybel
>>> pat = 
>>> pybel.Smarts("[$(*~1~*~*~*~*1)]~1~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]~[$(*~1~*~*~*~*1)]1")
>>> mol = next(pybel.readfile("pdb", "c68_1108.pdb"))
>>> pat.findall(mol)
[(1, 5, 4, 3, 2), (1, 6, 7, 8, 2), (2, 8, 9, 10, 3), (4, 13, 14, 15, 5),
(18, 33, 34, 35, 19), (21, 37, 38, 23, 22), (28, 45, 46, 30, 29),
(41, 55, 56, 57, 42), (54, 65, 66, 56, 55), (58, 68, 61, 60, 59),
(61, 68, 67, 63, 62), (63, 67, 66, 65, 64)]
>>> len(pat.findall(mol))
12


This returns the 12 matches that you expected.

                                Andrew
                                da...@dalkescientific.com



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to