[Rdkit-discuss] DeleteSubstructs vs ReplaceSubstructs
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Popov, M. (Ext) <max...@no...> - 2017-03-31 05:42:13
|
Dear RDKit users,
I am trying to remove a common substructure from a number of molecules (with AllChem.DeleteSubstructs). My problem is best illustrated by this short code:
from rdkit import Chem
from rdkit.Chem import AllChem
m=Chem.MolFromSmiles('C1(C2=NC=CC=C2)=CC=CC(C)=C1')
ss = Chem.MolFromSmiles('C1=CC=CC(C)=C1')
hyd=Chem.MolFromSmiles('[H]')
print("Substituting substructure with hydrogen")
frags = AllChem.ReplaceSubstructs(m, ss,hyd)
for frag in frags:
print(Chem.MolToSmiles(frag))
print("\nDeleting substructure")
frag = AllChem.DeleteSubstructs(m, ss)
print(Chem.MolToSmiles(frag))
I create a toluene connected to pyridine and try to remove toluene.
When replacing toluene substructure with hydrogen (AllChem.ReplaceSubstructs), I receive two sets of results: pyridine (with explicit hydrogen) and single carbon plus single hydrogen plus aromatic open chain (what is left from pyridine after removing one ring atom).
When deleting the toluene substructure (AllChem.DeleteSubstructs), I receive just the open chain of ex-pyridine (corresponding to second set of the ReplaceSubstructs results).
Is there a way of directing DeleteSubstructs method to a specific variant (in this case, leaving pyridine as a ring seems to be logical).
Best regards,
Maxim
|