This has me quite curious now, how do we detect unspecified bond stereo
chemistry in RDKit?

m = Chem.MolFromSmiles("FC=CF")
assert m.HasProp("_StereochemDone")
for bond in m.GetBonds():
    print(bond.GetBondDir(), bond.GetStereo())

Yields:

(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)
(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)
(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)


Trying to force the issue:


Chem.AssignStereochemistry(m, cleanIt=True, force=True,
flagPossibleStereoCenters=True)


assert m.HasProp("_StereochemDone")
for bond in m.GetBonds():
    print(bond.GetBondDir(), bond.GetStereo())


Still yields:


(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)
(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)
(rdkit.Chem.rdchem.BondDir.NONE, rdkit.Chem.rdchem.BondStereo.STEREONONE)


I can see the setStereo(Bond::STEREOANY) in the code here:


        if ((*bondIt)->getBondDir() == Bond::EITHERDOUBLE) {
          (*bondIt)->setStereo(Bond::STEREOANY);



Guess I have to figure out how to detect EITHERDOUBLE?


-Brian



On Fri, Dec 9, 2016 at 5:03 PM, Andrew Dalke <da...@dalkescientific.com>
wrote:

> On Dec 9, 2016, at 9:50 PM, Brian Kelley wrote:
> > >>> from rdkit import Chem
> > >>> m = Chem.MolFromSmiles("F/C=C/F")
> > >>> for bond in m.GetBonds():
> > ...    print bond.GetStereo()
> > ...
> > STEREONONE
> > STEREOE
> > STEREONONE
> >
> > However, setting bond stereo doesn't appear to be exposed.
>
> I thought I knew a way to change it, via GetBondDir()/SetBondDir() on the
> directional bonds. It doesn't seem to work.
>
> First, get the existing bond directions:
>
> >>> from rdkit import Chem
> >>> mol = Chem.MolFromSmiles("F/C=C/F")
> >>> for bond in mol.GetBonds():
> ...   print(bond.GetBondDir())
> ...
> ENDUPRIGHT
> NONE
> ENDUPRIGHT
>
>
> I'll change the first "/" to a "\" (That's "\\" when escaped for a normal
> Python string.)
>
> >>> mol.GetBondWithIdx(0)
> <rdkit.Chem.rdchem.Bond object at 0x10fe26600>
> >>> mol.GetBondWithIdx(0).GetBondDir()
> rdkit.Chem.rdchem.BondDir.ENDUPRIGHT
> >>> mol.GetBondWithIdx(0).SetBondDir(Chem.BondDir.ENDDOWNRIGHT)
>
> If I generate the SMILES I see the old "F/C=C/F" instead of the new
> direction. I need to clear internal computed properties when I make
> structure edits:
>
> >>> Chem.MolToSmiles(mol, isomericSmiles=True)
> 'F/C=C/F'
> >>> mol.ClearComputedProps()
> >>> Chem.MolToSmiles(mol, isomericSmiles=True)
> 'F/C=C\\F'
>
> I'll set the directions to "NONE" and clear computed properties. The
> SMILES is correct:
>
> >>> mol.GetBondWithIdx(0).SetBondDir(Chem.BondDir.NONE)
> >>> mol.GetBondWithIdx(2).SetBondDir(Chem.BondDir.NONE)
> >>> mol.ClearComputedProps()
> >>> Chem.MolToSmiles(mol, isomericSmiles=True)
> 'FC=CF'
>
> although the stereo setting is unchanged:
>
> >>> for bond in mol.GetBonds():
> ...   print(bond.GetStereo())
> ...
> STEREONONE
> STEREOE
> STEREONONE
>
> I expected it to give me all STEREONONEs, as if it were the same as the
> following:
>
> >>> mol2 = Chem.MolFromSmiles("FC=CF")
> >>> for bond in mol2.GetBonds():
> ...   print(bond.GetStereo())
> ...
> STEREONONE
> STEREONONE
> STEREONONE
>
>
>
>
>                                 Andrew
>                                 da...@dalkescientific.com
>
>
>
> ------------------------------------------------------------
> ------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/xeonphi
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to