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

Finds torsion rules from a TorsionLibrary that apply to a given rotatable bond. More...

#include <TorsionRuleMatcher.hpp>

Public Types

typedef RuleMatchList::const_iterator ConstMatchIterator
 A constant iterator over the stored torsion rule matches. More...
 

Public Member Functions

 TorsionRuleMatcher ()
 Constructs the TorsionRuleMatcher instance without an associated torsion library. More...
 
 TorsionRuleMatcher (const TorsionLibrary::SharedPointer &lib)
 Constructs the TorsionRuleMatcher instance and associates it with lib. More...
 
void findUniqueMappingsOnly (bool unique)
 Specifies whether only unique substructure mappings shall be reported during matching. More...
 
bool findUniqueMappingsOnly () const
 Tells whether only unique substructure mappings are reported during matching. More...
 
void findAllRuleMappings (bool all)
 Specifies whether all matching rules shall be reported (instead of just the most-specific one). More...
 
bool findAllRuleMappings () const
 Tells whether all matching rules are reported during matching. More...
 
void stopAtFirstMatchingRule (bool stop)
 Specifies whether the matching process shall stop at the first rule that produces matches. More...
 
bool stopAtFirstMatchingRule () const
 Tells whether matching stops at the first rule that produces matches. More...
 
void setTorsionLibrary (const TorsionLibrary::SharedPointer &lib)
 Sets the torsion library to query. More...
 
const TorsionLibrary::SharedPointergetTorsionLibrary () const
 Returns the currently associated torsion library. More...
 
std::size_t getNumMatches () const
 Returns the number of stored torsion rule matches found by calls to findMatches(). More...
 
const TorsionRuleMatchgetMatch (std::size_t idx) const
 Returns a const reference to the stored torsion rule match object at index idx. More...
 
ConstMatchIterator getMatchesBegin () const
 Returns a constant iterator pointing to the beginning of the stored torsion rule matches. More...
 
ConstMatchIterator getMatchesEnd () const
 Returns a constant iterator pointing to the end of the stored torsion rule matches. More...
 
ConstMatchIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored torsion rule matches. More...
 
ConstMatchIterator end () const
 Returns a constant iterator pointing to the end of the stored torsion rule matches. More...
 
bool findMatches (const Chem::Bond &bond, const Chem::MolecularGraph &molgraph, bool append=false)
 Searches the associated TorsionLibrary for rules that apply to the bond bond of molgraph. More...
 

Detailed Description

Finds torsion rules from a TorsionLibrary that apply to a given rotatable bond.

For a queried bond in a molecular graph the matcher iterates the configured TorsionLibrary (top-down through torsion categories) and reports every rule whose central bond SMARTS pattern matches at the queried bond. Each match is stored as a TorsionRuleMatch object providing the four matching atoms, the matched rule and the underlying atom/bond mapping.

Member Typedef Documentation

◆ ConstMatchIterator

typedef RuleMatchList::const_iterator CDPL::ConfGen::TorsionRuleMatcher::ConstMatchIterator

A constant iterator over the stored torsion rule matches.

Constructor & Destructor Documentation

◆ TorsionRuleMatcher() [1/2]

CDPL::ConfGen::TorsionRuleMatcher::TorsionRuleMatcher ( )

Constructs the TorsionRuleMatcher instance without an associated torsion library.

◆ TorsionRuleMatcher() [2/2]

CDPL::ConfGen::TorsionRuleMatcher::TorsionRuleMatcher ( const TorsionLibrary::SharedPointer lib)

Constructs the TorsionRuleMatcher instance and associates it with lib.

Parameters
libThe torsion library to query.

Member Function Documentation

◆ findUniqueMappingsOnly() [1/2]

void CDPL::ConfGen::TorsionRuleMatcher::findUniqueMappingsOnly ( bool  unique)

Specifies whether only unique substructure mappings shall be reported during matching.

Parameters
uniqueIf true, only one of multiple equivalent mappings is reported per rule.

◆ findUniqueMappingsOnly() [2/2]

bool CDPL::ConfGen::TorsionRuleMatcher::findUniqueMappingsOnly ( ) const

Tells whether only unique substructure mappings are reported during matching.

Returns
true if only unique mappings are reported, and false otherwise.

◆ findAllRuleMappings() [1/2]

void CDPL::ConfGen::TorsionRuleMatcher::findAllRuleMappings ( bool  all)

Specifies whether all matching rules shall be reported (instead of just the most-specific one).

Parameters
allIf true, every matching rule across all categories is reported.

◆ findAllRuleMappings() [2/2]

bool CDPL::ConfGen::TorsionRuleMatcher::findAllRuleMappings ( ) const

Tells whether all matching rules are reported during matching.

Returns
true if all matching rules are reported, and false otherwise.

◆ stopAtFirstMatchingRule() [1/2]

void CDPL::ConfGen::TorsionRuleMatcher::stopAtFirstMatchingRule ( bool  stop)

Specifies whether the matching process shall stop at the first rule that produces matches.

Parameters
stopIf true, matching stops as soon as a rule yields at least one match.

◆ stopAtFirstMatchingRule() [2/2]

bool CDPL::ConfGen::TorsionRuleMatcher::stopAtFirstMatchingRule ( ) const

Tells whether matching stops at the first rule that produces matches.

Returns
true if matching stops at the first matching rule, and false otherwise.

◆ setTorsionLibrary()

void CDPL::ConfGen::TorsionRuleMatcher::setTorsionLibrary ( const TorsionLibrary::SharedPointer lib)

Sets the torsion library to query.

Parameters
libThe new torsion library.

◆ getTorsionLibrary()

const TorsionLibrary::SharedPointer& CDPL::ConfGen::TorsionRuleMatcher::getTorsionLibrary ( ) const

Returns the currently associated torsion library.

Returns
A const reference to the torsion library smart pointer.

◆ getNumMatches()

std::size_t CDPL::ConfGen::TorsionRuleMatcher::getNumMatches ( ) const

Returns the number of stored torsion rule matches found by calls to findMatches().

Returns
The number of stored torsion rule matches.

◆ getMatch()

const TorsionRuleMatch& CDPL::ConfGen::TorsionRuleMatcher::getMatch ( std::size_t  idx) const

Returns a const reference to the stored torsion rule match object at index idx.

Parameters
idxThe zero-based index of the torsion rule match object to return.
Returns
A const reference to the torsion rule match object at index idx.
Exceptions
Base::IndexErrorif no torsion rule matches are available or idx is not in the range [0, getNumMatches() - 1].

◆ getMatchesBegin()

ConstMatchIterator CDPL::ConfGen::TorsionRuleMatcher::getMatchesBegin ( ) const

Returns a constant iterator pointing to the beginning of the stored torsion rule matches.

Returns
A constant iterator pointing to the beginning of the stored torsion rule matches.

◆ getMatchesEnd()

ConstMatchIterator CDPL::ConfGen::TorsionRuleMatcher::getMatchesEnd ( ) const

Returns a constant iterator pointing to the end of the stored torsion rule matches.

Returns
A constant iterator pointing to the end of the stored torsion rule matches.

◆ begin()

ConstMatchIterator CDPL::ConfGen::TorsionRuleMatcher::begin ( ) const

Returns a constant iterator pointing to the beginning of the stored torsion rule matches.

Returns
A constant iterator pointing to the beginning of the stored torsion rule matches.

◆ end()

ConstMatchIterator CDPL::ConfGen::TorsionRuleMatcher::end ( ) const

Returns a constant iterator pointing to the end of the stored torsion rule matches.

Returns
A constant iterator pointing to the end of the stored torsion rule matches.

◆ findMatches()

bool CDPL::ConfGen::TorsionRuleMatcher::findMatches ( const Chem::Bond bond,
const Chem::MolecularGraph molgraph,
bool  append = false 
)

Searches the associated TorsionLibrary for rules that apply to the bond bond of molgraph.

Parameters
bondThe rotatable bond for which matching torsion rules are sought.
molgraphThe molecular graph the bond belongs to.
appendIf true, new matches are appended to the previously stored ones; otherwise stored matches are cleared first.
Returns
true if at least one matching rule was found, and false otherwise.

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