Hello: Greg's suggestions worked out. Best, Markus On Fri, Sep 16, 2016 at 1:44 PM, Greg Landrum <greg.land...@gmail.com> 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 <metm...@gmail.com> 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 <greg.land...@gmail.com> >> wrote: >> >>> Hi Markus, >>> >>> >>> On Fri, Sep 16, 2016 at 11:35 AM, Markus Metz <metm...@gmail.com> 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]Cc1ccccc1 >>> [H]Cc1ccccc1 >>> >>> 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