The canonicalizer doesn't treat hydrogens any differently than any other
atom, but they have to be in the graph.  If you are starting from smiles,
simply add explicit hydrogens, python example below:

>>> from rdkit import Chem

>>> m = Chem.MolFromSmiles("CC")

>>> mh = Chem.AddHs(m)

>>> Chem.MolToSmiles(mh)

'[H]C([H])([H])C([H])([H])[H]'

>>> order = eval(mh.GetProp("_smilesAtomOutputOrder"))

# safer non eval version...

>>> order = mh.GetPropsAsDict(includePrivate=True,


includeComputed=True)['_smilesAtomOutputOrder']

>>> list(order)

[2,0,3,4,1,5,6,7]

>>>

Not that the output order is from the context of the output smiles string,
i.e. order[0] is the index of the original atom index that was the outputs
first atom and so on.  I.e. order[output_atom_idx] = input_atom_idx

On Thu, Mar 10, 2016 at 6:27 AM, Michal Krompiec <[email protected]>
wrote:

> Hello,
> I need a "canonical" method for generating atom indices for a given
> molecule (with 3D coordinates, so the input is e.g. a mol file), for a
> molecular descriptor which should be invariant with respect to atom
> indexing. As I understand, canonical SMILES will give the same atom indices
> for non-hydrogen atoms, but is there a way in RDKit to generate unique
> indices for hydrogens as well?
> Best regards,
> Michal
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to