The OEAtomBase member function HasStereoSpecified(unsigned int type)
returns a boolean value which indicates whether stereochemical
information of a particular type as been stored for an atom. The
unsigned integer type argument must be constant listed in the
OEAtomStereo namespace. If an atom has associated stereochemistry
data, it can be retrieved using the OEAtomBase member function
GetStereo(const std::vector<OEAtomBase*>&,unsigned int)
function.
Multiple possible values may be associated with each class of
stereochemistry. For instance, if an atom has associated tetrahedral
stereochemistry, the possible values are Undefined, RightHanded (or
just Right), or LeftHanded (or just Left). The following code sample
demonstrates looping over atoms, testing for atoms which have
tetrahedral stereochemistry, and printing out the value of the
tetrahedral stereochemistry.
#include "oechem.h" #include <iostream> #include <vector> using namespace OESystem; using namespace OEChem; using namespace std; int main() { OEMol mol; OEParseSmiles(mol, "F[C@H](Cl)Br"); OEIter<OEAtomBase> atom,nbr; for (atom=mol.GetAtoms();atom;++atom) { if (atom->HasStereoSpecified(OEAtomStereo::Tetrahedral)) { std::vector<OEAtomBase*> v; for (nbr = atom->GetAtoms();nbr;++nbr) v.push_back(nbr); unsigned int stereovalue = atom->GetStereo(v,OEAtomStereo::Tetrahedral); cerr << "Atom: " << atom->GetIdx() << ' '; if (stereovalue == OEAtomStereo::RightHanded) cerr << "Right Handed" << endl; else if (stereovalue == OEAtomStereo::LeftHanded) cerr << "Left Handed" << endl; } } return 0; }
The definition of handedness for tetrahedral stereochemistry does
not imply chirality around a tetrahedral center, but rather indicates
relative positions of neighboring atoms. Note that the function
GetStereo()
requires a STL vector containing pointers to the
neighboring atoms as the first argument. The handedness value
returned from GetStereo()
will depend on the order of the neighboring
atoms as they appear in the vector passed to GetStereo()
. The
definition handedness in OEChem is demonstrated pictorially in
Figure 14-2.
Figure 14-2
Looking down the bond between atom number one and the central atom,
handedness is defined as the direction of travel from atom number
two to atom number three. The direction of travel must always be
along the acute angle formed by atom two, the central atom, and atom
three. Right handed and left handed directions of travel can also be
though of as clockwise and counterclockwise, respectively. The first
neighbor atom in the vector passed to GetStereo()
is taken as atom
number one 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 GetStereo()
function when requesting a value for tetrahedral
chirality.
Setting the relative stereochemistry around a particular center is
accomplished using the function SetStereo(const
std::vector<OEAtomBase*>&,unsigned int type,unsigned int value)
.
Just as in GetStereo()
, the STL vector of neighbor atoms provide
the references about which the handedness is defined. The first
of the unsigned integer arguments is the stereochemistry type
(i.e. OEAtomStereo::Tetra
), and the second is the associated
value (i.e. OEAtomStereo::Right
).