Dear Cedric,

On Wed, May 26, 2010 at 5:12 PM, Cedric MORETTI
<cedric.more...@firmenich.com> wrote:
> Hello
> I'd like to know if it was possible to search in RDKIT which would isolate
> any cycles.
> I thought the search for chemical moiety "C1" or "C1" and save the file with
> these molecules.
> The more complicated now.
> Is it possible to find fragments containing only the cycle and the cycle?
>
> Basically I have a database with 70,000 molecules and I want to have the
> cyclic fragments contained in the database.
> If you have an idea to help me thank you.

I'm not sure I've understood the question, but I will try:
If you want to identify the cyclic fragements, the simplest thing to
do is to use the function Chem.DeleteSubstructs to remove all
non-cyclic atoms:
[1]>>> from rdkit import Chem
[2]>>> p = Chem.MolFromSmarts('[!r]')   #<- this query matches any
non-ring atoms
[3]>>> m=Chem.MolFromSmiles('Cc1ccccc1OCC')
[4]>>> m2=Chem.DeleteSubstructs(m,p)
[5]>>> Chem.MolToSmiles(m2)
Out[5] 'c1ccccc1'

In the case of molecules without cycles, this removes everything:
[6]>>> m3 = Chem.MolFromSmiles('CCC')
[7]>>> m4=Chem.DeleteSubstructs(m3,p)
[8]>>> Chem.MolToSmiles(m4)
Out[8] ''

And for linked rings, it leaves you with multiple pieces:
[9]>>> m5 = Chem.MolFromSmiles('C1CC1CCc1ccc(CC)cc1')
[10]>>> m6=  Chem.DeleteSubstructs(m5,p)
[11]>>> Chem.MolToSmiles(m6)
Out[11] 'c1ccccc1.C1CC1'

Which you could split into separate molecules if you wanted to:
[14]>>> frags = Chem.GetMolFrags(m6,asMols=True)
[15]>>> frags
Out[15]
(<rdkit.Chem.rdchem.Mol object at 0xa637e64>,
 <rdkit.Chem.rdchem.Mol object at 0xa64c064>)
[16]>>> [Chem.MolToSmiles(x) for x in frags]
Out[16] ['C1CC1', 'c1ccccc1']

Is this what you were looking for?

-greg

------------------------------------------------------------------------------

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to