Open Babel  3.0
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
OBCisTransStereo Class Reference

#include <openbabel/stereo/cistrans.h>

Inheritance diagram for OBCisTransStereo:
OBTetraPlanarStereo OBStereoBase OBGenericData

Classes

struct  Config
 

Public Member Functions

 OBCisTransStereo (OBMol *mol)
 
virtual ~OBCisTransStereo ()
 
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
 
Cis/Trans stereochemistry
OBStereo::Type GetType () const
 
bool IsValid () const
 
void SetConfig (const Config &config)
 
Config GetConfig (OBStereo::Shape shape=OBStereo::ShapeU) const
 
Config GetConfig (unsigned long start, OBStereo::Shape shape=OBStereo::ShapeU) const
 
bool operator== (const OBCisTransStereo &other) const
 
bool operator!= (const OBCisTransStereo &other) const
 
Query methods to compare stereochemistry.
bool IsOnSameAtom (unsigned long id1, unsigned long id2) const
 
bool IsTrans (unsigned long id1, unsigned long id2) const
 
bool IsCis (unsigned long id1, unsigned long id2) const
 
unsigned long GetTransRef (unsigned long id) const
 
unsigned long GetCisRef (unsigned long id) 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 start, OBStereo::Shape shape=OBStereo::ShapeU)
 

Protected Attributes

std::string _attr
 
unsigned int _type
 
DataOrigin _source
 

Detailed Description

Class for handling and storing cis/trans stereochemistry.

cistrans.png

The OBCisTransStereo class is used to represent cis/trans stereochemistry. Like all OBTetraPlanarStereo subclasses, it uses the OBStereo::Shape parameters to set/get the OBStereo::Ref values in the Config struct. However, since the orientation of the double bond matters, all methods in the "query methods" section check the bonding by actually checking the atoms in the molecule provided through OBStereoBase's constructor. If OBMol::GetAtomById(id) returns 0 for a single id, it will be considered a deleted or implicit hydrogen if the valences confirm this.

The use of OBStereo::Shape is illustarted in the image below.

SPshapes.png
//
// 3 6 3 6
// \ / | |
// 0===1 = | 0 1 |
// / \ | |
// 4 5 4-------5
//
ct.SetCenters(0, 1);
ct.SetRefs(OBStereo::MakeRefs(3, 4, 5, 6), OBStereo::ShapeU);
ct.IsTrans(3, 5); // true
ct.IsTrans(3, 4); // false
ct.IsTrans(3, 6); // false
ct.IsCis(3, 6); // true
ct.IsCis(3, 4); // false
ct.IsCis(3, 5); // false
Since
version 2.3

Constructor & Destructor Documentation

◆ OBCisTransStereo()

OBCisTransStereo ( OBMol mol)

Constructor.

◆ ~OBCisTransStereo()

virtual ~OBCisTransStereo ( )
virtual

Destructor.

Member Function Documentation

◆ GetType()

OBStereo::Type GetType ( ) const
inlinevirtual

Get the OBStereo::Type for this object.

Returns
OBStereo::CisTrans

Implements OBStereoBase.

◆ IsValid()

bool IsValid ( ) const
Returns
True if this object is valid. This object is valid if all these conditions are met:

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::Shape  shape = OBStereo::ShapeU) const

◆ GetConfig() [2/2]

Config GetConfig ( unsigned long  start,
OBStereo::Shape  shape = OBStereo::ShapeU 
) const

Get the configuration as Config struct and ensure refs[0] is equal to start.

◆ operator==()

bool operator== ( const OBCisTransStereo other) const

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

Equal to operator. Comparing OBCisTransStereo::Config structs is done using the information stored in the struct's data members (i.e. begin, end, refs and shape).

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

  • begin and end don't match (is checked using the 2 combinations)
  • One of the Refs lists does not contain 4 elements.
  • 2 or more OBStereo::ImplicitRef values in a single Config struct
  • (The two refs don't share a single common element)

In the simplest case where both refs contain exactly the same elements (OBStereo::ContainsSameRefs()), coould include OBStereo::ImplicitRef), both Config struct are normalized to OBStereo::ShapeU starting with the same element. After this normalization, there are two possible orientations to overlay the shape on the double bond. From the illustration below, it can be seen only refs[2] has to be checked in order to conclude both Config structs have the same stereochemistry.

 1      4    1      4    1------4
  \    /     |      |           |
   C==C      |      |           |
  /    \     |      |           |
 2      3    2------3    2------3

             1 2 3 4     1 2 3 4
             |   |       |   |      <- in any case, refs[0] & refs[2] remain unchanged
             1 2 3 4     1 4 3 2

