Substructure replacement using RDKit #4231
Unanswered
Sowmya-R-Krishnan
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all. I was trying to write a function to replace a specific instance of a substructure using RDKit. For example, the following molecule has 2 benzene rings: CCC(=O)C(CC(C)N(C)C)(c1ccccc1)c1ccccc1
I want to specifically replace the benzene ring attached to the 12th atom with a furan ring. I have written the following function based on RDKit documentation.
Here, core_mol is the SMILES of the molecule, pattern_mol is the functional group to be replaced (c1ccccc1 for benzene) and replace_with is the new functional group (c1ccoc1 for furan). On using the above function, only the first instance of the benzene ring is replaced.
Before replacement
![image1](https://github.com/Sowmya-R-Krishnan/Substructure_replacement/blob/main/Orig_molecule.png)
After replacement
![image2](https://github.com/Sowmya-R-Krishnan/Substructure_replacement/blob/main/New_molecule.png)
In the above image, I want to replace the second benzene connected to 12th atom. I'm not able to understand how to use the function when there are multiple instances of the same substructure (benzene) in the molecule. Is this possible in RDKit? Any suggestions would be really helpful.
Beta Was this translation helpful? Give feedback.
All reactions