Ah, great thanks Paolo! On Fri, Jul 22, 2022 at 11:44 AM Paolo Tosco <paolo.tosco.m...@gmail.com> wrote:
> Hi Susan, > > If you use [#1] in your SMARTS query, for your molecule to match there > should be a real hydrogen atom in your molecule graph, while in your > molecule you only have implicit hydrogens, unless you explicitly add them > calling Chem.AddHs(): > > print(Chem.AddHs(m).HasSubstructMatch(q)) > True > > Cheers, > p. > > On Fri, Jul 22, 2022 at 12:13 PM Susan Leung <susanhle...@gmail.com> > wrote: > >> Hi all, >> >> >> >> I am trying to do substructure search using query atom lists, but I am >> seeing unexpected behaviour when I have hydrogen in my query atom list… >> >> >> >> import rdkit >> >> print(rdkit.__version__) >> >> from rdkit import Chem >> >> >> >> >>2022.03.2 >> >> >> >> ## having carbon in the query atom list seems to work as expected >> >> q = Chem.MolFromSmarts('[#17,#6]-[#6]-[#17]') >> >> m = Chem.MolFromSmiles('ClCCl') >> >> print(m.HasSubstructMatch(q)) >> >> m = Chem.MolFromSmiles('CCCl') >> >> print(m.HasSubstructMatch(q)) >> >> >> >> >>True >> >> >>True >> >> >> >> ## having hydrogen in the query atom list doesn't work as expected >> >> q = Chem.MolFromSmarts('[#17,#1]-[#6]-[#17]') >> >> m = Chem.MolFromSmiles('ClCCl') >> >> print(m.HasSubstructMatch(q)) >> >> m = Chem.MolFromSmiles('CCl') >> >> print(m.HasSubstructMatch(q)) >> >> >> >> >>True >> >>False >> >> >> >> Best wishes, >> >> >> >> Susan >> _______________________________________________ >> 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