Re: [Rdkit-discuss] useQueryQueryMatches with recursive SMARTS
Hi Greg, Thank you. After more thought I decided that query-to-query matching is not the best way to go for my task, regardless of what it does with recursive SMARTS, so don't lose sleep about it on my behalf. :-) Still, it's good to know about this behavior for future reference. Best, Ivan On Fri, Mar 9, 2018 at 12:13 AM, Greg Landrumwrote: > Hi Ivan, > > On Wed, Mar 7, 2018 at 8:58 PM, Ivan Tubert-Brohman schrodinger.com> wrote: > >> >> Is it reasonable to expect that a SMARTS should match itself when >> useQueryQueryMatches=True? >> > > Not my favorite kind of answer to give, but... "it depends" > > >> query = Chem.MolFromSmarts('[C;!$(C=O)]Cl') >> query.HasSubstructMatch(query, useQueryQueryMatches=True) >> >> The above returns False. Without useQueryQueryMatches, it returns True, >> but I think I need useQueryQueryMatches for my application because >> queries are not generally valid molecules, and in some cases >> HasSubstructMatch ends up raising exceptions (for example when the >> SMARTS specifies hydrogen counts). >> >> If I remove the recursive part of the SMARTS above, I get a match, so I >> suspect that the query-query search doesn't play well with recursive SMARTS. >> > > That is the expected, though not particularly nice, behavior. The code is > currently quite conservative about when it says that two queries match each > other: if it sees a recursive query it just says "no". > There may be a straightforward fix for this, but in general making the > query-query matcher more flexible is one of those "it would be so cool, but > it's s much work" projects, so I'm not going to make any promises. > > Best, > -greg > > > > >> Best, >> Ivan >> >> >> -- >> 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 >> >> > -- 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
Re: [Rdkit-discuss] useQueryQueryMatches with recursive SMARTS
Hi Ivan, On Wed, Mar 7, 2018 at 8:58 PM, Ivan Tubert-Brohman < ivan.tubert-broh...@schrodinger.com> wrote: > > Is it reasonable to expect that a SMARTS should match itself when > useQueryQueryMatches=True? > Not my favorite kind of answer to give, but... "it depends" > query = Chem.MolFromSmarts('[C;!$(C=O)]Cl') > query.HasSubstructMatch(query, useQueryQueryMatches=True) > > The above returns False. Without useQueryQueryMatches, it returns True, > but I think I need useQueryQueryMatches for my application because > queries are not generally valid molecules, and in some cases > HasSubstructMatch ends up raising exceptions (for example when the SMARTS > specifies hydrogen counts). > > If I remove the recursive part of the SMARTS above, I get a match, so I > suspect that the query-query search doesn't play well with recursive SMARTS. > That is the expected, though not particularly nice, behavior. The code is currently quite conservative about when it says that two queries match each other: if it sees a recursive query it just says "no". There may be a straightforward fix for this, but in general making the query-query matcher more flexible is one of those "it would be so cool, but it's s much work" projects, so I'm not going to make any promises. Best, -greg > Best, > Ivan > > > -- > 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 > > -- 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
[Rdkit-discuss] useQueryQueryMatches with recursive SMARTS
Hi, Is it reasonable to expect that a SMARTS should match itself when useQueryQueryMatches=True? query = Chem.MolFromSmarts('[C;!$(C=O)]Cl') query.HasSubstructMatch(query, useQueryQueryMatches=True) The above returns False. Without useQueryQueryMatches, it returns True, but I think I need useQueryQueryMatches for my application because queries are not generally valid molecules, and in some cases HasSubstructMatch ends up raising exceptions (for example when the SMARTS specifies hydrogen counts). If I remove the recursive part of the SMARTS above, I get a match, so I suspect that the query-query search doesn't play well with recursive SMARTS. Best, Ivan -- 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