Hello: I am puzzled by the output from ReplaceSubstructs as it can produce two fragments. So I went and tried the examples in the manual and I observed this: The example in the intro manual with the recursive smarts pattern works as expected. repl = Chem.MolFromSmiles('OC') patt = Chem.MolFromSmarts('[$(NC(=O))]') m = Chem.MolFromSmiles('CC(=O)N') rms = AllChem.ReplaceSubstructs(m,patt,repl) One expected product is formed.
The example form the ReplaceSubstructs manual produces two solutions. I have used the following commands: from rdkit import Chem from rdkit.Chem import AllChem #ReplaceSubstructs(‘CCOC’,’OC’,’NC’) -> (‘CCNC’,) repl = Chem.MolFromSmiles('NC') patt = Chem.MolFromSmarts('OC') m = Chem.MolFromSmiles('CCOC') rms = AllChem.ReplaceSubstructs(m,patt,repl) for rm in rms: print(CHem.MolToSmiles(rm)) output is: C.CNC and CCNC Why is the first result produced? I checked the mailing list and could find this older threat https://sourceforge.net/p/rdkit/mailman/message/28777648/. But the answer to the related question is missing. rdkit version is 2020.03.1dev1 Best wishes, Markus
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss