Hi
Maybe this is much less efficient but I guess if you need it for specific 
isotopes then you could try using a smarts pattern and check for that?

In [20]: q = Chem.MolFromSmarts("[13C,14C,2H,3H,15N,24P,46P,33S,34S,36S]")

In [21]: m = Chem.MolFromSmiles('CC[15NH2]')

In [22]: m.HasSubstructMatch(q)
Out[22]: True


So you could loop over your molecules and then remove the ones that match the 
smarts.
Ciao
Nik


From: Milinda Samaraweera <milindaatw...@gmail.com>
Date: Wednesday 18 January 2017 at 20:47
To: Greg Landrum <greg.land...@gmail.com>
Cc: RDKit Discuss <rdkit-discuss@lists.sourceforge.net>
Subject: Re: [Rdkit-discuss] Check for Heavy Isotopes using RdKit

Greg,
I am looking to remove entries that contain un-stable isotopes of elements 
CHNOPS (e.g. heavy_isotopes =['13C', '14C', '2H', '3H', '15N', '24P', '46P', 
'33S', '34S', '36S'] ). Is there a way to modify the above code to achieve that?
Thanks,
Milinda


On Wed, Jan 18, 2017 at 11:16 AM, Greg Landrum 
<greg.land...@gmail.com<mailto:greg.land...@gmail.com>> wrote:
Hi Milinda,

Here's an approach that finds all the atoms that have an isotope specified:

In [1]: from rdkit import Chem

In [2]: from rdkit.Chem import rdqueries

In [3]: q = rdqueries.IsotopeGreaterQueryAtom(1)

In [7]: list(x.GetIdx() for x in 
Chem.MolFromSmiles('CC[13CH3]').GetAtomsMatchingQuery(q))
Out[7]: [2]

In [8]: list(x.GetIdx() for x in 
Chem.MolFromSmiles('[12CH3]CC[13CH3]').GetAtomsMatchingQuery(q))
Out[8]: [0, 3]

Does that do what you want it to do?

-greg



On Wed, Jan 18, 2017 at 3:56 PM, Milinda Samaraweera 
<milindaatw...@gmail.com<mailto:milindaatw...@gmail.com>> wrote:
Dear Experts,
I am trying to figure out a way to exclude entries which contain heavy atoms 
(13C, 2H, 3H, etc), from a SD file (which has close to two thousand entries) 
and write an updated file with the remaining entries.

I do understand how to read/write SD files using rdkit.

What I do understand is how to detect entries with heavy isotopes: Is there an 
efficient and correct way of achieving this using rdkit?

thanks,
--
Milinda Samaraweera

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss




--
Milinda Samaraweera, Ph.D.
Postdoctoral Fellow, Department of Pharmacy
University of Connecticut
69 North Eagleville road
Storrs, CT, 06269
milindaatw...@gmail.com<mailto:milindaatw...@gmail.com>
860-617-8046
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to