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, Peter St. John  wrote:

> Ah, well I suppose the follow up question is then does 'AddHs' add
> hydrogens in a deterministic fashion?
> If I have a canonicalized SMILES and do
>
> mol = Chem.MolFromSmiles(SMILES)
> molH = Chem.AddHs(mol)
>
> and then store information about the bonds in molH, should those be
> relatively consistent if I run the same code later?
> My limited experiments seem to indicate they are, but I'm not sure if that
> persists across python sessions or different hardware.
>
> Thanks again!
> -- Peter
>
>
> On Wed, Oct 3, 2018 at 9:53 AM Dmitri Maziuk via Rdkit-discuss <
> rdkit-discuss@lists.sourceforge.net> wrote:
>
>> On Wed, 3 Oct 2018 17:26:24 +0200
>> Greg Landrum  wrote:
>>
>> > Yep good point.
>> > Though you can opt to keep the Hs if you want, that is not the default
>> > behavior.
>>
>> ;) I work for NMR people, we get very attached to our protons.
>>
>> Seriously though, I forget whether it was rdkit or openbabel, but back
>> when I was testing them I managed to read L-alanine MOL in and get
>> D-alanine InChI string out in one of them.
>> --
>> Dmitri Maziuk 
>>
>>
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


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
molecule" for your purposes, then it doesn't matter.

If it does mater, then alatis (the link I sent earlier) is the best
option that I know of.

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


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 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 in
> the process.
>
> --
> Dmitri Maziuk 
>
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


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 in the 
process.

-- 
Dmitri Maziuk 


___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss