Evaluates a boolean expression over multiple substructure queries against a target molecular graph.
More...
#include <MultiSubstructureSearch.hpp>
Evaluates a boolean expression over multiple substructure queries against a target molecular graph.
Substructure query molecular graphs are added via addSubstructure() and referenced in the boolean expression by their 1-based insertion order (e.g. "1 AND (2 OR NOT 3)"). The expression is parsed by setup() and subsequently evaluated for each target molecular graph passed to matches().
- Since
- 1.2
◆ SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MultiSubstructureSearch instances.
◆ MultiSubstructureSearch() [1/2]
| CDPL::Chem::MultiSubstructureSearch::MultiSubstructureSearch |
( |
| ) |
|
Constructs and initializes a MultiSubstructureSearch instance.
◆ MultiSubstructureSearch() [2/2]
◆ ~MultiSubstructureSearch()
| CDPL::Chem::MultiSubstructureSearch::~MultiSubstructureSearch |
( |
| ) |
|
Destructor.
Destroys the MultiSubstructureSearch instance and frees all allocated resources.
◆ operator=()
◆ matches()
Evaluates the configured boolean substructure expression against the target molecular graph molgraph.
- Parameters
-
| molgraph | The target molecular graph. |
- Returns
true if the boolean expression evaluates to true for molgraph, and false otherwise (also false when no expression has been compiled by setup() yet).
◆ addSubstructure()
Appends a substructure query to the internal substructure list.
The query receives the 1-based ID equal to the new value of getNumSubstructures(), which is how it is referenced in the boolean expression.
- Parameters
-
| molgraph | A smart pointer to the substructure query molecular graph. |
◆ getNumSubstructures()
| std::size_t CDPL::Chem::MultiSubstructureSearch::getNumSubstructures |
( |
| ) |
const |
Returns the number of stored substructure queries.
- Returns
- The number of stored substructure queries.
◆ clear()
| void CDPL::Chem::MultiSubstructureSearch::clear |
( |
| ) |
|
Removes all stored substructure queries and clears the compiled expression.
◆ setup()
| void CDPL::Chem::MultiSubstructureSearch::setup |
( |
const std::string & |
qry_expr = "" | ) |
|
Compiles the boolean substructure expression qry_expr.
Substructure IDs in the expression are 1-based and refer to the order in which queries were added via addSubstructure(). Supported operators are AND, OR, XOR and NOT.
- Parameters
-
| qry_expr | The boolean expression to compile (an empty string clears the compiled expression). |
◆ validate()
| std::string CDPL::Chem::MultiSubstructureSearch::validate |
( |
const std::string & |
qry_expr, |
|
|
std::size_t |
max_substr_id |
|
) |
| |
Validates the syntax of qry_expr without compiling it for evaluation.
- Parameters
-
| qry_expr | The expression to validate. |
| max_substr_id | Largest accepted substructure ID; expressions referencing larger IDs are rejected. |
- Returns
- An empty string if qry_expr is well-formed, otherwise an error message describing the failure.
The documentation for this class was generated from the following file: