Chemical Data Processing Library C++ API - Version 1.1.1
|
CommonConnectedSubstructureSearch. More...
#include <CommonConnectedSubstructureSearch.hpp>
Public Types | |
typedef std::shared_ptr< CommonConnectedSubstructureSearch > | SharedPointer |
typedef boost::indirect_iterator< ABMappingList::iterator, AtomBondMapping > | MappingIterator |
A mutable random access iterator used to iterate over the stored atom/bond mapping objects. More... | |
typedef boost::indirect_iterator< ABMappingList::const_iterator, const AtomBondMapping > | ConstMappingIterator |
A constant random access iterator used to iterate over the stored atom/bond mapping objects. More... | |
Public Member Functions | |
CommonConnectedSubstructureSearch () | |
Constructs and initializes a CommonConnectedSubstructureSearch instance. More... | |
CommonConnectedSubstructureSearch (const MolecularGraph &query) | |
Constructs and initializes a CommonConnectedSubstructureSearch instance for the specified query structure. More... | |
~CommonConnectedSubstructureSearch () | |
Destructor. More... | |
void | setQuery (const MolecularGraph &query) |
Allows to specify a new query structure. More... | |
bool | mappingExists (const MolecularGraph &target) |
Searches for a common connected substructure between the query and the specified target molecular graph. More... | |
bool | findAllMappings (const MolecularGraph &target) |
Searches for all possible atom/bond mappings of connected query subgraphs to substructures of the specified target molecular graph. More... | |
bool | findMaxMappings (const MolecularGraph &target) |
Searches for all maximum-sized atom/bond mappings of connected query subgraphs to substructures of the specified target molecular graph. More... | |
std::size_t | getNumMappings () const |
Returns the number of atom/bond mappings that were recorded in the last search for common substructures. 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 atom/bond mapping objects. More... | |
ConstMappingIterator | getMappingsBegin () const |
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects. More... | |
MappingIterator | getMappingsEnd () |
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects. More... | |
ConstMappingIterator | getMappingsEnd () const |
Returns a constant iterator pointing to the end of the stored atom/bond mapping objects. More... | |
MappingIterator | begin () |
Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects. More... | |
ConstMappingIterator | begin () const |
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects. More... | |
MappingIterator | end () |
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects. More... | |
ConstMappingIterator | end () const |
Returns a constant iterator pointing to the end of the stored atom/bond mapping 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 | setMinSubstructureSize (std::size_t min_size) |
Allows to specify the minimum accepted common substructure size. More... | |
std::size_t | getMinSubstructureSize () const |
Returns the minimum accepted common substructure size. More... | |
CommonConnectedSubstructureSearch.
typedef std::shared_ptr<CommonConnectedSubstructureSearch> CDPL::Chem::CommonConnectedSubstructureSearch::SharedPointer |
typedef boost::indirect_iterator<ABMappingList::iterator, AtomBondMapping> CDPL::Chem::CommonConnectedSubstructureSearch::MappingIterator |
A mutable random access iterator used to iterate over the stored atom/bond mapping objects.
typedef boost::indirect_iterator<ABMappingList::const_iterator, const AtomBondMapping> CDPL::Chem::CommonConnectedSubstructureSearch::ConstMappingIterator |
A constant random access iterator used to iterate over the stored atom/bond mapping objects.
CDPL::Chem::CommonConnectedSubstructureSearch::CommonConnectedSubstructureSearch | ( | ) |
Constructs and initializes a CommonConnectedSubstructureSearch
instance.
CDPL::Chem::CommonConnectedSubstructureSearch::CommonConnectedSubstructureSearch | ( | const MolecularGraph & | query | ) |
Constructs and initializes a CommonConnectedSubstructureSearch
instance for the specified query structure.
query | A molecular graph that represents the query structure. |
CDPL::Chem::CommonConnectedSubstructureSearch::~CommonConnectedSubstructureSearch | ( | ) |
Destructor.
Destroys the CommonConnectedSubstructureSearch
instance and frees all allocated resources.
void CDPL::Chem::CommonConnectedSubstructureSearch::setQuery | ( | const MolecularGraph & | query | ) |
Allows to specify a new query structure.
query | A molecular graph that represents the query structure. |
bool CDPL::Chem::CommonConnectedSubstructureSearch::mappingExists | ( | const MolecularGraph & | target | ) |
Searches for a common connected substructure between the query and the specified target molecular graph.
The method does not store any atom/bond mappings between query and target substructures - it just tells if a valid common substructure mapping solution involving at least getMinSubstructureSize() atoms could be found. If you need access to the atom/bond mappings, use findAllMappings() or findMaxMappings() instead.
target | The molecular graph that has to be searched for a connected substructure in common with the query. |
true
if a common substructure of at least the minimum accepted size could be found, and false
otherwise. bool CDPL::Chem::CommonConnectedSubstructureSearch::findAllMappings | ( | const MolecularGraph & | target | ) |
Searches for all possible atom/bond mappings of connected query subgraphs to substructures of the specified target molecular graph.
The method will store all found common substructure mapping solutions involving at least getMinSubstructureSize() atoms 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 molecular graph that has to be searched for all connected substructures in common with the query. |
true
if common substructures of at least the minimum accepted size were found, and false
otherwise. bool CDPL::Chem::CommonConnectedSubstructureSearch::findMaxMappings | ( | const MolecularGraph & | target | ) |
Searches for all maximum-sized atom/bond mappings of connected query subgraphs to substructures of the specified target molecular graph.
The method will store all maximum-sized common substructure mapping solutions involving at least getMinSubstructureSize() atoms 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 molecular graph that has to be searched for all maximum-sized connected substructures in common with the query. |
true
if common substructures of at least the minimum accepted size were found, and false
otherwise. std::size_t CDPL::Chem::CommonConnectedSubstructureSearch::getNumMappings | ( | ) | const |
Returns the number of atom/bond mappings that were recorded in the last search for common substructures.
AtomBondMapping& CDPL::Chem::CommonConnectedSubstructureSearch::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 atom/bond mapping object at index idx. Base::IndexError | if no mappings are available or idx is not in the range [0, getNumMappings() - 1]. |
const AtomBondMapping& CDPL::Chem::CommonConnectedSubstructureSearch::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 atom/bond mapping object at index idx. Base::IndexError | if no mappings are available or idx is not in the range [0, getNumMappings() - 1]. |
MappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::getMappingsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
ConstMappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::getMappingsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.
MappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::getMappingsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.
ConstMappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::getMappingsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.
MappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::begin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
ConstMappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::begin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.
MappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::end | ( | ) |
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.
ConstMappingIterator CDPL::Chem::CommonConnectedSubstructureSearch::end | ( | ) | const |
Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.
void CDPL::Chem::CommonConnectedSubstructureSearch::uniqueMappingsOnly | ( | bool | unique | ) |
Allows to specify whether or not to store only unique atom/bond mappings.
The mapping of a query pattern subgraph to a substructure of the target molecular graph 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::CommonConnectedSubstructureSearch::uniqueMappingsOnly | ( | ) | const |
Tells whether duplicate atom/bond mappings are discarded.
true
if duplicate mappings are discarded, and false
otherwise. void CDPL::Chem::CommonConnectedSubstructureSearch::setMaxNumMappings | ( | std::size_t | max_num_mappings | ) |
Allows to specify a limit on the number of stored atom/bond mappings.
In a call to findAllMappings or findMaxMappings() the common 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::CommonConnectedSubstructureSearch::getMaxNumMappings | ( | ) | const |
Returns the specified limit on the number of stored atom/bond mappings.
void CDPL::Chem::CommonConnectedSubstructureSearch::setMinSubstructureSize | ( | std::size_t | min_size | ) |
Allows to specify the minimum accepted common substructure size.
Any found common substructures which cover less than min_size atoms are not accepted as a valid solution and will be discarded.
min_size | The minimum accepted common substructure size in number of atoms. |
std::size_t CDPL::Chem::CommonConnectedSubstructureSearch::getMinSubstructureSize | ( | ) | const |
Returns the minimum accepted common substructure size.