Re: [Rdkit-discuss] assign E/Z information to double bond and write to SMILES
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2016-04-13 14:39:53
|
On Wed, Apr 13, 2016 at 4:26 PM, Rafal Roszak <rmr...@gm...> wrote:
> On Wed, 13 Apr 2016 10:52:47 +0200
> Greg Landrum <gre...@gm...> wrote:
>
> > The RDKit does determine E/Z labels for double bonds. Here's a simple
> > In [4]: m.GetBondWithIdx(0).GetStereo()
> > Out[4]: rdkit.Chem.rdchem.BondStereo.STEREOE
>
>
> Thank you for comment. My input SMILES does not contain
> stereo-information, basically my problem is how to set this within RDKit.
> Is there any way to set stereo information to double bond?
>
You can do it indirectly by setting the direction on the neighboring single
bonds:
In [10]: m = Chem.MolFromSmiles('CC=CC')
In [11]: m.GetBondWithIdx(0).SetBondDir(Chem.BondDir.ENDUPRIGHT)
In [12]: m.GetBondWithIdx(2).SetBondDir(Chem.BondDir.ENDUPRIGHT)
In [13]: Chem.AssignStereochemistry(m,force=True)
In [14]: Chem.MolToSmiles(m,True)
Out[14]: 'C/C=C/C'
In [15]: m.GetBondWithIdx(1).GetStereo()
Out[15]: rdkit.Chem.rdchem.BondStereo.STEREOE
In [18]: m = Chem.MolFromSmiles('CC=CC')
In [19]: m.GetBondWithIdx(0).SetBondDir(Chem.BondDir.ENDDOWNRIGHT)
In [20]: m.GetBondWithIdx(2).SetBondDir(Chem.BondDir.ENDUPRIGHT)
In [21]: Chem.AssignStereochemistry(m,force=True)
In [22]: Chem.MolToSmiles(m,True)
Out[22]: 'C/C=C\\C'
In [23]: m.GetBondWithIdx(1).GetStereo()
Out[23]: rdkit.Chem.rdchem.BondStereo.STEREOZ
This needs to be done carefully, paying attention to which atom is the
beginning of the single bonds and making sure that you pick a single
neighboring single bond on each side of the double bonds, but it is
possible.
-greg
|