[Rdkit-discuss] atom mapping using GetSubstructMatch
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Jan H. J. <jhj...@ch...> - 2018-01-29 08:38:12
|
I am trying to map atoms in one molecule to those of another using GetSubstructMatch, but have a problem with molecule pairs like the two below The problem is that GetSubstructMatch ignored the H on the n, so that the protonated “n" in mol1 is mapped to the deprotonated “n” in mol2, and vice versa Is there a way to fix this? Best regards, Jan smiles1 = "ClCc1[nH]c(c2n1)cccc2" smiles2 = "c1(I)cc(I)c2c(c1)nc(CCl)[nH]2" mol1 = Chem.MolFromSmiles(smiles1) mol2 = Chem.MolFromSmiles(smiles2) order_mol1 = list(mol1.GetSubstructMatch(mol1)) order_mol2 = list(mol2.GetSubstructMatch(mol1)) print order_mol2 atom_map = dict(zip(order_mol1,order_mol2)) print atom_map Draw.DrawingOptions.includeAtomNumbers=True img = Draw.MolsToGridImage([mol1,mol2],molsPerRow=4,subImgSize=(200,200),useSVG=False) img |