On Dec 9, 2015, at 1:53 PM, chris dalton wrote:
> I have fragmented a molecule using GetMolFrags and want to relate the atoms
> in the fragments to the original molecule. However, each fragment appears to
> start at atom index 0 which prevents direct comparison with the original
> atoms.
One solution is to set a user-defined property before you split the molecule.
I'll use an odd way to write ethane with a dot-disconnected SMILES to show it
in action:
>>> mol = Chem.MolFromSmiles("C1.[NH4+].C1")
>>> Chem.GetMolFrags(mol)
((0, 2), (1,))
>>> frags = Chem.GetMolFrags(mol, True)
>>> frags
(<rdkit.Chem.rdchem.Mol object at 0x10c556668>, <rdkit.Chem.rdchem.Mol object
at 0x10c5566e0>)
>>> for frag in frags:
... print "indices", [atom.GetProp("original_index") for atom in
frag.GetAtoms()]
...
indices ['0', '2']
indices ['1']
Another solution is to do GetMolFrags() twice; once to get the atom indices and
another to get the molecules. As far as I can tell, and as you can see in the
above, the order is consistent.
Andrew
[email protected]
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss