Computes the maximum common bond substructure between a query and a target molecular graph by reducing the problem to maximum-clique enumeration on a bond-based association graph.
More...
#include <MaxCommonBondSubstructureSearch.hpp>
Computes the maximum common bond substructure between a query and a target molecular graph by reducing the problem to maximum-clique enumeration on a bond-based association graph.
Unlike Chem::MaxCommonAtomSubstructureSearch — which maximises shared atoms — this class enumerates substructures with the maximum number of shared bonds (and, in findMaxAtomMappings(), the maximum number of shared atoms within those). The usual interface applies: setQuery() to set the query graph, mappingExists() for a yes/no answer with the setMinSubstructureSize() lower bound on bond count, and the result set is bounded by setMaxNumMappings() and uniqueMappingsOnly().
- See also
- [MCESA]
◆ SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MaxCommonBondSubstructureSearch instances.
◆ MappingIterator
A mutable random access iterator used to iterate over the stored atom/bond mapping objects.
◆ ConstMappingIterator
A constant random access iterator used to iterate over the stored atom/bond mapping objects.
◆ MaxCommonBondSubstructureSearch() [1/3]
| CDPL::Chem::MaxCommonBondSubstructureSearch::MaxCommonBondSubstructureSearch |
( |
| ) |
|
Constructs and initializes a MaxCommonBondSubstructureSearch instance.
◆ MaxCommonBondSubstructureSearch() [2/3]
| CDPL::Chem::MaxCommonBondSubstructureSearch::MaxCommonBondSubstructureSearch |
( |
const MolecularGraph & |
query | ) |
|
Constructs and initializes a MaxCommonBondSubstructureSearch instance for the specified query structure.
- Parameters
-
| query | A molecular graph that represents the query structure. |
◆ MaxCommonBondSubstructureSearch() [3/3]
◆ ~MaxCommonBondSubstructureSearch()
| CDPL::Chem::MaxCommonBondSubstructureSearch::~MaxCommonBondSubstructureSearch |
( |
| ) |
|
Destructor.
Destroys the MaxCommonBondSubstructureSearch instance and frees all allocated resources.
◆ operator=()
◆ setQuery()
| void CDPL::Chem::MaxCommonBondSubstructureSearch::setQuery |
( |
const MolecularGraph & |
query | ) |
|
Allows to specify a new query structure.
- Parameters
-
| query | A molecular graph that represents the query structure. |
◆ mappingExists()
| bool CDPL::Chem::MaxCommonBondSubstructureSearch::mappingExists |
( |
const MolecularGraph & |
target | ) |
|
Searches for a common 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() bonds could be found. If you need access to the atom/bond mappings, use findMappings() instead.
- Parameters
-
| target | The molecular graph that has to be searched for a substructure in common with the query. |
- Returns
true if a common substructure of at least the minimum accepted size could be found, and false otherwise.
- Note
- Any atom/bond mappings that were recorded in a previous call to findMappings() will be discarded.
◆ findMappings()
| bool CDPL::Chem::MaxCommonBondSubstructureSearch::findMappings |
( |
const MolecularGraph & |
target | ) |
|
Searches for all atom/bond mappings of query subgraphs to substructures of the specified target molecular graph with a maximum bond count.
The method will store all maximum-sized (in number of bonds) 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.
- Parameters
-
| target | The molecular graph that has to be searched for all maximum-sized substructures in common with the query. |
- Returns
true if common substructures of at least the minimum accepted size were found, and false otherwise.
- Note
- Any atom/bond mappings that were recorded in a previous call to findMappings() will be discarded.
◆ getNumMappings()
| std::size_t CDPL::Chem::MaxCommonBondSubstructureSearch::getNumMappings |
( |
| ) |
const |
Returns the number of atom/bond mappings that were recorded in the last search for common substructures.
- Returns
- The number of atom/bond mappings that were recorded in the last search for common substructures.
- See also
- findMappings()
◆ getMapping() [1/2]
| AtomBondMapping& CDPL::Chem::MaxCommonBondSubstructureSearch::getMapping |
( |
std::size_t |
idx | ) |
|
Returns a non-const reference to the stored atom/bond mapping object at index idx.
- Parameters
-
| idx | The zero-based index of the atom/bond mapping object to return. |
- Returns
- A non-
const reference to the atom/bond mapping object at index idx.
- Exceptions
-
◆ getMapping() [2/2]
| const AtomBondMapping& CDPL::Chem::MaxCommonBondSubstructureSearch::getMapping |
( |
std::size_t |
idx | ) |
const |
Returns a const reference to the stored atom/bond mapping object at index idx.
- Parameters
-
| idx | The zero-based index of the atom/bond mapping object to return. |
- Returns
- A
const reference to the atom/bond mapping object at index idx.
- Exceptions
-
◆ getMappingsBegin() [1/2]
| MappingIterator CDPL::Chem::MaxCommonBondSubstructureSearch::getMappingsBegin |
( |
| ) |
|
Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
- Returns
- A mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
◆ getMappingsBegin() [2/2]
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.
- Returns
- A constant iterator pointing to the beginning of the stored atom/bond mapping objects.
◆ getMappingsEnd() [1/2]
| MappingIterator CDPL::Chem::MaxCommonBondSubstructureSearch::getMappingsEnd |
( |
| ) |
|
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.
- Returns
- A mutable iterator pointing to the end of the stored atom/bond mapping objects.
◆ getMappingsEnd() [2/2]
Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.
- Returns
- A constant iterator pointing to the end of the stored atom/bond mapping objects.
◆ begin() [1/2]
Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
- Returns
- A mutable iterator pointing to the beginning of the stored atom/bond mapping objects.
◆ begin() [2/2]
Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.
- Returns
- A constant iterator pointing to the beginning of the stored atom/bond mapping objects.
◆ end() [1/2]
Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.
- Returns
- A mutable iterator pointing to the end of the stored atom/bond mapping objects.
◆ end() [2/2]
Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.
- Returns
- A constant iterator pointing to the end of the stored atom/bond mapping objects.
◆ uniqueMappingsOnly() [1/2]
| void CDPL::Chem::MaxCommonBondSubstructureSearch::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.
- Parameters
-
| unique | If true, only unique mappings will be stored, and all found mappings otherwise. |
- Note
- By default, duplicate mappings are not discarded.
◆ uniqueMappingsOnly() [2/2]
| bool CDPL::Chem::MaxCommonBondSubstructureSearch::uniqueMappingsOnly |
( |
| ) |
const |
Tells whether duplicate atom/bond mappings are discarded.
- Returns
true if duplicate mappings are discarded, and false otherwise.
- See also
- uniqueMappingsOnly(bool unique)
◆ setMaxNumMappings()
| void CDPL::Chem::MaxCommonBondSubstructureSearch::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 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.
- Parameters
-
| max_num_mappings | The maximum number of atom/bond mappings to store. |
- Note
- By default, no limit is imposed on the number of stored mappings.
◆ getMaxNumMappings()
| std::size_t CDPL::Chem::MaxCommonBondSubstructureSearch::getMaxNumMappings |
( |
| ) |
const |
Returns the specified limit on the number of stored atom/bond mappings.
- Returns
- The specified maximum number of stored atom/bond mappings.
- See also
- setMaxNumMappings(), findMappings()
◆ setMinSubstructureSize()
| void CDPL::Chem::MaxCommonBondSubstructureSearch::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 bonds are not accepted as a valid solution and will be discarded.
- Parameters
-
| min_size | The minimum accepted common substructure size in number of bonds. |
- Note
- By default, the minimum common substructure size is set to zero.
◆ getMinSubstructureSize()
| std::size_t CDPL::Chem::MaxCommonBondSubstructureSearch::getMinSubstructureSize |
( |
| ) |
const |
Returns the minimum accepted common substructure size.
- Returns
- The minimum accepted common substructure size in number of bonds.
- See also
- setMinSubstructureSize()
The documentation for this class was generated from the following file: