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

Substructure search pattern-based implementation of the Chem::TautomerizationRule interface. 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 PatternBasedTautomerizationRule instance that is copy of 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. More...
 
void addExcludePattern (const MolecularGraph::SharedPointer &molgraph)
 Registers a rule exclude pattern. More...
 
void addExcludePatterns (const PatternBasedTautomerizationRule &rule)
 Appends all registered search patterns of rule to the exclude pattern list of this rule. More...
 
void clearExcludePatterns ()
 Removes all registered exclude patterns. More...
 
bool setup (MolecularGraph &parent_molgraph)
 Performs rule-specific setup work for the given molecular graph that shall be tautomerized. More...
 
unsigned int getID () const
 Returns the rule identifier. More...
 
bool generate (Molecule &tautomer)
 Generates the next tautomer of the parent molecular graph and stores it in molecule. More...
 
TautomerizationRule::SharedPointer clone () const
 Returns a deep copy of this rule instance. More...
 
- Public Member Functions inherited from CDPL::Chem::TautomerizationRule
virtual ~TautomerizationRule ()
 Virtual destructor. More...
 

Detailed Description

Substructure search pattern-based implementation of the Chem::TautomerizationRule interface.

The rule is configured with a set of transformation patterns 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 rule identifier (returned by getID()).

◆ PatternBasedTautomerizationRule() [2/2]

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

Constructs a PatternBasedTautomerizationRule instance that is copy of rule.

Parameters
ruleThe other rule 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 other rule to copy.
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.

Bond order changes are read from the iterator range [bond_chgs_beg, bond_chgs_end). Each element must be a value of type BondOrderChange that specifies the bond to change via the mapping IDs of the match pattern atoms.

Template Parameters
IterInput iterator type yielding BondOrderChange values.
Parameters
molgraphThe match pattern specifying the substructure to transform.
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 a rule exclude pattern.

Any matching substructures present in the parent molecular graph will be excluded from structure transformations.

Parameters
molgraphThe exclude match pattern.

◆ addExcludePatterns()

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

Appends all registered search patterns of rule to the exclude pattern list of this rule.

Parameters
ruleThe source rule whose search patterns shall be added.

◆ clearExcludePatterns()

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

Removes all registered exclude patterns.

◆ setup()

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

Performs rule-specific setup work for the given molecular graph that shall be tautomerized.

Parameters
parent_molgraphThe molecular graph to tautomerize.
Returns
true if the rule can be applied to parent_molgraph and has been initialized, and false otherwise.

Implements CDPL::Chem::TautomerizationRule.

◆ getID()

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

Returns the rule identifier.

Returns
The rule identifier (see namespace Chem::TautomerizationType for IDs of built-in rules).

Implements CDPL::Chem::TautomerizationRule.

◆ generate()

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

Generates the next tautomer of the parent molecular graph and stores it in molecule.

Parameters
tautomerThe tautomer output molecule.
Returns
true if a tautomer was generated, false if no more tautomers could be generated.
See also
setup()

Implements CDPL::Chem::TautomerizationRule.

◆ clone()

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

Returns a deep copy of this rule instance.

Returns
A shared pointer to the cloned rule.

Implements CDPL::Chem::TautomerizationRule.


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