Chemical Data Processing Library C++ API - Version 1.4.0
Classes | Public Types | Public Member Functions | List of all members
CDPL::Chem::PatternBasedTautomerizationRule Class Reference

SMARTS-pattern-based implementation of a Chem::TautomerizationRule. More...

#include <PatternBasedTautomerizationRule.hpp>

+ Inheritance diagram for CDPL::Chem::PatternBasedTautomerizationRule:

Classes

struct  BondOrderChange
 Encodes a single bond-order change between two pattern atoms applied when the parent transformation pattern matches. More...
 

Public Types

typedef std::shared_ptr< PatternBasedTautomerizationRuleSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated PatternBasedTautomerizationRule instances. More...
 
- Public Types inherited from CDPL::Chem::TautomerizationRule
typedef std::shared_ptr< TautomerizationRuleSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated TautomerizationRule instances. More...
 

Public Member Functions

 PatternBasedTautomerizationRule (unsigned int rule_id)
 Constructs the PatternBasedTautomerizationRule instance with the given rule identifier. More...
 
 PatternBasedTautomerizationRule (const PatternBasedTautomerizationRule &rule)
 Constructs a copy of the PatternBasedTautomerizationRule instance rule. More...
 
PatternBasedTautomerizationRuleoperator= (const PatternBasedTautomerizationRule &rule)
 Replaces the state of this rule by a copy of the state of rule. More...
 
template<typename Iter >
void addTransformationPattern (const MolecularGraph::SharedPointer &molgraph, Iter bond_chgs_beg, Iter bond_chgs_end)
 Registers a new transformation pattern together with the associated bond-order changes. More...
 
void addExcludePattern (const MolecularGraph::SharedPointer &molgraph)
 Registers an exclude pattern: when this substructure is present in the parent molecular graph, the matching transformation will not be applied. More...
 
void addExcludePatterns (const PatternBasedTautomerizationRule &rule)
 Copies all exclude patterns of rule into this rule. More...
 
void clearExcludePatterns ()
 Removes all registered exclude patterns. More...
 
bool setup (MolecularGraph &parent_molgraph)
 Prepares the rule for tautomer enumeration on parent_molgraph. More...
 
unsigned int getID () const
 Returns the rule identifier supplied at construction. More...
 
bool generate (Molecule &tautomer)
 Writes the next tautomer reachable from the parent molecular graph into tautomer. More...
 
TautomerizationRule::SharedPointer clone () const
 Creates and returns a deep copy of this rule. More...
 
- Public Member Functions inherited from CDPL::Chem::TautomerizationRule
virtual ~TautomerizationRule ()
 Virtual destructor. More...
 

Detailed Description

SMARTS-pattern-based implementation of a Chem::TautomerizationRule.

The rule is configured with a set of transformation patterns (SMARTS queries describing the source substructure together with per-atom-pair bond-order changes that apply when the pattern matches) plus optional exclude patterns (substructures that, when present, suppress the application of the rule). The setup() / generate() pair from the base class then enumerates the tautomers reachable from the parent molecular graph by applying the configured transformations.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated PatternBasedTautomerizationRule instances.

Constructor & Destructor Documentation

◆ PatternBasedTautomerizationRule() [1/2]

CDPL::Chem::PatternBasedTautomerizationRule::PatternBasedTautomerizationRule ( unsigned int  rule_id)

Constructs the PatternBasedTautomerizationRule instance with the given rule identifier.

Parameters
rule_idThe numeric rule identifier (returned by getID() and forwarded to the generated tautomers).

◆ PatternBasedTautomerizationRule() [2/2]

CDPL::Chem::PatternBasedTautomerizationRule::PatternBasedTautomerizationRule ( const PatternBasedTautomerizationRule rule)

Constructs a copy of the PatternBasedTautomerizationRule instance rule.

Parameters
ruleThe PatternBasedTautomerizationRule to copy.

Member Function Documentation

◆ operator=()

PatternBasedTautomerizationRule& CDPL::Chem::PatternBasedTautomerizationRule::operator= ( const PatternBasedTautomerizationRule rule)

Replaces the state of this rule by a copy of the state of rule.

Parameters
ruleThe source PatternBasedTautomerizationRule.
Returns
A reference to itself.

◆ addTransformationPattern()

template<typename Iter >
void CDPL::Chem::PatternBasedTautomerizationRule::addTransformationPattern ( const MolecularGraph::SharedPointer molgraph,
Iter  bond_chgs_beg,
Iter  bond_chgs_end 
)
inline

Registers a new transformation pattern together with the associated bond-order changes.

Bond-order changes are read from the iterator range [bond_chgs_beg, bond_chgs_end); each element must be a BondOrderChange value referring to atom IDs of molgraph.

Template Parameters
IterInput iterator type yielding BondOrderChange values.
Parameters
molgraphThe SMARTS transformation pattern.
bond_chgs_begIterator pointing to the first bond-order change.
bond_chgs_endIterator pointing one past the last bond-order change.

◆ addExcludePattern()

void CDPL::Chem::PatternBasedTautomerizationRule::addExcludePattern ( const MolecularGraph::SharedPointer molgraph)

Registers an exclude pattern: when this substructure is present in the parent molecular graph, the matching transformation will not be applied.

Parameters
molgraphThe exclude SMARTS pattern.

◆ addExcludePatterns()

void CDPL::Chem::PatternBasedTautomerizationRule::addExcludePatterns ( const PatternBasedTautomerizationRule rule)

Copies all exclude patterns of rule into this rule.

Parameters
ruleThe source rule whose exclude patterns are copied.

◆ clearExcludePatterns()

void CDPL::Chem::PatternBasedTautomerizationRule::clearExcludePatterns ( )

Removes all registered exclude patterns.

◆ setup()

bool CDPL::Chem::PatternBasedTautomerizationRule::setup ( MolecularGraph parent_molgraph)
virtual

Prepares the rule for tautomer enumeration on parent_molgraph.

Parameters
parent_molgraphThe parent molecular graph from which tautomers are generated.
Returns
true if the rule could be set up (at least one transformation pattern matched), and false otherwise.

Implements CDPL::Chem::TautomerizationRule.

◆ getID()

unsigned int CDPL::Chem::PatternBasedTautomerizationRule::getID ( ) const
virtual

Returns the rule identifier supplied at construction.

Returns
The numeric rule ID.

Implements CDPL::Chem::TautomerizationRule.

◆ generate()

bool CDPL::Chem::PatternBasedTautomerizationRule::generate ( Molecule tautomer)
virtual

Writes the next tautomer reachable from the parent molecular graph into tautomer.

Parameters
tautomerThe output molecule receiving the next tautomer.
Returns
true if a new tautomer was generated, and false when the enumeration is exhausted.

Implements CDPL::Chem::TautomerizationRule.

◆ clone()

TautomerizationRule::SharedPointer CDPL::Chem::PatternBasedTautomerizationRule::clone ( ) const
virtual

Creates and returns a deep copy of this rule.

Returns
A smart pointer to the cloned Chem::TautomerizationRule.

Implements CDPL::Chem::TautomerizationRule.


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