When comparing a Config struct with explicit hydrogen(s) to one with implicit hydrogen(s), both refs are also normalized to OBStereo::ShapeU starting with the same common element. This shared element cannot be OBStereo::ImplicitRef. Depending on the position of the OBStereo::ImplicitRef element(s) in the refs, 3 cases are possible:

 refs[2] != OBStereo::ImplicitId:

   (analog to the case above where they contained the same elements )

   1 2 3 4
   |   |      <- refs[0] & refs[2] remain unchanged
   1 H 3 H

 else:

   1 2 3 4
   |     |    <- refs[0] & refs[3] remain unchanged
   1 H H 4

   1 2 3 4
   | |        <- refs[0] & refs[1] remain unchanged
   1 2 H H

In each case, the orientation of the U shape is also defined since there can be only one OBStereo::ImplicitRef for each side of the double bond.

Returns
True if both Config structs represent the stereochemistry.

◆ operator!=()

bool operator!= ( const OBCisTransStereo 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.

◆ IsOnSameAtom()

bool IsOnSameAtom ( unsigned long  id1,
unsigned long  id2 
) const

Check if the two atoms for id1 & id2 are bonded to the same atom. If the atoms for one of the atoms doesn't exist (anymore), the valence of the begin and end atom is checked. If the exising atom is bonded to the begin atom and end->GetExplicitDegree() == 2, the ids are considered to be on different atoms. The reasoning behind this is that hydrogens may be deleted. However, you can also use OBStereo::ImplicitRef explicitly in code like:

//
// F F F F 0 3
// \ / | | | |
// C===C | C C | | 1 2 |
// / \ | | | |
// (H) (H) (H)----(H) H------H
//
reading smiles F/C=C\F cis-difluorethene
ct.SetCenters(1, 2);
...
Returns
True if id1 and id2 are bonded to the same atom taking implicit hydrogens into account.

◆ IsTrans()

bool IsTrans ( unsigned long  id1,
unsigned long  id2 
) const
Returns
True if the two reference ids are placed trans configuration.

◆ IsCis()

bool IsCis ( unsigned long  id1,
unsigned long  id2 
) const
Returns
True if the two reference ids are placed in a cis configuration.

◆ GetTransRef()

unsigned long GetTransRef ( unsigned long  id) const
gettransref.png

Get the reference id trans from reference id.

◆ GetCisRef()

unsigned long GetCisRef ( unsigned long  id) const
getcisref.png

Get the reference id cis from reference id.

◆ ToConfig()

static ConfigType ToConfig ( const ConfigType &  cfg,
unsigned long  start,
OBStereo::Shape  shape = OBStereo::ShapeU 
)
inlinestaticinherited

◆ GetMolecule()

OBMol* GetMolecule ( ) const
inlineinherited

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

◆ SetSpecified()

void SetSpecified ( bool  specified)
inlineinherited

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
inlineinherited
Returns
True if the stereochemistry is specified.

◆ SetAttribute()

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

◆ SetOrigin()

void SetOrigin ( const DataOrigin  s)
inlineinherited

◆ GetAttribute()

virtual const std::string& GetAttribute ( ) const
inlinevirtualinherited
Returns
The attribute (key), which can be used to retrieve this data

Referenced by OpenBabel::extract_thermochemistry(), and OBMoleculeFormat::MakeCombinedMolecule().

◆ GetDataType()

unsigned int GetDataType ( ) const
inlineinherited
Returns
the data type for this object as defined in OBGenericDataType

◆ GetValue()

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

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

Reimplemented in OBPairData, and OBCommentData.

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

◆ GetOrigin()

virtual DataOrigin GetOrigin ( ) const
inlinevirtualinherited

Member Data Documentation

◆ _attr

std::string _attr
protectedinherited

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

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _type

unsigned int _type
protectedinherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _source

DataOrigin _source
protectedinherited

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