Hi JP,
On Thu, Jan 24, 2013 at 7:06 PM, JP <[email protected]> wrote:
> Hola RDkitters,
>
> I have a number of analogue molecules (how lucky) - from which I can extract
> a scaffold using Dalke's MCS code (great piece of work, btw).
>
> I would like to identify each R group from each molecule. My current idea
> which I wanted to bounce with you was, for every molecule that I have:
>
> 0. Substructure search for the MCS scaffold, this will give ma a set of atom
> ids.
> 1. For every atom id above find if it is connected to something else (so get
> neighbours and check for indices which are not in the MCS scaffold set)
> 2. If there is a connection to an R group break that bond
> 3. Somehow (how?) retrieve the fragment part and label it Rn (I need to have
> distinct sets; R1 R2 R3 etc.)
>
> Is there a better way to do this? Am I missing something?
That's pretty much what I would do. Fortunately, you don't have to
code it, because it's already there:[1]
In [2]: core = Chem.MolFromSmiles('c1cccc2c1[nH]cc2')
In [3]: mol = Chem.MolFromSmiles('c1c(O)c(C)cc2c1n(CC)cc2')
In [4]: chains = Chem.ReplaceCore(mol,core,labelByIndex=True)
In [5]: pieces = Chem.GetMolFrags(chains,asMols=True)
In [6]: [Chem.MolToSmiles(x,True) for x in pieces]
Out[6]: ['[1*]O', '[2*]C', '[6*]CC']
There's a bit more text about this in the GettingStarted document:
http://www.rdkit.org/docs/GettingStartedInPython.html#substructure-based-transformations
-greg
[1] I love being able to give that answer. Thanks! :-)
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss