Hey All,
I am chopping parts out of molecules and picking up the pieces using the
Chem.GetMolFrags() function.
I would like to separate fragments into distinct mol objects but keep the
original atom indexes however setting the asMols=True flag seems to reset
the indexes, is this expected behaviour? Is there a way around this?
Here's some code:
In [1]: from rdkit import Chem
In [2]: m = Chem.MolFromSmiles('c1ccccc1.CCO')
In [3]: Chem.GetMolFrags(m)
Out[3]: ((0, 1, 2, 3, 4, 5), (6, 7, 8)) <----- desired indexes
In [4]: frags = Chem.GetMolFrags(m, asMols=True)
In [5]: for frag in frags:
...: print([a.GetIdx() for a in frag.GetAtoms()])
...:
[0, 1, 2, 3, 4, 5]
[0, 1, 2] < ------ indexes have been reset
Many thanks in advance,
Josh
------------------------------------------------------------------------------
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