Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-03 Thread Stephen Roughley via Rdkit-discuss
It looks like it should be deterministic, in that it always loops through the existing non-hydrogen atoms in their internal order, adding H's to each in turn. https://github.com/rdkit/rdkit/blob/ffc123a6659705adae33a6f5bf3913d65aa7b54d/Code/GraphMol/AddHs.cpp Steve On Wed, 3 Oct 2018 at 21:23,

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-03 Thread Dimitri Maziuk via Rdkit-discuss
On 10/03/2018 03:23 PM, Peter St. John wrote: > Ah, well I suppose the follow up question is then does 'AddHs' add > hydrogens in a deterministic fashion? It should, what's not guaranteed is that it will be the right order. Obviously, if (using my previous example) L- and D-alanine is the "same

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-03 Thread Greg Landrum
Yep good point. Though you can opt to keep the Hs if you want, that is not the default behavior. On Wed, 3 Oct 2018 at 17:07, Dmitri Maziuk via Rdkit-discuss < rdkit-discuss@lists.sourceforge.net> wrote: > On Wed, 3 Oct 2018 06:21:06 +0200 > Greg Landrum wrote: > > > The atom ordering in the

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-03 Thread Dmitri Maziuk via Rdkit-discuss
On Wed, 3 Oct 2018 06:21:06 +0200 Greg Landrum wrote: > The atom ordering in the RDKit molecule created from a SMILES or Mol block > will always be the same and will corresponds to the ordering of the atoms > in the input ... provided your molecule has no protons and/or you don't removeH/addH

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-02 Thread Greg Landrum
On Tue, Oct 2, 2018 at 10:32 PM Peter St. John wrote: > If I store a molecule as a SMILES string, along with relevant information > about different bonds, is it safe to annotate those bond entries by bond > index? > This has already been answered (yes, you can), but to just provide a bit more

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-02 Thread Dimitri Maziuk via Rdkit-discuss
On 10/02/2018 03:32 PM, Peter St. John wrote: > I.e., if I create a new rdkit Molecule with rdkit.Chem.MolFromSmiles(xxx), > will the bond ordering always be the same? If not, does anyone know a a > robust way of specifying a bond within a molecule as a string-based > representation?

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-02 Thread Maciek Wójcikowski
Hi Peter and Nils, To supplement Nils comment I'd like to add that during writing the Mol atoms nor bonds order is not changed, but the canonical atom mapping is saved in molecular property "_smilesAtomOutputOrder". This does not include bonds though, it shouldn't change, but if you wish to be

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-02 Thread Peter St. John
Awesome, thanks for the tip! Connor, that also is a great idea, I didn't know about atom-mapped SMILES strings. That would definitely be a good method if the indexing algorithm changes across rdkit versions. Thanks! -- Peter On Tue, Oct 2, 2018 at 2:56 PM Nils Weskamp wrote: > Hi Peter, > >

Re: [Rdkit-discuss] Are atom and bond indexes deterministic?

2018-10-02 Thread Nils Weskamp
Hi Peter, to the best of my knowledge: for a given SMILES string, you should always end up with the same molecule object. On the other hand, generation of (canonical / unique) SMILES often reorders atoms and bonds (to ensure that the SMILES is unique for a given structure). A conversion Molecule