Stereochemistry Perception¶
OEChem TK has the ability to store and retrieve stereochemical information for atoms and bonds independent of two or three dimensional coordinates. The current version of OEChem TK supports stereochemistry definitions of handedness around tetrahedral centers, and cis/trans configuration around bonds.
The table below lists the available OEChem TK functions related to stereochemical information.
Name
Description
Set the stereochemistry at the chiral atoms of a molecule, as specified by the molecule’s 3D coordinates.
Set the stereochemistry at the chiral bonds of a molecule, as specified by the molecule’s 3D coordinates.
Assigns the stereochemistry of a molecule from its 3D coordinates.
Clears the bond stereo fields from all bonds of a molecule.
Corrects the wedge/hash bond assignment of the 2D molecule.
Checks whether the wedge/hash bond assignment of the 2D molecule is inconsistent or ambiguous.
Assigns wedge and hash bonds to a connection table from the OEChem TK stereochemistry of each atom of the 2D molecule.
Sets the OEChem TK stereochemistry of each atom of the 2D molecule from the wedge and hash bonds in the connection table.
Sets the OEChem TK stereochemistry for each atom from the MDL stereo parity information.
Perceives the Cahn-Ingold-Prelog descriptor for the given atom.
Sets the internal OEChem TK stereochemistry from the given CIP atom stereo descriptor.
Atom Chirality¶
The following two code snippets demonstrate how to loop over chiral
atoms using the OEIsChiralAtom
functor and
the IsChiral
method of
the OEAtomBase
class.
for atom in mol.GetAtoms(oechem.OEIsChiralAtom()):
print(atom.GetIdx(), oechem.OEGetAtomicSymbol(atom.GetAtomicNum()))
for atom in mol.GetAtoms():
if atom.IsChiral():
print(atom.GetIdx(), oechem.OEGetAtomicSymbol(atom.GetAtomicNum()))
Warning
When a molecule is imported from a file, its atom and bond chirality are not
automatically perceived, the user has to call OEPerceiveChiral
explicitly.
Atom Stereochemistry¶
Stereochemistry around atoms can be set and retrieved by the
OEAtomBase.SetStereo
and OEAtomBase.GetStereo
methods, respectively.
The OEAtomBase.HasStereoSpecified
method returns a boolean value
that indicates whether stereochemical information of a particular type has been
stored for an atom.
OEChem TK currently only supports OEAtomStereo_Tetrahedral
atom stereochemistry class.
Note that the setting and retrieval of atom stereo requires
a vector containing pointers to the neighboring atoms as the first argument.
The handedness value returned from OEAtomBase.GetStereo
will
depend on the order of the neighboring atoms as they appear in the
passed vector.
The first neighbor atom in the vector passed to OEAtomBase.GetStereo
is taken as atom number one for the determination of handedness.
Likewise, subsequent atoms in the neighbor atom vector are assigned
sequentially to positions in the handedness definition.
Although, three neighboring atoms are sufficient to determine the
handedness around a trigonal pyramidal or tetrahedral center, either three or four
atoms can be provided to the OEAtomBase.GetStereo
function
when requesting a value for tetrahedral chirality.
The following table shows the return values of OEAtomBase.GetStereo
method by passing the neighbor atoms in different order.
neighbor order |
[C@@H](Cl)(Br)N |
[C@H](Cl)(Br)N |
---|---|---|
H Cl Br N |
right handed |
left handed |
H Br Cl N |
left handed |
right handed |
H Cl N Br |
left handed |
right handed |
… |
… |
… |
Cl Br N |
left handed |
right handed |
Br Cl N |
right handed |
left handed |
Cl N Br |
right handed |
left handed |
Note
The definition of handedness for tetrahedral stereochemistry does not imply chirality around a tetrahedral center, but rather indicates relative positions of neighboring atoms.
The following code sample demonstrates looping over atoms, testing for
atoms that have tetrahedral stereochemistry, and printing out the
value of the tetrahedral stereochemistry (either
OEAtomStereo_RightHanded
,
OEAtomStereo_LeftHanded
, or
OEAtomStereo_Undefined
). See also the input
structure depicted in Figure: Atom stereo.
Listing 1: Accessing atom stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "[H][C@]1(NC[C@@H](CC1CO[C@H]2CC[C@@H](CC2)O)N)[H]")
for atom in mol.GetAtoms():
chiral = atom.IsChiral()
stereo = oechem.OEAtomStereo_Undefined
if atom.HasStereoSpecified(oechem.OEAtomStereo_Tetrahedral):
v = []
for nbr in atom.GetAtoms():
v.append(nbr)
stereo = atom.GetStereo(v, oechem.OEAtomStereo_Tetrahedral)
if chiral or stereo != oechem.OEAtomStereo_Undefined:
print("Atom:", atom.GetIdx(), "chiral=", chiral, "stereo=", end=" ")
if stereo == oechem.OEAtomStereo_RightHanded:
print("right handed")
elif stereo == oechem.OEAtomStereo_LeftHanded:
print("left handed")
else:
print("undefined")
The output of the preceding program is the following:
Atom: 1 chiral= False stereo= left handed
Atom: 4 chiral= True stereo= right handed
Atom: 7 chiral= True stereo= undefined
Atom: 10 chiral= False stereo= left handed
Atom: 14 chiral= False stereo= right handed
As mentioned before, tetrahedral stereochemistry (i.e. specified atom stereo) does not imply chirality around a tetrahedral center. For example atoms 1, 10 and 14 in Figure: Atom stereo have specified atom stereo, even though they are non-chiral. Vice versa, atom can be chiral but with unspecified atom stereo configuration (such as atom 7 in Figure: Atom stereo ). Atoms 1 and 6 are non-chiral but they have atom stereo information and they are relative to each other.
The following example shows how to manually set the atom stereo of atom 7 (chiral, undefined)
to left by the OEAtomBase.SetStereo
method.
Listing 2: Setting atom stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "[H][C@]1(NC[C@@H](CC1CO[C@H]2CC[C@@H](CC2)O)N)[H]")
for atom in mol.GetAtoms():
if atom.IsChiral() and not atom.HasStereoSpecified(oechem.OEAtomStereo_Tetrahedral):
v = []
for neigh in atom.GetAtoms():
v.append(neigh)
atom.SetStereo(v, oechem.OEAtomStereo_Tetra, oechem.OEAtomStereo_Left)
print(oechem.OEMolToSmiles(mol))
The output of the preceding program is the following:
[H][C@@]1([C@@H](C[C@H](CN1)N)CO[C@H]2CC[C@@H](CC2)O)[H]
Just as in OEAtomBase.GetStereo
, the vector of neighbor atoms provide
the references about which the handedness is defined.
The first of the integer arguments is the stereochemistry type
(i.e. OEAtomStereo_Tetrahedral
(or just OEAtomStereo_Tetra
) ,
and the second is the associated value
(i.e. OEAtomStereo_Right
or OEAtomStereo_Left
).
Bond Chirality¶
The following two code snippets demonstrate how to loop over chiral
bonds using the OEIsChiralBond
functor and
the IsChiral
method of
the OEBondBase
class.
for bond in mol.GetBonds(oechem.OEIsChiralBond()):
print(bond.GetBgnIdx(), "=", bond.GetEndIdx())
for bond in mol.GetBonds():
if bond.IsChiral():
print(bond.GetBgnIdx(), "=", bond.GetEndIdx())
Warning
When a molecule is imported from a file, its atom and bond chirality are not
automatically perceived, the user has to call OEPerceiveChiral
explicitly.
Bond Stereochemistry¶
Stereochemistry around bonds can be specified in a similar fashion to
stereochemistry about atom centers.
The request for stereochemistry of a particular class can be made of an
OEBondBase using the method OEBondBase.HasStereoSpecified
.
OEChem TK currently only supports OEBondStereo_CisTrans
bond stereochemistry class that defines whether the configuration
of two atoms around a non-rotatable bond is cis or trans.
If a bond has associated stereochemical data, it can be retrieved
using OEBondBase.GetStereo
method.
The following code sample demonstrates a loop over bonds that tests for bonds with associated stereochemistry, and retrieval of whether the neighboring atoms are cis or trans relative to one another. (See also the input structure depicted in Figure: Bond stereo.
Listing 3: Accessing bond stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "C\\C=C\\C=C/C=CC")
for bond in mol.GetBonds():
if bond.HasStereoSpecified(oechem.OEBondStereo_CisTrans):
for atomB in bond.GetBgn().GetAtoms():
if atomB == bond.GetEnd():
continue
for atomE in bond.GetEnd().GetAtoms():
if atomE == bond.GetBgn():
continue
v = []
v.append(atomB)
v.append(atomE)
stereo = bond.GetStereo(v, oechem.OEBondStereo_CisTrans)
print("Atoms:", atomB.GetIdx(), "and", atomE.GetIdx(), "are", end=" ")
if stereo == oechem.OEBondStereo_Cis:
print("cis")
elif stereo == oechem.OEBondStereo_Trans:
print("trans")
The output of the preceding program is the following:
Atoms: 0 and 3 are trans
Atoms: 2 and 5 are cis
Note that even though the double bond defined by atoms 4–5–6–7 is depicted as trans (see Figure: Bond stereo) it is still considered undefined, since no stereo information is encoded for this bond in the input SMILES.
The following example shows how to manually set this missing bond stereo to trans
by the OEBondBase.SetStereo
method.
Listing 4: Setting bond stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "C\\C=C\\C=C/C=CC")
for bond in mol.GetBonds():
if bond.GetOrder() == 2 and not bond.HasStereoSpecified(oechem.OEBondStereo_CisTrans):
v = []
for neigh in bond.GetBgn().GetAtoms():
if neigh != bond.GetEnd():
v.append(neigh)
break
for neigh in bond.GetEnd().GetAtoms():
if neigh != bond.GetBgn():
v.append(neigh)
break
bond.SetStereo(v, oechem.OEBondStereo_CisTrans, oechem.OEBondStereo_Trans)
print(oechem.OEMolToSmiles(mol))
The first integer argument of the method OEBondBase.SetStereo
is used to specify the type of stereochemistry (i.e.
OEBondStereo_CisTrans
).
The second integer argument specifies the bond stereo configuration (i.e.
OEBondStereo_Cis
or OEBondStereo_Trans
)
The output of the preceding program is the following:
C/C=C/C=C\C=C\C
CIP Stereo Perception¶
The following two examples demonstrate how to perceive CIP (Cahn–Ingold–Prelog)
atom and bond stereo information from the molecules created by the SMILES
representation. If the input molecule has 3D coordinates, the OE3DToInternalStereo
function should be called.
Listing 5: Perceiving CIP atom stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "N[C@@H]1N[C@@H](O)CC(O)C1.C2[C@@H](O)CC[C@@H](O)C2")
for atom in mol.GetAtoms():
cip = oechem.OEPerceiveCIPStereo(mol, atom)
if atom.HasStereoSpecified():
print("atom %d is" % atom.GetIdx(), end=" ")
if cip == oechem.OECIPAtomStereo_S:
print('S')
if cip == oechem.OECIPAtomStereo_R:
print('R')
if cip == oechem.OECIPAtomStereo_NotStereo:
print('not a CIP stereo center')
if cip == oechem.OECIPAtomStereo_UnspecStereo:
print("atom %d is" % atom.GetIdx(), end=" ")
print('a CIP stereo center without specified stereochemistry')
The OEPerceiveCIPStereo
function detects the Cahn-Ingold-Prelog
descriptor of the given atom and returns a value from the
OECIPAtomStereo
namespace.
The output of Listing 5
is the following:
(See also the input structure depicted in Figure: CIP atom stereo.
atom 1 is R
atom 4 is S
atom 8 is a CIP stereo center without specified stereochemistry
atom 12 is not a CIP stereo center
atom 17 is not a CIP stereo center
Listing 6: Perceiving CIP bond stereo information
from openeye import oechem
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "C\\C(C)=C(\\C)C.O\\C(C)=C(\\C)O.O\\C(C)=C(\\O)C.CC(O)=C(O)C")
for bond in mol.GetBonds():
if bond.GetOrder() == 2:
cip = oechem.OEPerceiveCIPStereo(mol, bond)
print("bond %d is" % bond.GetIdx(), end=" ")
if bond.HasStereoSpecified():
if cip == oechem.OECIPBondStereo_E:
print('E')
if cip == oechem.OECIPBondStereo_Z:
print('Z')
if cip == oechem.OECIPBondStereo_NotStereo:
print('not a CIP stereo center')
if cip == oechem.OECIPBondStereo_UnspecStereo:
print('a CIP stereo center without specified stereochemistry')
The OEPerceiveCIPStereo
function detects the Cahn-Ingold-Prelog
descriptor of the given bond and returns a value from the
OECIPBondStereo
namespace.
The output of Listing 6
is the following:
(See also the input structure depicted in Figure: CIP bond stereo.
bond 2 is not a CIP stereo center
bond 7 is Z
bond 12 is E
bond 17 is a CIP stereo center without specified stereochemistry