The reply that Ling forwards has one approach to doing this. It's a bit easier for someone who is willing to do some C++ work.[1]
One could imagine writing a function prepareForResonanceFormMatching(ROMol &m) (or some such thing) that would be applied to the *query* molecule that does the following: - identifies the groups that need to be resonance-symmetrized - changes the resonance bonds to Query bonds that match single or double (possibly also aromatic?) - neutralizes any charges on resonating atoms in the group. The last step is important because the query C(O)O matches the molecule C(O)[O-] twice, but C(O)[O-] only matches once: In [11]: Chem.MolFromSmiles('C(O)[O-]').GetSubstructMatches(Chem.MolFromSmiles('C(O)O'),uniquify=False) Out[11]: ((0, 1, 2), (0, 2, 1)) In [12]: Chem.MolFromSmiles('C(O)[O-]').GetSubstructMatches(Chem.MolFromSmiles('C([O-])O'),uniquify=False) Out[12]: ((0, 2, 1),) I suspect such a function would be useful to multiple people. For identifying the groups that are resonance symmetrized: though this could be done using a set of particular patterns, it may be better to think about doing it more generally by having it find resonance systems.[2] The flag Bond.getIsConjugated(), set during sanitization, is probably useful for this. -greg [1] well, to the extent that anything is ever "easier" in C++ [2] this would allow finding the substructure matches within molecules like C1=C(C)C=CC=CC=C1 On Fri, Oct 31, 2014 at 2:09 AM, S.L. Chan <slch...@yahoo.com> wrote: > Dear Paolo, > > I have asked a very similar question last year. This was what Greg said. > > Ling > > Re: [Rdkit-discuss] atom equivalence for substructure matching > <http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg03515.html> > > > [image: image] > <http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg03515.html> > > > > > > Re: [Rdkit-discuss] atom equivalence for substructure ma... > <http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg03515.html> > Skip to site navigation (Press enter) > View on www.mail-archive.com > <http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg03515.html> > Preview by Yahoo > > > ------------------------------ > *From:* Paolo Tosco <paolo.to...@unito.it> > *To:* "rdkit-discuss@lists.sourceforge.net" < > rdkit-discuss@lists.sourceforge.net> > *Sent:* Thursday, October 30, 2014 4:26 PM > *Subject:* [Rdkit-discuss] GetSubstructMatches() and resonance structures > > Dear all, > > The following code snippet compares two resonance structures of formate > anion: > > import rdkit > from rdkit import Chem > > mol1=Chem.MolFromSmiles('C([O-])=O') > mol2=Chem.MolFromSmiles('C(=O)[O-]') > mol1.GetSubstructMatches(mol2, uniquify = False) > ((0, 2, 1),) > > mol1.GetSubstructMatches(mol1, uniquify = False) > ((0, 1, 2),) > > I would rather like to get, in both cases, the following output: > ((0, 1, 2),(0, 2, 1)) > > which would account for the carboxylate group symmetry due to resonance. > The same applies to amidinium, guanidinium, etc. > > Is that currently feasible within the RDKit API? > > Thanks in advance, cheers > Paolo > > > > ------------------------------------------------------------------------------ > _______________________________________________ > 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 mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss