Loading...
Searching...
No Matches
OBTetrahedralStereo Class Reference
Stereochemistry

`#include <openbabel/stereo/tetrahedral.h>`

Inheritance diagram for OBTetrahedralStereo:
[legend]

## Classes

struct | Config

## Public Member Functions

| OBTetrahedralStereo (OBMol *mol)
virtual | ~OBTetrahedralStereo ()
OBGenericData * | Clone (OBBase *mol) const
void | SetAttribute (const std::string &v)
void | SetOrigin (const DataOrigin s)
virtual const std::string & | GetAttribute () const
unsigned int | GetDataType () const
virtual const std::string & | GetValue () const
virtual DataOrigin | GetOrigin () const
Tetrahedral stereochemistry
OBStereo::Type | GetType () const
bool | IsValid () const
void | SetConfig (const Config &config)
Config | GetConfig (OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom) const
Config | GetConfig (unsigned long from_or_towards, OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom) const
bool | operator== (const OBTetrahedralStereo &other) const
bool | operator!= (const OBTetrahedralStereo &other) const
Geniric (for all OBStereo::Type) stereochemistry
OBMol * | GetMolecule () const
void | SetSpecified (bool specified)
bool | IsSpecified () const

## Static Public Member Functions

template<typename ConfigType>
static ConfigType | ToConfig (const ConfigType &cfg, unsigned long from_or_towards, OBStereo::Winding winding=OBStereo::Clockwise, OBStereo::View view=OBStereo::ViewFrom)
template<typename ConfigType>
static void | ChangeWinding (ConfigType &cfg)
template<typename ConfigType>
static void | ChangeView (ConfigType &cfg)
template<typename ConfigType>
static void | Invert (ConfigType &cfg)

## Protected Attributes

std::string | _attr
unsigned int | _type
DataOrigin | _source

## Detailed Description

Class for handling and storing tetrahedral atom stereochemistry.

The OBTetrahedralStereo class is used to represent tetrahedral atom stereo chemistry. Before continuing reading, it is recommeded to read the OBTetraNonPlanar documentation first. Since this class inherits OBTetraNonPlanerStereo it should be clear that the class stores the spacial arrangement of 4 non-planer atoms. However, for the tetrahedral case, one additional OBStereo::Ref is needed: the atom id for the center atom.

The stereochemistry is set, retrieved and internally stored using the OBTetrahedralStereo::Config struct. OBTetrahedralStereo functions as a wrapper around the Config struct and provides functions to get a copy of the Config struct converted to any view direction or atom and winding (OBTetrahedralStereo::GetConfig).

Like all stereo classes, errors, warnings or info is reported using OBMessageHandler.

See also
  OBStereo OBStereoBase OBTetraNonPlanarStereo OBStereoFacade

Since
  version 2.3

## Constructor & Destructor Documentation

## OBTetrahedralStereo()

OBTetrahedralStereo | ( | OBMol * | mol | ) |

Constructor.

Referenced by operator!=(), and operator==().

## ~OBTetrahedralStereo()

virtual ~OBTetrahedralStereo | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## GetType()

OBStereo::Type GetType | ( |  | ) | const

inline virtual

Get the OBStereo::Type for this object.

Returns
  OBStereo::Tetrahedral

Implements OBStereoBase.

## IsValid()

bool IsValid | ( |  | ) | const

Returns
  True if this object is valid. This object is valid if all (center, from and ref) atom ids are set.

Referenced by OpenBabel::CanonicalLabels().

## SetConfig()

void SetConfig | ( | const Config & | config | ) |

Set the configuration using a Config struct.

Referenced by OpenBabel::CanonicalLabels(), OBMol::CopySubstructure(), and OBMol::operator+=().

## GetConfig() [1/2]

Config GetConfig | ( | OBStereo::Winding | winding = OBStereo::Clockwise,
|  | OBStereo::View | view = OBStereo::ViewFrom ) const

Get the configuration as Config struct.

Referenced by OpenBabel::CanonicalLabels(), OBMol::CopySubstructure(), OBBuilder::CorrectStereoAtoms(), OpenBabel::DeleteStereoOnAtom(), OBSmartsMatcher::match(), and OBMol::operator+=().

## GetConfig() [2/2]

Config GetConfig | ( | unsigned long | from_or_towards,
|  | OBStereo::Winding | winding = OBStereo::Clockwise,
|  | OBStereo::View | view = OBStereo::ViewFrom ) const

Get the configuration as Config struct viewing from/towards the specified id.

## operator==()

bool operator== | ( | const OBTetrahedralStereo & | other | ) | const

Compare the stereochemistry stored in the Config struct with the stereochemistry specified in the Config struct from `other`.

Equal to operator. Comparing OBTetrahedralStereo::Config structs is done using the information stored in the struct's data members (i.e. `view`, `winding`, `from/towards` and `refs`).

There are a number of cases resuling in false being returned:

- The centers don't match.
- One of the Refs lists does not contain 3 elements.
- 2 or more OBStereo::ImplicitRef values in a single Config struct

When either Config struct is unspecified (i.e. the stereochemistry implied is accidental), true is returned.

It doesn't matter if the two Config structs use the same view, same from/towards Ref or the same winding. All needed conversions will be carried out automatically (see OBTetraNonPlanerStereo::ToConfig). These conversions ensure the spacial orientation of the 4 groups remains unchanged.

Another key feature is the ability to comapre Config structs regardless of implicit (OBStereo::ImplicitRef) or explicit hydrogens. This is best illustrated with some examples. In these examples the same ref has already been selected as from/towards atom and both use the same winding and view direction. We will focus on how the three remaining refs are interpreted.

      234 == 234 // true
      2H4 == 234 // 3 is missing, must be the implicit --> 234 == 234 // true
      2H4 == 243 // same as above, but now 234 == 243 // false
      234 == H34 // 2 is missing, must be implicit --> 234 == 234 // true

