0

I have a branched molecule just like in the Image (left one).

I want to add COOH at the end of each branch like Image (right one)

Image

Here is the SMILES format of my molecule in a simplified form with 4 branches.

[N:1]([CH2:2][CH2:3][N:4]([CH2:47][CH2:48][CH:49]([NH:50][CH2:51][CH2:52][NH2:53])[O-:55])[CH2:66][CH2:67][CH:68]([NH:69][CH2:70][CH2:71][NH2:72])[O-:74])([CH2:9][CH2:10][CH:11]([NH:12][CH2:13][CH2:14][NH2:15])[O-:17])[CH2:28][CH2:29][CH:30]([NH:31][CH2:32][CH2:33][NH2:34])[O-:36]

I actually have a much bigger molecule but if i can find a way to do it with the simple one, i think i can extend the solution to the bigger one.

Here is a code example

mod_mol = Chem.ReplaceSubstructs(m, 
                                 Chem.MolFromSmiles('[NH2:34]'), 
                                 Chem.MolFromSmiles('[CH2:99]'),
                                 replaceAll=True)
mod_mol[0]

for example i tried to change NH2 to CH2 but nothing happens.

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
  • In the post SMILES format doesnt pasted correctly. Here it is [N:1]([CH2:2][CH2:3][N:4]([CH2:47][CH2:48][CH:49]([NH:50][CH2:51][CH2:52][NH2:53])[O-:55])[CH2:66][CH2:67][CH:68]([NH:69][CH2:70][CH2:71][NH2:72])[O-:74])([CH2:9][CH2:10][CH:11]([NH:12][CH2:13][CH2:14][NH2:15])[O-:17])[CH2:28][CH2:29][CH:30]([NH:31][CH2:32][CH2:33][NH2:34])[O-:36] – Aykut Elmas Dec 07 '21 at 13:59
  • 1
    Please add information to your question by hitting the `edit` button, don't post corrections/additions to your question in the comments – FlyingTeller Dec 07 '21 at 14:11
  • Have you tried `Chem.ReplaceSubstructs()`? – rapelpy Dec 07 '21 at 20:09
  • i tried afrer your advice but i get an error. ArgumentError: Python argument types in rdkit.Chem.rdmolops.ReplaceSubstructs(Mol, NoneType, Mol) did not match C++ signature: – Aykut Elmas Dec 08 '21 at 17:28
  • @AykutElmas Seems to be the SMARTS you use. Could you please put a sample code in your question. For me `ReplaceSubstructs` works. – rapelpy Dec 08 '21 at 18:42
  • @raplepy sorry for the late answer. I edited my question as you wish. And added a code example. I hope it helps. I am really stuck. – Aykut Elmas Dec 13 '21 at 09:26
  • @AykutElmas The part to be replaced must be a SMARTS `Chem.MolFromSmarts('[NH2:34]')`. – rapelpy Dec 13 '21 at 11:17
  • Thank you for your help. I solved the problem. – Aykut Elmas Dec 13 '21 at 12:02
  • @rapelpy Hey friend. You look like somebody know about rdkit. I have another question about rdkit but no one answered it. Can i ask you? – Aykut Elmas Dec 14 '21 at 09:51

1 Answers1

1

In general, it is helpful to observe where the error shows a Nonetype. In this case,

rdkit.Chem.rdmolops.ReplaceSubstructs(Mol, NoneType, Mol)

The issue was caused because Chem.MolFromSmiles was provided with a SMARTS string, like this:

`Chem.MolFromSmiles('[NH2:34]')`

The solution is to use a Chem.MolFromSmarts instead, like this:

Chem.MolFromSmarts('[NH2:34]')
Vandan Revanur
  • 459
  • 6
  • 17