Hi, Thanks a lot for the reply! However, in this case, it looks like I would have to somehow label the isotope in every query molecule, right? For example: ``` template = Chem.MolFromSmarts('[c]1(-[2S](=[3O])(=[3O])(-C)):[c]:[c]:[c]:[c]:[c]:1') mol1 = Chem.MolFromSmiles('CS(=O)(=O)c1ccc(C2=C(c3ccccc3)CCN2)cc1') compare = [template,mol1] res = rdFMCS.FindMCS(compare, atomCompare=rdFMCS.AtomCompare.CompareIsotopes, bondCompare=rdFMCS.BondCompare.CompareAny, ringMatchesRingOnly=False, completeRingsOnly=False) res.smartsString ``` returns: '[0*]1:[0*]:[0*]:[0*]:[0*]:[0*]:1', that is, it only picks the ring but not the sulfone. I actually want the sulfone to be found, if it is there. My problem is that I also want flexibility to change the ring atoms and still find the ring as a match, while considering a match on the sulfone only if it really is there. (e.g., CF3 should *not* match.) Does it make sense?
Thanks a lot! -- Gustavo Seabra. On Thu, Jul 22, 2021 at 4:52 PM Andrew Dalke <da...@dalkescientific.com> wrote: > Hi Gustavo, > > > > template = > Chem.MolFromSmarts('[a]1(-[S](-*)(=[O])=[O]):[a]:[a]:[a]:[a]:[a]:1') > > Unless things have changed since I last looked at the algorithm, you can't > meaningfully pass a SMARTS-based query molecule into the MCS program, > outside of a few simple cases. > > It generates a SMARTS pattern based on the properties of the molecule. You > asked it to CompareElements, but those [a] terms all have an atomic number > of 0. > > >>> template = > Chem.MolFromSmarts('[a#1]1(-[S](-*)(=[O])=[O]):[a#1]:[a#1]:[a#1]:[a#1]:[a#1]:1') > >>> [a.GetAtomicNum() for a in template.GetAtoms()] > [0, 16, 0, 8, 8, 0, 0, 0, 0, 0] > > That's why your CompareAny search returns the #0 terms, like: > > > '[#16,#6](-[#0,#6])(=,-[#8,#9])(=,-[#8,#9])-[#0,#6]1:[#0,#6]:[#0,#6]:[#0,#6]:[#0,#6]:[#0,#7]:1' > > > I would appreciate some pointers on how it would be possible to find the > maximum common substructure of 2 molecules, where in the template structure > some atoms may be *any*, but some other atoms must be fixed. > > Perhaps with isotope labelling? > > That is, label the "any" atoms as isotope 1, and label your > -[S](=[O])(=[O])- as -[2S](=[3O])(=[3O])- > > Then use rdFMCS.AtomCompare.CompareIsotopes . > > If there's anything you don't want to match at all, give each atom a > unique isotope value. > > Best regards, > > Andrew > da...@dalkescientific.com > > >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss