Re: [Rdkit-discuss] AllChem.DeleteSubstructs question

2016-09-16 Thread Markus Metz
Hello:
Greg's suggestions worked out.
Best,
Markus

On Fri, Sep 16, 2016 at 1:44 PM, Greg Landrum 
wrote:

> Glad to hear it. Would you mind replying to the list as well so that the
> thread is closed?
>
> Best,
> -greg
>
>
> On Fri, Sep 16, 2016 at 1:33 PM, Markus Metz  wrote:
>
>> Hi Greg:
>> Just tried it out and it works great.
>> Thank you very much!
>> Markus
>>
>> On Fri, Sep 16, 2016 at 12:21 PM, Greg Landrum 
>> wrote:
>>
>>> Hi Markus,
>>>
>>>
>>> On Fri, Sep 16, 2016 at 11:35 AM, Markus Metz  wrote:
>>>
 Hello everybody:

 I am working on a script which removes the cores based on a given
 pattern and I am wondering how I can accomplish that if two matches are
 present in the parent molecule two outputs are generated with each matching
 pattern deleted once.

 ReplaceSubstructs seems to have an option like this: replaceAll=False

>>>
>>> Indeed, adding that option to DeleteSubstructs() is a good idea.
>>>
>>> I tried to use replaceSubstructs but using H as smiles string for
 replacement threw me an error.
 C worked.

>>>
>>> The problem here may have been that you neglected the square brackets
>>> around the 'H' in the SMILES?
>>> This seems to work:
>>>
>>> repl = Chem.MolFromSmiles('[H]')
>>>
>>> frags = AllChem.ReplaceSubstructs(mol,pattern,repl)
>>>
>>>
>>>
>>> for frag in frags:
>>>
>>> print(Chem.MolToSmiles(frag))
>>>
>>>
>>>
>>> [H]Cc1c1
>>> [H]Cc1c1
>>>
>>> Probably you want to call Chem.RemoveHs() on the outputs so that those
>>> Hs disappear.
>>> This isn't a great long-time solution (that is going to require the
>>> changes to DeleteSubstructs()), but it may help in the short term.
>>>
>>> -greg
>>>
>>>
>>>
 I have attached a notebook for you to better understand what I mean.

 Any suggestion you might have would be highly appreciated.

 Cheerio,

 Markus

 
 --

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


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


Re: [Rdkit-discuss] AllChem.DeleteSubstructs question

2016-09-16 Thread Greg Landrum
Hi Markus,


On Fri, Sep 16, 2016 at 11:35 AM, Markus Metz  wrote:

> Hello everybody:
>
> I am working on a script which removes the cores based on a given pattern
> and I am wondering how I can accomplish that if two matches are present in
> the parent molecule two outputs are generated with each matching pattern
> deleted once.
>
> ReplaceSubstructs seems to have an option like this: replaceAll=False
>

Indeed, adding that option to DeleteSubstructs() is a good idea.

I tried to use replaceSubstructs but using H as smiles string for
> replacement threw me an error.
> C worked.
>

The problem here may have been that you neglected the square brackets
around the 'H' in the SMILES?
This seems to work:

repl = Chem.MolFromSmiles('[H]')

frags = AllChem.ReplaceSubstructs(mol,pattern,repl)



for frag in frags:

print(Chem.MolToSmiles(frag))



[H]Cc1c1
[H]Cc1c1

Probably you want to call Chem.RemoveHs() on the outputs so that those Hs
disappear.
This isn't a great long-time solution (that is going to require the changes
to DeleteSubstructs()), but it may help in the short term.

-greg



> I have attached a notebook for you to better understand what I mean.
>
> Any suggestion you might have would be highly appreciated.
>
> Cheerio,
>
> Markus
>
> 
> --
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] AllChem.DeleteSubstructs question

2016-09-16 Thread Markus Metz
Hello everybody:

I am working on a script which removes the cores based on a given pattern
and I am wondering how I can accomplish that if two matches are present in
the parent molecule two outputs are generated with each matching pattern
deleted once.

ReplaceSubstructs seems to have an option like this: replaceAll=False

I tried to use replaceSubstructs but using H as smiles string for
replacement threw me an error.
C worked.

I have attached a notebook for you to better understand what I mean.

Any suggestion you might have would be highly appreciated.

Cheerio,

Markus


test.ipynb
Description: Binary data
--
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss