[Rdkit-discuss] reassembling a molecule from R-groups

2018-04-15 Thread Patrick Walters
Hi All, I was about to write a function to reassemble a molecule from a core + R-groups, but I thought I'd check and see if such a function already exists. This is work with the output of rdRGroupDecomposition Gvien a core: CN(C)CC(Br)c1cc([*:2])c([*:1])cn1 Plus a set of R-groups

Re: [Rdkit-discuss] reassembling a molecule from R-groups

2018-04-15 Thread Andrew Dalke
Hi Pat, I wrote something like this for mmpdb, which is the MMPA code I helped develop, at https://github.com/rdkit/mmpdb . It has one restriction, which I'll get to in a moment. The general idea is to convert the attachment points to closures, join them with a ".", and canonicalize: >>>

Re: [Rdkit-discuss] reassembling a molecule from R-groups

2018-04-15 Thread Patrick Walters
Thanks Andrew, the SMILES approach seemed to have quite a few edge cases so I wrote something to work directly on a molecule. #!/usr/bin/env python import sys from rdkit import Chem from collections import defaultdict from rdkit.Chem.rdchem import EditableMol # Thanks to steeveslab-blog for

Re: [Rdkit-discuss] reassembling a molecule from R-groups

2018-04-15 Thread Greg Landrum
Ah, I'm replying too late... sorry about that. There's a command line utility in rdkit.Chem.ChemUtils.TemplateExpand that could also be used for this purpose. The big difference is that it uses isotope labels on the dummy atoms to do the matching. A style point: you can now create an RWMol