Re: [Rdkit-discuss] non-smallest rings

2013-01-22 Thread Paul Emsley
On 22/01/13 05:40, Greg Landrum wrote:
 Hi Paul,

 On Mon, Jan 21, 2013 at 4:13 PM, Paul Emsley pems...@mrc-lmb.cam.ac.uk 
 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

 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?
 There's not currently any RDKit functionality which finds all rings.
 It wouldn't be terribly difficult to add, but it could return a huge
 number of rings (imagine the results for C60). Another option would be
 to add a function
 bool atomIsInAnyRingOfSize(const Atom *at,unsigned int size)
 that does the check on demand.

Not terribly difficult, as you say, but easier for you than me, I 
imagine.  I had a bash with the trace_path() and 
handle_bigger_rings_from_fused_rings() methods, for the record, here:

http://code.google.com/p/coot/source/browse/trunk/lidia-core/cod-types.cc

I'll try and get it released under the same licence as the RDKit, fwtw. 
The thing that was non-trivial (for me) was the shall we recur deeper? 
rule.

Cheers,

Paul.



--
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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] non-smallest rings

2013-01-22 Thread Patrick Walters
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 pems...@mrc-lmb.cam.ac.ukwrote:


 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=**0CPhttp://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
 Rdkit-discuss@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


--
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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] non-smallest rings

2013-01-22 Thread Greg Landrum
On Wed, Jan 23, 2013 at 2:47 AM, Patrick Walters wpwalt...@gmail.com wrote:
 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)]

Or you can do it that easy way right away.
(I'm smacking myself for not thinking of that...)

Thanks Pat!
-greg

--
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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] non-smallest rings

2013-01-21 Thread Stiefl, Nikolaus
do you just have to check if an atom is in a 6-membered ring? If so then


In [8]: m = 
Chem.MolFromSmiles('COc1ccc(cc1O[C@H]1C[C@@H]2CC[C@H]1C2)C1CNC(=O)NC1')

In [9]: [a.IsInRingSize(6) for a in m.GetAtoms()]
Out[9]: 
[False,
 False,
 True,
 True,
 True,
 True,
 True,
 True,
 False,
 False,
 False,
 False,
 False,
 False,
 False,
 False,
 True,
 True,
 True,
 True,
 False,
 True,
 True]

Should help.

Sorry - maybe I do not fully understand your question

Ciao
Nik

On 1/21/13 4:13 PM, Paul Emsley pems...@mrc-lmb.cam.ac.uk 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

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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


--
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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss