Generated on Wed Apr 29 2015 11:51:41 for GGL-4.1.2 by doxygen 1.8.3.1
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes
ggl::chem::ChemRule Class Reference

Chemical graph grammar rule. More...

#include <ChemRule.hh>

Inheritance diagram for ggl::chem::ChemRule:
Inheritance graph
[legend]

Data Structures

class  TransitionState
 

Public Types

typedef
SuperClass::CopyAndPasteOperations 
CopyAndPasteOperations
 Cut-and-paste operation container. More...
 
typedef SuperClass::CoreGraph CoreGraph
 Access to the CoreGraph template argument. More...
 
typedef boost::property
< EdgeLabelProperty,
std::string, boost::property
< EdgeContextProperty,
RuleContext > > 
CoreGraph_EdgeProperties
 
typedef boost::property
< NodeIndexProperty, size_t,
boost::property
< NodeLabelProperty,
std::string, boost::property
< NodeRightLabelProperty,
std::string, boost::property
< NodeContextProperty,
RuleContext > > > > 
CoreGraph_NodeProperties
 The properties available for the nodes of a CoreGraph. More...
 
typedef
SuperClass::EdgeContextProperty 
EdgeContextProperty
 Access to the EDGE_RULE_CONTEXT_PROPERTY template argument. More...
 
typedef
SuperClass::EdgeLabelProperty 
EdgeLabelProperty
 Access to the EDGE_LABEL_PROPERTY template argument. More...
 
typedef std::vector
< sgm::Pattern_Interface::Match_Constraint * > 
MatchConstraintVec
 vector of constraints to be matched More...
 
typedef
SuperClass::NodeContextProperty 
NodeContextProperty
 Access to the NODE_RULE_CONTEXT_PROPERTY template argument. More...
 
typedef
SuperClass::NodeIndexProperty 
NodeIndexProperty
 Access to the NODE_INDEX_PROPERTY template argument. More...
 
typedef
SuperClass::NodeLabelProperty 
NodeLabelProperty
 Access to the NODE_LABEL_PROPERTY template argument. More...
 
typedef std::map< size_t, size_t > NodeMap
 
typedef
SuperClass::NodeRightLabelProperty 
NodeRightLabelProperty
 Access to the NODE_RIGHT_LABEL_PROPERTY template argument. More...
 
typedef std::vector< size_t > NodeVec
 Vector of node indices. More...
 
typedef std::map< size_t, NodeVecOutEdgeMap
 
typedef SuperClass::RuleCnP RuleCnP
 Cut-and-paste operation definition. More...
 
enum  RuleContext { RULE_LEFT_SIDE = 2, RULE_RIGHT_SIDE = 3, RULE_LABEL_CHANGE = (RULE_LEFT_SIDE * RULE_RIGHT_SIDE), RULE_CONTEXT = 5 * RULE_LABEL_CHANGE }
 
typedef SuperClass::RuleSide RuleSide
 
typedef ggl::Rule SuperClass
 Access to the super class type. More...
 

Public Member Functions

 ChemRule (const CoreGraph &core, const std::string &id=std::string(""))
 
 ChemRule (const CoreGraph &core, const std::string &id, const std::vector< sgm::Pattern_Interface::Match_Constraint * > &constraints, const CopyAndPasteOperations &copyAndPaste)
 
 ChemRule (const CoreGraph &core, const std::string &id, const std::vector< sgm::Pattern_Interface::Match_Constraint * > &constraints)
 
 ChemRule (const ChemRule &toCopy)
 
 ChemRule (const ggl::Rule &toCopy)
 
virtual bool decodeConsistencyStatus (const size_t consistencyCode, std::ostream &errorStream, const bool completeCheck=true)
 
const RuleSidegetContext (void) const
 
const CopyAndPasteOperationsgetCopyAndPasteOperations (void) const
 
const CoreGraphgetCore (void) const
 
const std::string & getID (void) const
 
const RuleSidegetLeftSide (void) const
 
const MatchConstraintVecgetMatchConstraints (void) const
 
const RuleSidegetRightSide (void) const
 
const TransitionStategetTransitionState () const
 
virtual const std::string * getUsedWildcard (void) const
 
virtual size_t isConsistent (void) const
 
ChemRuleoperator= (const ChemRule &toCopy)
 
void setID (const std::string &newID)
 
virtual void setUsedWildcard (const std::string *const wildcardToUse)
 
virtual ~ChemRule ()
 Destruction. More...
 

Static Public Member Functions

static bool insertGroups (CoreGraph &core, const GroupMap &groups) throw (std::runtime_error)
 

Static Public Attributes

static const size_t C_AtomComplexWithH
 
static const size_t C_AtomLabelInvalid
 consistency code : an atom label is not SMILES conform More...
 
static const size_t C_BondLabelInvalid
 consistency code : a bond label is not SMILES conform More...
 
static const size_t C_BondLoop
 
static const size_t C_Consistent
 consistency code : everything fine More...
 
static const size_t C_Consistent
 consistency code : everything fine More...
 
static const size_t C_EdgeMultiplicity
 consistency code : at least for one bond too many edges are given More...
 
static const size_t C_NodeInsertDeletion
 consistency code : at least one node is created or destroyed More...
 
static const size_t C_NoID
 consistency code : no rule ID is present More...
 
static const size_t C_NoID
 consistency code : no rule ID is present More...
 
static const size_t C_UnbalancedElectrons
 
static const size_t C_WrongEdgeContext
 consistency code : at least one edge shows wrong context usage More...
 
static const size_t C_WrongEdgeContext
 consistency code : at least one edge shows wrong context usage More...
 

Static Protected Member Functions

static void addImplicitNoEdgeConstraints (ChemRule &toUpdate)
 
static bool checkAtomComplexWithH (const CoreGraph &coreGraph)
 
static bool checkAtomLabel (const CoreGraph &coreGraph)
 
static bool checkBondLabel (const CoreGraph &coreGraph)
 
static bool checkBondLoop (const CoreGraph &coreGraph)
 
static bool checkEdgeContext (const CoreGraph &coreGraph)
 
static bool checkEdgeInDel (const CoreGraph &coreGraph)
 
static bool checkElectronChange (const CoreGraph &coreGraph)
 
static bool checkNodeInDel (const CoreGraph &coreGraph)
 
static NodeVec getRuleSideNodes (const CoreGraph &graph, const RuleContext &level)
 

Protected Attributes

RuleSide Context
 the information describing the invariant context of the Rule More...
 
CopyAndPasteOperations copyAndPaste
 the copy-and-Paste operations to perform More...
 
CoreGraph core
 the boost graph that is encoding the graph grammar rule More...
 
std::string id
 the id or description of this rules More...
 
RuleSide LeftSide
 the information describing the left side pattern of the Rule More...
 
RuleSide RightSide
 the information describing the right side (result) of the Rule More...
 
TransitionStatetransitionState
 
std::string * wildcard
 the wildcard string to use for left side pattern matching More...
 

Detailed Description

    A description of a graph grammar rule with left and righ rule side and
    context description. It describes a chemical reaction as well as its
    transition state etc.
Author
Martin Mann (c) 2009 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 63 of file ChemRule.hh.

Member Typedef Documentation

Definition at line 94 of file ChemRule.hh.

Definition at line 75 of file ChemRule.hh.

typedef boost::property< EdgeLabelProperty, std::string , boost::property< EdgeContextProperty, RuleContext > > ggl::Rule::CoreGraph_EdgeProperties
inherited

The properties available for the edges of a CoreGraph

        NOTE: EdgeContextProperty is NOT TO BE allowed to be RULE_LABEL_CHANGE.
        Label changes of edges are to be encoded by insertion and deletion of
        the edge, ie. present two times with according RULE_LEFT_SIDE and
        RULE_RIGHT_SIDE EdgeContextProperty value.

Definition at line 142 of file Rule.hh.

typedef boost::property< NodeIndexProperty, size_t , boost::property< NodeLabelProperty, std::string , boost::property< NodeRightLabelProperty, std::string , boost::property< NodeContextProperty, RuleContext > > > > ggl::Rule::CoreGraph_NodeProperties
inherited

Definition at line 118 of file Rule.hh.

Definition at line 81 of file ChemRule.hh.

Definition at line 87 of file ChemRule.hh.

Definition at line 157 of file Rule.hh.

Definition at line 79 of file ChemRule.hh.

Definition at line 77 of file ChemRule.hh.

Definition at line 83 of file ChemRule.hh.

typedef std::map< size_t, size_t > ggl::Rule::NodeMap
inherited

Definition at line 78 of file Rule.hh.

Definition at line 85 of file ChemRule.hh.

typedef std::vector< size_t > ggl::Rule::NodeVec
inherited

Definition at line 63 of file Rule.hh.

typedef std::map< size_t, NodeVec > ggl::Rule::OutEdgeMap
inherited

If a node has outgoing edges, this class contains the indices of the ends of these edges.

Definition at line 77 of file Rule.hh.

Definition at line 92 of file ChemRule.hh.

A container that stores the information of a context side of a graph grammar rule like left, right, and context.

Definition at line 90 of file ChemRule.hh.

Definition at line 72 of file ChemRule.hh.

Member Enumeration Documentation

enum ggl::Rule::RuleContext
inherited

A type definition to encode the different use cases of a node or edge of a graph grammar rule.

Enumerator
RULE_LEFT_SIDE 

graph element is ONLY part of the left rule side

RULE_RIGHT_SIDE 

graph element is ONLY part of the right rule side

RULE_LABEL_CHANGE 

node is part of the both rule sides but the LABEL is CHANGING. NOTE: only valid for nodes!!!

RULE_CONTEXT 

graph element is part of the both rule sides = context of the rule

Definition at line 83 of file Rule.hh.

Constructor & Destructor Documentation

ggl::chem::ChemRule::ChemRule ( const CoreGraph core,
const std::string &  id = std::string("") 
)

Construction of a rule based on the given boost graph based core description.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
ggl::chem::ChemRule::ChemRule ( const CoreGraph core,
const std::string &  id,
const std::vector< sgm::Pattern_Interface::Match_Constraint * > &  constraints,
const CopyAndPasteOperations copyAndPaste 
)

Construction of a rule based on the given boost graph based core description.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
constraintsthe additional constraints for the matching of the left side of the rule
copyAndPastethe Cut-and-Paste operations to perform
ggl::chem::ChemRule::ChemRule ( const CoreGraph core,
const std::string &  id,
const std::vector< sgm::Pattern_Interface::Match_Constraint * > &  constraints 
)

Construction of a rule based on the given boost graph based core description.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
constraintsthe additional constraints for the matching of the left side of the rule
ggl::chem::ChemRule::ChemRule ( const ChemRule toCopy)

Copy construction.

Parameters
toCopythe ChemRule to make this a copy of
ggl::chem::ChemRule::ChemRule ( const ggl::Rule toCopy)

Construction from a normal graph grammar rule.

Parameters
toCopythe ChemRule to make this a copy of
virtual ggl::chem::ChemRule::~ChemRule ( )
virtual

Member Function Documentation

static void ggl::chem::ChemRule::addImplicitNoEdgeConstraints ( ChemRule toUpdate)
staticprotected

Adds no edge constraints for all edges that are right side context only, to avoid the appearance of parallel edges within molecule graphs.

Parameters
toUpdatethe ChemRule instance to update
static bool ggl::chem::ChemRule::checkAtomComplexWithH ( const CoreGraph coreGraph)
staticprotected

Checks if any complex node label (in any context) contains implicit H atoms. This is currently not supported by the library.

Parameters
coreGraphthe rule core graph to check
Returns
true if all atom/node labels are ok, false otherwise
static bool ggl::chem::ChemRule::checkAtomLabel ( const CoreGraph coreGraph)
staticprotected

Checks if the atom (node) labels are SMILES conform. This is checked for input and output of the rule (left/right side).

Parameters
coreGraphthe rule core graph to check
Returns
true if all atom/node label are ok, false otherwise
static bool ggl::chem::ChemRule::checkBondLabel ( const CoreGraph coreGraph)
staticprotected

Checks if the bond (edge) labels are SMILES conform. This is checked for input and output of the rule (left/right side).

Parameters
coreGraphthe rule core graph to check
Returns
true if all bond/edge label are ok, false otherwise
static bool ggl::chem::ChemRule::checkBondLoop ( const CoreGraph coreGraph)
staticprotected

Checks if an atom forms a bond with itself, i.e. a loop bond.

Parameters
coreGraphthe rule core graph to check
Returns
true iff all bond labels are ok; false otherwise
static bool ggl::Rule::checkEdgeContext ( const CoreGraph coreGraph)
staticprotectedinherited

Checks the context assumptions of all edges, ie.

  • context edges have to connect context nodes,
  • left side edges have to connect left or context nodes, and
  • right side edges have to connect right or context nodes.
Parameters
coreGraphthe rule core graph to check
Returns
true if all edges show correct context use; false otherwise
static bool ggl::chem::ChemRule::checkEdgeInDel ( const CoreGraph coreGraph)
staticprotected

Checks that all bonds in the molecule graph are defined by the correct number of edges. That is either a single context, left, or right edge, or the combination of a left and right edge. Otherwise, no single bond between two atoms are defined by the rule.

Parameters
coreGraphthe rule core graph to check
Returns
true if all bond definitions are correct, false otherwise
static bool ggl::chem::ChemRule::checkElectronChange ( const CoreGraph coreGraph)
staticprotected

Checks for each atom, if the electron changes of the adjacent bonds and the atom label are balanced.

NOTE: for aromatic atoms, the an unbalanced electron change of 1 is tolerated due to the flexibility of the involved electrons within the aromatic ring.

Parameters
coreGraphthe rule core graph to check
Returns
true if all electron changes are ok, false otherwise
static bool ggl::chem::ChemRule::checkNodeInDel ( const CoreGraph coreGraph)
staticprotected

Checks that no node in the graph is created or destroyed, i.e. if all nodes in the given rule core graph are part of the context or undergo a label change

Parameters
coreGraphthe rule core graph to check
Returns
true if no node is created/destroyed, false otherwise
virtual bool ggl::chem::ChemRule::decodeConsistencyStatus ( const size_t  consistencyCode,
std::ostream &  errorStream,
const bool  completeCheck = true 
)
virtual

Writes a description of the consistency status or errors, encoded in a consistency code produced by isConsistent*(...), to a given outstream. The function returns whether or not an error occured.

Parameters
consistencyCodethe error code to parse, produced by a call to isConsistent(...)
errorStreamthe output stream to write the error decription to
completeCheckif true: tries to decode the whole consistencyCode and reports an error message if this is not possible. if false: decodes and reports only the known error codes from consistencyCode
Returns
true if no error is encoded; false otherwise

Reimplemented from ggl::Rule.

const RuleSide& ggl::Rule::getContext ( void  ) const
inherited

Access to the context of the Rule that is fixed during the Rule application and that is present in the left and right side of the Rule.

Returns
the context
const CopyAndPasteOperations& ggl::Rule::getCopyAndPasteOperations ( void  ) const
inherited

Access to the copy-and-Paste operations to perform

Returns
the CnP operation container
const CoreGraph& ggl::Rule::getCore ( void  ) const
inherited

Access to the core graph that encodes the whole Rule.

Returns
the Rule's core graph
const std::string& ggl::Rule::getID ( void  ) const
inherited

Access to the string identifier or description of the Rule.

Returns
the identifier
const RuleSide& ggl::Rule::getLeftSide ( void  ) const
inherited

Access to the left side pattern of the rule that has to be matched when the Rule is applied.

Returns
the left side pattern
const MatchConstraintVec& ggl::Rule::getMatchConstraints ( void  ) const
inherited

Access to the match constraints to fulfill for each left side match

Returns
the match constraint container
const RuleSide& ggl::Rule::getRightSide ( void  ) const
inherited

Access to the right side pattern that is produced after the Rule was applied.

Returns
the right side pattern
static NodeVec ggl::Rule::getRuleSideNodes ( const CoreGraph graph,
const RuleContext level 
)
staticprotectedinherited

Utility member function to derive the node information that describes a certain part of the Rule.

Parameters
graphthe core graph that contains the whole information
levelidentifies what RuleSide is of interest
Returns
the vector of node indices of the requested RuleSide
const TransitionState& ggl::chem::ChemRule::getTransitionState ( ) const

Access to the minimal transition state of the chemical reaction covered by this chemical graph grammar rule.

Returns
the minimal transition state for this rule
virtual const std::string* ggl::chem::ChemRule::getUsedWildcard ( void  ) const
virtual

Access to the chemical wildcard string to use for left side pattern matching

Returns
the wildcard label MoleculeUtil::AtomLabelWildcard

Reimplemented from ggl::Rule.

static bool ggl::chem::ChemRule::insertGroups ( CoreGraph core,
const GroupMap groups 
) throw (std::runtime_error)
static

Replaces all nodes with group labels with the according molecule component if present in groups. If the group label is unknown, the method returns false; true otherwise.

NOTE: The node replacement is NOT recursive to avoid infinite replacement chains.

Parameters
corethe rule core graph to alter
groupsthe list of known groups to be inserted
Returns
true if all group labels have been replaced; false otherwise
Exceptions
std::runtime_errorif a group is to be insert for a non-context node
virtual size_t ggl::chem::ChemRule::isConsistent ( void  ) const
virtual

Checks whether or not this rule is a consistent one. If not, a combination of according error codes is given.

Returns
the value is either C_Consistent, or a product of all other consistency error codes encountered

Reimplemented from ggl::Rule.

ChemRule& ggl::chem::ChemRule::operator= ( const ChemRule toCopy)

Assignment operator

Parameters
toCopythe ChemRule to make this a copy of
Returns
*this
void ggl::Rule::setID ( const std::string &  newID)
inherited

Sets the string identifier or description of the Rule.

Parameters
newIDthe new identifier to set
virtual void ggl::chem::ChemRule::setUsedWildcard ( const std::string *const  wildcardToUse)
virtual

Overwrites and disables the wildcard setup. This function does NOT change the wildcard, since the wildcard is fixed to MoleculeUtil::AtomLabelWildcard for chemical rules. Thus, this method is a dummy overwrite.

Parameters
wildcardToUseignored parameter

Reimplemented from ggl::Rule.

Field Documentation

const size_t ggl::chem::ChemRule_Constants::C_AtomComplexWithH
staticinherited

consistency code : at least one atom label is complex and contains implicit H atoms, this is currently not supported

Definition at line 42 of file ChemRule.hh.

const size_t ggl::chem::ChemRule_Constants::C_AtomLabelInvalid
staticinherited

Definition at line 34 of file ChemRule.hh.

const size_t ggl::chem::ChemRule_Constants::C_BondLabelInvalid
staticinherited

Definition at line 36 of file ChemRule.hh.

const size_t ggl::chem::ChemRule_Constants::C_BondLoop
staticinherited

consistency code : at least one atom label is complex and contains implicit H atoms, this is currently not supported

Definition at line 45 of file ChemRule.hh.

const size_t ggl::Rule_ConCodes::C_Consistent
staticinherited

Definition at line 37 of file Rule.hh.

const size_t ggl::Rule_ConCodes::C_Consistent
staticinherited

Definition at line 37 of file Rule.hh.

const size_t ggl::chem::ChemRule_Constants::C_EdgeMultiplicity
staticinherited

Definition at line 32 of file ChemRule.hh.

const size_t ggl::chem::ChemRule_Constants::C_NodeInsertDeletion
staticinherited

Definition at line 30 of file ChemRule.hh.

const size_t ggl::Rule_ConCodes::C_NoID
staticinherited

Definition at line 39 of file Rule.hh.

const size_t ggl::Rule_ConCodes::C_NoID
staticinherited

Definition at line 39 of file Rule.hh.

const size_t ggl::chem::ChemRule_Constants::C_UnbalancedElectrons
staticinherited

consistency code : the valence/electron change of an atom is not balanced

Definition at line 39 of file ChemRule.hh.

const size_t ggl::Rule_ConCodes::C_WrongEdgeContext
staticinherited

Definition at line 41 of file Rule.hh.

const size_t ggl::Rule_ConCodes::C_WrongEdgeContext
staticinherited

Definition at line 41 of file Rule.hh.

RuleSide ggl::Rule::Context
protectedinherited

Definition at line 386 of file Rule.hh.

CopyAndPasteOperations ggl::Rule::copyAndPaste
protectedinherited

Definition at line 389 of file Rule.hh.

CoreGraph ggl::Rule::core
protectedinherited

Definition at line 163 of file Rule.hh.

std::string ggl::Rule::id
protectedinherited

Definition at line 166 of file Rule.hh.

RuleSide ggl::Rule::LeftSide
protectedinherited

Definition at line 382 of file Rule.hh.

RuleSide ggl::Rule::RightSide
protectedinherited

Definition at line 384 of file Rule.hh.

TransitionState* ggl::chem::ChemRule::transitionState
mutableprotected

the encoding of the minimal transition state of this reaction which is generated on demand (initially not calculated)

Definition at line 378 of file ChemRule.hh.

std::string* ggl::Rule::wildcard
protectedinherited

Definition at line 169 of file Rule.hh.


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