Jean-Marc,
  This is very non-obvious, but here is how you can do it from python:

>>> from rdkit import Chem

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

>>> Chem.MolToSmiles(m)

'CCCN'

>>> m.GetProp("_smilesAtomOutputOrder")

'[3,2,1,0,]'



Note that this returns the list as a string which is sub-optimal.
GetPropsAsDict will convert these to proper python objects, however, this
is considered a private member so you need to return these as well:

>>> list(m.GetPropsAsDict(True,True)["_smilesAtomOutputOrder"])

[3, 2, 1, 0]


I'm converting to a list here to show the output, this is really a wrapped
vector but it can be used as a sequence.  Hope this helps.  Note that you
can just dump out the dictionary for any object with SetProp:

>>> m.GetPropsAsDict(True,True)

{'_smilesAtomOutputOrder': <rdkit.rdBase._vectj object at 0x10a8d20f0>,
'numArom': 0, '_StereochemDone': 1, '__computedProps':
<rdkit.rdBase._vectSs object at 0x10a8d2090>}

And see some of how the sausage is made inside.

Cheers,
 Brian

On Sun, Dec 18, 2016 at 12:19 PM, Jean-Marc Nuzillard <
jm.nuzill...@univ-reims.fr> wrote:

> Hi all,
>
> maybe my question has been already been answered:
> when converting from Mol to a canonical SMILES string,
> is there a way to obtain the mapping between the atom indexes in the
> Mol object and the atom indexes in the SMILES chain?
>
> All the best,
>
> Jean-Marc
>
> --
>
> Dr. Jean-Marc Nuzillard
> Institute of Molecular Chemistry
> CNRS UMR 7312
> Moulin de la Housse
> CPCBAI, B√Ętiment 18
> BP 1039
> 51687 REIMS Cedex 2
> France
>
> Tel : 33 3 26 91 82 10
> Fax :33 3 26 91 31 66
> http://www.univ-reims.fr/ICMR
>
> http://eos.univ-reims.fr/LSD/
> http://eos.univ-reims.fr/LSD/JmnSoft/
>
>
> ------------------------------------------------------------
> ------------------
> 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

Reply via email to