![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Searches for substructures of the components of a target reaction that match a given query reaction pattern. More...
#include <ReactionSubstructureSearch.hpp>
Public Types | |
| typedef boost::indirect_iterator< ABMappingList::iterator, AtomBondMapping > | MappingIterator |
| A mutable random access iterator used to iterate over the stored Chem::AtomBondMapping mapping objects. More... | |
| typedef boost::indirect_iterator< ABMappingList::const_iterator, const AtomBondMapping > | ConstMappingIterator |
A constant random access iterator used to iterate over the stored const Chem::AtomBondMapping objects. More... | |
Public Member Functions | |
| ReactionSubstructureSearch () | |
Constructs and initializes the ReactionSubstructureSearch instance. More... | |
| ReactionSubstructureSearch (const Reaction &query) | |
Constructs and initializes the ReactionSubstructureSearch instance for the specified query reaction pattern query. More... | |
| ReactionSubstructureSearch (const ReactionSubstructureSearch &)=delete | |
| ~ReactionSubstructureSearch () | |
| Destructor. More... | |
| ReactionSubstructureSearch & | operator= (const ReactionSubstructureSearch &)=delete |
| void | setQuery (const Reaction &query) |
| Sets query as the new query reaction pattern. More... | |
| bool | mappingExists (const Reaction &target) |
| Tells whether the query reaction pattern matches the target reaction target. More... | |
| bool | findMappings (const Reaction &target) |
| Searches for all possible atom/bond mappings between the query reaction pattern and the target reaction target. More... | |
| std::size_t | getNumMappings () const |
| Returns the number of atom/bond mappings that were recorded in the last call to findMappings(). More... | |
| AtomBondMapping & | getMapping (std::size_t idx) |
Returns a non-const reference to the stored atom/bond mapping object at index idx. More... | |
| const AtomBondMapping & | getMapping (std::size_t idx) const |
Returns a const reference to the stored atom/bond mapping object at index idx. More... | |
| MappingIterator | getMappingsBegin () |
| Returns a mutable iterator pointing to the beginning of the stored Chem::AtomBondMapping objects. More... | |
| ConstMappingIterator | getMappingsBegin () const |
Returns a constant iterator pointing to the beginning of the stored const Chem::AtomBondMapping objects. More... | |
| MappingIterator | getMappingsEnd () |
| Returns a mutable iterator pointing to the end of the stored Chem::AtomBondMapping objects. More... | |
| ConstMappingIterator | getMappingsEnd () const |
Returns a constant iterator pointing to the end of the stored const Chem::AtomBondMapping objects. More... | |
| MappingIterator | begin () |
| Returns a mutable iterator pointing to the beginning of the stored Chem::AtomBondMapping objects. More... | |
| ConstMappingIterator | begin () const |
Returns a constant iterator pointing to the beginning of the stored const Chem::AtomBondMapping objects. More... | |
| MappingIterator | end () |
| Returns a mutable iterator pointing to the end of the stored Chem::AtomBondMapping objects. More... | |
| ConstMappingIterator | end () const |
Returns a constant iterator pointing to the end of the stored const Chem::AtomBondMapping objects. More... | |
| void | uniqueMappingsOnly (bool unique) |
| Allows to specify whether or not to store only unique atom/bond mappings. More... | |
| bool | uniqueMappingsOnly () const |
| Tells whether duplicate atom/bond mappings are discarded. More... | |
| void | setMaxNumMappings (std::size_t max_num_mappings) |
| Allows to specify a limit on the number of stored atom/bond mappings. More... | |
| std::size_t | getMaxNumMappings () const |
| Returns the specified limit on the number of stored atom/bond mappings. More... | |
| void | setEnabledReactionRoles (unsigned int roles) |
| Allows the reaction role specific exclusion of query and target components from the search for matching reaction substructures. More... | |
| unsigned int | getEnabledReactionRoles () const |
| Tells which reaction component roles are considered in the search for matching reaction substructures. More... | |
Searches for substructures of the components of a target reaction that match a given query reaction pattern.
Use setQuery() to fix the query reaction pattern and mappingExists() or findMappings() to evaluate it against a specified target Chem::Reaction instance. Found mappings are recorded as Chem::AtomBondMapping objects that can be accessed via index through the method getMapping() or iteration using the iterator pair returned by the methods begin() and end(), respectively. Component visibility based on reaction role is controlled with setEnabledReactionRoles() (see namespace Chem::ReactionRole). The search algorithm considers atom-, bond-, and reaction-level Chem::MatchExpression implementation instances attached to the query reaction and its components as corresponding property values (see Chem::SubstructureSearch and Chem::ReactionProperty::MATCH_EXPRESSION). The result set can be limited by the methods setMaxNumMappings() and uniqueMappingsOnly().
| typedef boost::indirect_iterator<ABMappingList::iterator, AtomBondMapping> CDPL::Chem::ReactionSubstructureSearch::MappingIterator |
A mutable random access iterator used to iterate over the stored Chem::AtomBondMapping mapping objects.
| typedef boost::indirect_iterator<ABMappingList::const_iterator, const AtomBondMapping> CDPL::Chem::ReactionSubstructureSearch::ConstMappingIterator |
A constant random access iterator used to iterate over the stored const Chem::AtomBondMapping objects.
| CDPL::Chem::ReactionSubstructureSearch::ReactionSubstructureSearch | ( | ) |
Constructs and initializes the ReactionSubstructureSearch instance.
| CDPL::Chem::ReactionSubstructureSearch::ReactionSubstructureSearch | ( | const Reaction & | query | ) |
Constructs and initializes the ReactionSubstructureSearch instance for the specified query reaction pattern query.
| query | The query reaction. |
|
delete |
| CDPL::Chem::ReactionSubstructureSearch::~ReactionSubstructureSearch | ( | ) |
Destructor.
Destroys the ReactionSubstructureSearch instance and frees all allocated resources.
|
delete |
| void CDPL::Chem::ReactionSubstructureSearch::setQuery | ( | const Reaction & | query | ) |
Sets query as the new query reaction pattern.
| query | A reaction that represents the new query. |
Tells whether the query reaction pattern matches the target reaction target.
The method does not store any atom/bond mappings between the query and target reaction — it just tells if a complete mapping of the query is possible. If you need access to the atom/bond mappings, use findMappings() instead.
| target | The target reaction that has to be searched for a match of the query. |
true if the query matches the target reaction, and false otherwise. Searches for all possible atom/bond mappings between the query reaction pattern and the target reaction target.
The method will store all found atom/bond mapping solutions up to the maximum number of recorded mappings specified by setMaxNumMappings(). If only unique mappings have to be stored (see uniqueMappingsOnly(bool unique)), any duplicates of previously found mappings will be discarded.
| target | The target reaction that has to be searched for matches of the query. |
true if the query can be mapped to the specified target reaction, and false otherwise. | std::size_t CDPL::Chem::ReactionSubstructureSearch::getNumMappings | ( | ) | const |
Returns the number of atom/bond mappings that were recorded in the last call to findMappings().
| AtomBondMapping& CDPL::Chem::ReactionSubstructureSearch::getMapping | ( | std::size_t | idx | ) |
Returns a non-const reference to the stored atom/bond mapping object at index idx.
| idx | The zero-based index of the atom/bond mapping object to return. |
const reference to the Chem::AtomBondMapping object at index idx. | Base::IndexError | if idx is not in the range [0, getNumMappings()). |
| const AtomBondMapping& CDPL::Chem::ReactionSubstructureSearch::getMapping | ( | std::size_t | idx | ) | const |
Returns a const reference to the stored atom/bond mapping object at index idx.
| idx | The zero-based index of the atom/bond mapping object to return. |
const reference to the Chem::AtomBondMapping object at index idx. | Base::IndexError | if idx is not in the range [0, getNumMappings()). |
| MappingIterator CDPL::Chem::ReactionSubstructureSearch::getMappingsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored Chem::AtomBondMapping objects.
| ConstMappingIterator CDPL::Chem::ReactionSubstructureSearch::getMappingsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored const Chem::AtomBondMapping objects.
const Chem::AtomBondMapping objects. | MappingIterator CDPL::Chem::ReactionSubstructureSearch::getMappingsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored Chem::AtomBondMapping objects.
| ConstMappingIterator CDPL::Chem::ReactionSubstructureSearch::getMappingsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored const Chem::AtomBondMapping objects.
const Chem::AtomBondMapping objects. | MappingIterator CDPL::Chem::ReactionSubstructureSearch::begin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored Chem::AtomBondMapping objects.
| ConstMappingIterator CDPL::Chem::ReactionSubstructureSearch::begin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored const Chem::AtomBondMapping objects.
const Chem::AtomBondMapping objects. | MappingIterator CDPL::Chem::ReactionSubstructureSearch::end | ( | ) |
Returns a mutable iterator pointing to the end of the stored Chem::AtomBondMapping objects.
| ConstMappingIterator CDPL::Chem::ReactionSubstructureSearch::end | ( | ) | const |
Returns a constant iterator pointing to the end of the stored const Chem::AtomBondMapping objects.
const Chem::AtomBondMapping objects. | void CDPL::Chem::ReactionSubstructureSearch::uniqueMappingsOnly | ( | bool | unique | ) |
Allows to specify whether or not to store only unique atom/bond mappings.
A mapping of the query to the target reaction is considered to be unique if it differs from all previously found mappings by at least one atom or bond. If the unique argument is true and a newly discovered mapping covers the same atoms and bonds of the target (including all permutations) as a mapping that was found earlier in the search process, it is considered as a duplicate and will be discarded.
| unique | If true, only unique mappings will be stored, and all found mappings otherwise. |
| bool CDPL::Chem::ReactionSubstructureSearch::uniqueMappingsOnly | ( | ) | const |
Tells whether duplicate atom/bond mappings are discarded.
true if duplicate mappings are discarded, and false otherwise. | void CDPL::Chem::ReactionSubstructureSearch::setMaxNumMappings | ( | std::size_t | max_num_mappings | ) |
Allows to specify a limit on the number of stored atom/bond mappings.
In a call to findMappings() the reaction substructure search will terminate as soon as the specified maximum number of stored atom/bond mappings has been reached. A previously set limit on the number of mappings can be disabled by providing zero for the value of max_num_mappings.
| max_num_mappings | The maximum number of atom/bond mappings to store. |
| std::size_t CDPL::Chem::ReactionSubstructureSearch::getMaxNumMappings | ( | ) | const |
Returns the specified limit on the number of stored atom/bond mappings.
| void CDPL::Chem::ReactionSubstructureSearch::setEnabledReactionRoles | ( | unsigned int | roles | ) |
Allows the reaction role specific exclusion of query and target components from the search for matching reaction substructures.
The roles argument is a bitwise-OR combination of the flags defined in namespace Chem::ReactionRole. When the flag for a particular reaction role is missing in the provided bitmask then all reaction components with this role assignment (both in the query and target reaction) will be simply ignored during the reaction substructure search. This has the same effect as 'removing' the affected components from the query and target reaction prior to starting the search and adding them again afterwards.
| roles | A bitmask specifying the non-excluded reaction component roles. |
| unsigned int CDPL::Chem::ReactionSubstructureSearch::getEnabledReactionRoles | ( | ) | const |
Tells which reaction component roles are considered in the search for matching reaction substructures.