By comparing the second and third example above, it can be clearly seen that the value of 1 Ref can actually be ignored. It's position in the sequence (or the winding) is defined by the two explicit Ref values.

Returns
  True if both Config structs represent the same stereochemistry.

## operator!=()

bool operator!= | ( | const OBTetrahedralStereo & | other | ) | const

inline

Not equal to operator. This is the inverse of the Equal to operator==.

Returns
  True if the two Config structs represent a different stereochemistry.

## Clone()

OBGenericData * Clone | ( | OBBase * | mol | ) | const

virtual

Reimplemented from OBGenericData.

## ToConfig()

template<typename ConfigType>

ConfigType ToConfig | ( | const ConfigType & | cfg,
|  | unsigned long | from_or_towards,
|  | OBStereo::Winding | winding = OBStereo::Clockwise,
|  | OBStereo::View | view = OBStereo::ViewFrom )

inline static inherited

Convert a `ConfigType` struct from any View/Winding to the desired representation.

This is a template method which works on ConfigType structs from OBTetraNonPlanar subclasses. The subclasses can decide what data member are needed to store the stereogenic unit (i.e. 1 atom for tetrahedral, 3 for allene like, ...) and still use this generic method to handle the real stereochemistry.

A ConfigType struct should at least have the following data members:

class SomeNonPlanarStereo : public TetraNonPlanarStereo
{
public:
struct Config
{
// constructor(s) are recommended!
// subclass specific stereogenic unit
...
union {
unsigned long from;
unsigned long towards;
};
OBStereo::Refs refs;
OBStereo::Winding winding;
OBStereo::View view;
};
};
OpenBabel::OBStereo::Refs
std::vector< Ref > Refs
Definition stereo.h:156
OpenBabel::OBStereo::Winding
Winding
Definition stereo.h:130
OpenBabel::OBStereo::View
View
Definition stereo.h:120
OpenBabel::OBTetrahedralStereo::Config
Stereochemical configuration for tetrahedral stereocenters.
Definition tetrahedral.h:85

Parameters

  cfg | A ConfigType struct from a OBTetraNonPlanar subclass.
  from_or_towards | The desired from/towards reference id (see `view`)
  winding | The desired winding.
  view | The desired viewing direction.

Returns
  The ConfigType struct with desired from/towards, winding and view.

Referenced by OBTetrahedralConfig::operator==().

## ChangeWinding()

template<typename ConfigType>

void ChangeWinding | ( | ConfigType & | cfg | ) |

inline static inherited

Change the winding of the ConfigType struct while maintaining the stereochemistry.

## ChangeView()

template<typename ConfigType>

void ChangeView | ( | ConfigType & | cfg | ) |

inline static inherited

Change the view of the ConfigType struct while maintaining the stereochemistry.

## Invert()

template<typename ConfigType>

void Invert | ( | ConfigType & | cfg | ) |

inline static inherited

Invert the stereochemistry of the ConfigType struct.

## GetMolecule()

OBMol * GetMolecule | ( |  | ) | const

inline inherited

Get the molecule. This can be used by subclasses when more information is needed (e.g. OBCisTransStereo::GetCisRef, ...).

## SetSpecified()

void SetSpecified | ( | bool | specified | ) |

inline inherited

Set whether the stereochemistry is specified. Comparing a specified OBStereoBase derived class (or it's Config struct) with an unspecified one, always returns true.

## IsSpecified()

bool IsSpecified | ( |  | ) | const

inline inherited

Returns
  True if the stereochemistry is specified.

## SetAttribute()

void SetAttribute | ( | const std::string & | v | ) |

inline inherited

Set the attribute (key), which can be used to retrieve this data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), AliasData::Expand(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBForceField::GetAtomTypes(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## SetOrigin()

void SetOrigin | ( | const DataOrigin | s | ) |

inline inherited

Set the origin of this data, which can be used to filter the data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## GetAttribute()

virtual const std::string & GetAttribute | ( |  | ) | const

inline virtual inherited

Returns
  The attribute (key), which can be used to retrieve this data

Referenced by OBMoleculeFormat::MakeCombinedMolecule().

## GetDataType()

unsigned int GetDataType | ( |  | ) | const

inline inherited

Returns
  the data type for this object as defined in OBGenericDataType

## GetValue()

virtual const std::string & GetValue | ( |  | ) | const

inline virtual inherited

Base class returns a default value (the attribute type) but should never be called.

Reimplemented in OBCommentData, and OBPairData.

Referenced by OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), and OBDescriptor::GetValues().

## GetOrigin()

virtual DataOrigin GetOrigin | ( |  | ) | const

inline virtual inherited

## Member Data Documentation

## _attr

std::string _attr

protected inherited

attribute tag (e.g., "UnitCell", "Comment" or "Author")

Referenced by OBRotamerList::Clone(), GetAttribute(), GetValue(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), OBSymmetryData::OBSymmetryData(), and SetAttribute().

## _type

unsigned int _type

protected inherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), GetDataType(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), and OBSymmetryData::OBSymmetryData().

## _source

DataOrigin _source

protected inherited

source of data for accounting

Referenced by GetOrigin(), OBGenericData(), OBSymmetryData::OBSymmetryData(), OBAngleData::operator=(), OBConformerData::operator=(), OBSymmetryData::operator=(), OBTorsionData::operator=(), and SetOrigin().

The documentation for this class was generated from the following file:

- tetrahedral.h