Sergio,
You have to use GetSubstructMatches.
Look at my sample here
<http://nbviewer.ipython.org/gist/CKannas/5a762b97c52e389d492e>.
Best,
Christos
Christos Kannas
Researcher
Ph.D Student
Mob (UK): +44 (0) 7447700937
Mob (Cyprus): +357 99530608
[image: View Christos Kannas's profile on LinkedIn]
<http://cy.linkedin.com/in/christoskannas>
On 9 December 2014 at 18:48, Wong, Sergio E. <[email protected]> wrote:
> Dear Ling;
>
> Thank you for pointing out the issue with the lactam ring. I manually
> changed the bond types in the mol2 file and now the error is gone. The
> MolFromMol2File function can sanitize the molecule. However, I still have
> a problem with the output. Again, my code is:
>
> mol=Chem.MolFromMol2File("%s.lig.%d.mol2"%(name, i), sanitize = True,
> removeHs = False)
>
> aromatic_6="[c,n]1[c,n][c,n][c,n][c,n][c,n]1"
> aromatic_5="[c,n]1[c,n][c,n][c,n][c,n]1"
>
> pattern6=Chem.MolFromSmarts(aromatic_6)
> pattern5=Chem.MolFromSmarts(aromatic_5)
>
> print "Pattern 6 "
> lar = mol.GetSubstructMatch(pattern6)
> print lar
> print "Pattern 5 "
> lar = mol.GetSubstructMatch(pattern5)
> print lar
>
> The output is:
>
> Pattern 6
> (0, 1, 3, 5, 7, 9)
> Pattern 5
> (30, 31, 32, 41, 42)
>
> So for some reason, the pattern match for an aromatic six-membered ring
> returns the conjugated lactam ring, but fails to recognize the other two
> (all-carbon) aromatic rings in the system. Interesting, it correctly
> recognizes the five-membered ring system. Do you have any idea's on how to
> address the issue? I am attaching the hand-edited mol2 file.
>
> Thanks!
> -Sergio
>
>
>
> *From:* S.L. Chan [[email protected]]
> *Sent:* Monday, December 08, 2014 8:26 PM
> *To:* Wong, Sergio E.; [email protected]
>
> *Subject:* Re: [Rdkit-discuss] Can't kelulize
>
> Dear Sergio,
> The lactam ring (atoms 1 2 4 6 8 10) is not really aromatic. The bonds
> 4-6, 6-8, 8-10 should all be single rather than aromatic in the mol2 file.
> The remaining three bonds in the ring should be double or single rather
> than aromatic.
>
> Ling
>
> ------------------------------
> *From:* "Wong, Sergio E." <[email protected]>
> *To:* "[email protected]" <
> [email protected]>
> *Sent:* Monday, December 8, 2014 3:27 PM
> *Subject:* Re: [Rdkit-discuss] Can't kelulize
>
> Dear RDKit users:
>
> I tried reading a mol2 file using the function MolFromMol2 (). The goal
> of my script is to read the molecule and find 5 or 6 membered aromatic
> rings. First I got the following error:
>
> Can't Kekulize mol
>
> The code I used is as follows:
>
> mol=Chem.MolFromMol2File("%s.lig.%d.mol2"%(name, i), sanitize = True,
> removeHs = False)
>
> As a work-around I tried removing the sanitize flag and did the following
>
>
> mol=Chem.MolFromMol2File("%s.lig.%d.mol2"%(name, i), sanitize = False,
> removeHs = False)
>
> aromatic_6="[c,n]1[c,n][c,n][c,n][c,n][c,n]1"
> aromatic_5="[c,n]1[c,n][c,n][c,n][c,n]1"
>
> pattern6=Chem.MolFromSmarts(aromatic_6)
> pattern5=Chem.MolFromSmarts(aromatic_5)
>
> print "Pattern 6 "
> lar = mol.GetSubstructMatch(pattern6)
> print lar
> print "Pattern 5 "
> lar = mol.GetSubstructMatch(pattern5)
> print lar
>
> The output should 3 aromatic six-membered rings and 1 aromatic
> five-membered ring. Instead I get only the first six-membered ring and no
> listing of the five-membered ring.:
>
> Pattern 6
> (0, 1, 3, 5, 7, 9)
> Pattern 5
> ()
>
> So basically, I can not get around the kekulize function. I looked the
> mol2 file (attached) and it correctly lists the bond types as aromatic for
> all of the rings. Is there a way to use the bond information from the mol2
> file to assign aromaticity?
>
> Thanks!!
>
> -Sergio
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss