Re: [Rdkit-discuss] MolToSmiles
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2016-12-19 08:58:33
|
On Mon, Dec 19, 2016 at 9:43 AM, Maciek Wójcikowski <ma...@wo...> wrote: > > There is also CanonicalRankAtoms [http://www.rdkit.org/Python_ > Docs/rdkit.Chem.rdmolfiles-module.html#CanonicalRankAtoms] which seams to > be forgotten. > One thing to be aware of here is that this provides the canonical ranking of atoms that is used for the SMILES generation, but the values are not equal to the actual output order of the atoms. Here's an example of that: In [3]: m = Chem.MolFromSmiles('CC(O)CCN') In [4]: list(Chem.CanonicalRankAtoms(m)) Out[4]: [0, 5, 2, 4, 3, 1] In [5]: Chem.MolToSmiles(m) Out[5]: 'CC(O)CCN' In [7]: m.GetProp('_smilesAtomOutputOrder') Out[7]: '[0,1,2,3,4,5,]' so though atom 1 is ranked in position 5, it ends up being the second atom output since it is connected to atom 0, which happens to have rank 0. -greg |