Classes | Public Member Functions | Static Public Member Functions | Protected Attributes

OBTetrahedralStereo Class Reference
[Stereochemistry]

Class for handling and storing tetrahedral atom stereochemistry. More...

#include <openbabel/stereo/tetrahedral.h>

Inheritance diagram for OBTetrahedralStereo:
OBTetraNonPlanarStereo OBStereoBase OBGenericData

List of all members.

Classes

struct  Config
 Stereochemical configuration for tetrahedral stereocenters. More...

Public Member Functions

 OBTetrahedralStereo (OBMol *mol)
virtual ~OBTetrahedralStereo ()
OBGenericDataClone (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
OBMolGetMolecule () 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).

tetrahedral.png

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 ( OBMol mol )

Constructor.

virtual ~OBTetrahedralStereo (  ) [virtual]

Destructor.


Member Function Documentation

OBStereo::Type GetType ( void   ) const [inline, virtual]

Get the OBStereo::Type for this object.

Returns:
OBStereo::Tetrahedral

Implements OBStereoBase.

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().

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
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:

  • 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.
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.
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;
     };
 };
Parameters:
cfgA ConfigType struct from a OBTetraNonPlanar subclass.
from_or_towardsThe desired from/towards reference id (see view)
windingThe desired winding.
viewThe desired viewing direction.
Returns:
The ConfigType struct with desired from/towards, winding and view.
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]
Returns:
True if the stereochemistry is specified.
void SetAttribute ( const std::string &  v ) [inline, inherited]
void SetOrigin ( const DataOrigin  s ) [inline, inherited]
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().

unsigned int GetDataType (  ) const [inline, inherited]
Returns:
the data type for this object as defined in OBGenericDataType
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]

Member Data Documentation

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]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines