Re: [Rdkit-discuss] MolToSmiles
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Brian K. <fus...@gm...> - 2016-12-19 17:22:08
|
I would vote for make a more obvious way to get to these values. I have had the need to do this when working with external depictors (i.e. mol -> smiles -> depict with atom highlighting is one use case) I just couldn't think of a valid API way of doing this. Attaching these values to the molecule seems like it isn't really the right solution considering there are two forms of canonical ordering if isomerisms are considered. I had thought about making a CanonicalAtomOrder function that does this as well, or perhaps making a MolToSmiles variant. Any other ideas? On Mon, Dec 19, 2016 at 3:58 AM, Greg Landrum <gre...@gm...> wrote: > > On Mon, Dec 19, 2016 at 9:43 AM, Maciek Wójcikowski <ma...@wo... > > wrote: > >> >> There is also CanonicalRankAtoms [http://www.rdkit.org/Python_D >> ocs/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 > > > > ------------------------------------------------------------ > ------------------ > 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 > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |