Class for handling and storing tetrahedral atom stereochemistry. More...
#include <openbabel/stereo/tetrahedral.h>
Classes | |
struct | Config |
Stereochemical configuration for tetrahedral stereocenters. More... | |
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 |
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.
OBTetrahedralStereo | ( | OBMol * | mol ) |
Constructor.
virtual ~OBTetrahedralStereo | ( | ) | [virtual] |
Destructor.
OBStereo::Type GetType | ( | void | ) | const [inline, virtual] |
bool IsValid | ( | ) | const |
Referenced by OpenBabel::CanonicalLabels().
void SetConfig | ( | const Config & | config ) |
Set the configuration using a Config struct.
Referenced by OpenBabel::CanonicalLabels().
Config GetConfig | ( | OBStereo::Winding | winding = OBStereo::Clockwise , |
OBStereo::View | view = OBStereo::ViewFrom |
||
) | const |
Get the configuration as Config struct.
Referenced by OpenBabel::CanonicalLabels(), OBBuilder::CorrectStereoAtoms(), and OBSmartsMatcher::match().
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.
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:
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.
bool operator!= | ( | const OBTetrahedralStereo & | other ) | const [inline] |
Not equal to operator. This is the inverse of the Equal to operator==.
OBGenericData* Clone | ( | OBBase * | mol ) | const [virtual] |
Reimplemented from OBGenericData.
static 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; }; };
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. |
static void ChangeWinding | ( | ConfigType & | cfg ) | [inline, static, inherited] |
Change the winding of the ConfigType struct while maintaining the stereochemistry.
static void ChangeView | ( | ConfigType & | cfg ) | [inline, static, inherited] |
Change the view of the ConfigType struct while maintaining the stereochemistry.
static void Invert | ( | ConfigType & | cfg ) | [inline, static, inherited] |
Invert the stereochemistry of the ConfigType struct.
OBMol* GetMolecule | ( | ) | const [inline, inherited] |
Get the molecule. This can be used by subclasses when more information is needed (e.g. OBCisTransStereo::GetCisRef, ...).
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.
bool IsSpecified | ( | ) | const [inline, inherited] |
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(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBForceField::GetAtomTypes(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().
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(), OpenBabel::CalcSignedVolume(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().
virtual const std::string& GetAttribute | ( | ) | const [inline, virtual, inherited] |
Referenced by OBMoleculeFormat::MakeCombinedMolecule().
unsigned int GetDataType | ( | ) | const [inline, inherited] |
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().
virtual DataOrigin GetOrigin | ( | ) | const [inline, virtual, inherited] |
std::string _attr [protected, inherited] |
attribute tag (e.g., "UnitCell", "Comment" or "Author")
Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().
unsigned int _type [protected, inherited] |
attribute type -- declared for each subclass
Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().
DataOrigin _source [protected, inherited] |
source of data for accounting
Referenced by OBChiralData::operator=(), OBTorsionData::operator=(), OBAngleData::operator=(), OBConformerData::operator=(), and OBSymmetryData::operator=().