Re: [Rdkit-discuss] non-smallest rings
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Patrick W. <wpw...@gm...> - 2013-01-23 01:47:07
|
If you're just looking for 6 membered rings, you can define a SMARTS that matches 6 membered rings like this "*1~*~*~*~*~*1". You can also use this approach to identify all rings (at least those within reason). You can use an expression like this ["*1"+string.join(["*~"]*x,"")+"*1" for x in range(1,19)] to generate SMARTS for all rings with size 3 to 20. Now you can match these to your molecule and get all of the rings (example below). import string from rdkit import Chem class RingFinder: def __init__(self): self.ringSmartsList = ["*1"+string.join(["*~"]*x,"")+"*1" for x in range(1,19)] self.ringPatList = [(x.count("*"),Chem.MolFromSmarts(x)) for x in self.ringSmartsList] def findAllRings(self,mol): ringList = [] for size,pat in self.ringPatList: for match in mol.GetSubstructMatches(pat): ringList.append([size,match]) return ringList ringFinder = RingFinder() smiles = "COc1ccc(cc1O[C@H]1C[C@@H]2CC[C@H]1C2)C1CNC(=O)NC1" mol = Chem.MolFromSmiles(smiles) print ringFinder.findAllRings(mol) If you run this you'll get two 5 membered rings and 3 six membered rings for the molecule above. Pat On Mon, Jan 21, 2013 at 10:13 AM, Paul Emsley <pe...@mr...>wrote: > > I am making heavy weather of the following problem - and am wondering if I > am missing something (such as a useful RDKit function). > > I am working on this beasty (as an example): > > http://www.rcsb.org/pdb/**ligand/ligandsummary.do?hetId=**0CP<http://www.rcsb.org/pdb/ligand/ligandsummary.do?hetId=0CP> > > COc1ccc(cc1O[C@H]1C[C@@H]2CC[**C@H]1C2)C1CNC(=O)NC1 > > which has a norbornane substituent. I am trying to prepare input for a > downstream program that needs to know if the norbornane atoms are in a > 6-membered ring [1]. RingInfo gives me the 2 5-membered rings. I am > strugging to make use of that information to find 6-membered rings. I have > been using makeRingNeighborMap() and pickFusedRings(). Am I missing an > RDKit function that finds all rings? > > Cheers, > > Paul. > > > [1] actually, all atoms but it is the norbornane atoms with which I > struggle. > > > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. SALE $99.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122412 > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |