Dear Jan,
this gist shows a way to do what you need:
https://gist.github.com/ptosco/9b4a637a2814426846fe181f15aa8cdc
Basically, you'll need to convert explicit Hs into real atoms. Please
note that indices in the tuple obtained in the match with hydrogens
still apply to the original molecules without hydrogens, as hydrogens
are added after all heavy atoms.
Hope that helps, kind regards
Paolo
On 01/29/18 08:23, Jan Halborg Jensen wrote:
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
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss