![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
High-level driver for the fast alignment of Gaussian shapes against a set of reference shapes. More...
#include <FastGaussianShapeAlignment.hpp>
Public Types | |
| typedef std::shared_ptr< FastGaussianShapeAlignment > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated FastGaussianShapeAlignment instances. More... | |
| typedef ResultList::const_iterator | ConstResultIterator |
| A constant iterator over the alignment results. More... | |
| typedef ResultList::iterator | ResultIterator |
| A mutable iterator over the alignment results. More... | |
| typedef std::function< double(const AlignmentResult &)> | ScoringFunction |
| Type of the function used to score an alignment result. More... | |
| typedef std::function< bool(const AlignmentResult &, const AlignmentResult &)> | ResultCompareFunction |
| Type of the function used to compare two alignment results. More... | |
Public Member Functions | |
| FastGaussianShapeAlignment () | |
Constructs the FastGaussianShapeAlignment instance. More... | |
| FastGaussianShapeAlignment (const GaussianShape &ref_shape) | |
Constructs the FastGaussianShapeAlignment instance with ref_shape as the single reference shape. More... | |
| FastGaussianShapeAlignment (const GaussianShapeSet &ref_shapes) | |
Constructs the FastGaussianShapeAlignment instance with the shapes in ref_shapes as the reference set. More... | |
| FastGaussianShapeAlignment (const FastGaussianShapeAlignment &alignment)=delete | |
| ~FastGaussianShapeAlignment () | |
| Destructor. More... | |
| FastGaussianShapeAlignment & | operator= (const FastGaussianShapeAlignment &alignment)=delete |
| void | setResultCompareFunction (const ResultCompareFunction &func) |
| Specifies the function used to compare two alignment results for sorting and filtering. More... | |
| const ResultCompareFunction & | getResultCompareFunction () const |
| Returns the currently configured result-compare function. More... | |
| void | setScoringFunction (const ScoringFunction &func) |
| Specifies the function used to score an alignment result. More... | |
| const ScoringFunction & | getScoringFunction () const |
| Returns the currently configured scoring function. More... | |
| void | setResultSelectionMode (unsigned int mode) |
| Sets the alignment-result selection mode (see namespace Shape::AlignmentResultSelectionMode). More... | |
| unsigned int | getResultSelectionMode () const |
| Returns the currently configured alignment-result selection mode. More... | |
| void | performAlignment (bool perf_align) |
| Specifies whether the actual alignment shall be performed (vs. only evaluating overlaps in the initial pose). More... | |
| bool | performAlignment () const |
| Tells whether the actual alignment is performed. More... | |
| void | optimizeOverlap (bool optimize) |
| Specifies whether the overlap shall be optimized iteratively after the initial alignment. More... | |
| bool | optimizeOverlap () const |
| Tells whether the overlap is optimized iteratively. More... | |
| void | greedyOptimization (bool greedy) |
| Specifies whether the overlap optimization shall use a greedy strategy that stops at the first local maximum. More... | |
| bool | greedyOptimization () const |
| Tells whether the overlap optimization uses a greedy strategy. More... | |
| void | setMaxNumOptimizationIterations (std::size_t max_iter) |
| Sets the maximum number of overlap-optimization iterations. More... | |
| std::size_t | getMaxNumOptimizationIterations () const |
| Returns the currently configured maximum number of overlap-optimization iterations. More... | |
| void | setOptimizationStopGradient (double grad_norm) |
| Sets the gradient norm at which the overlap optimization is stopped. More... | |
| double | getOptimizationStopGradient () const |
| Returns the currently configured overlap-optimization stop gradient. More... | |
| void | clearReferenceShapes () |
| Removes all reference shapes and reference shape sets. More... | |
| void | addReferenceShape (const GaussianShape &shape, bool new_set=true) |
| Adds shape to the reference shapes. More... | |
| void | addReferenceShapes (const GaussianShapeSet &shapes, bool new_set=true) |
| Adds the shapes in shapes to the reference shapes. More... | |
| std::size_t | getNumReferenceShapes () const |
| Returns the total number of reference shapes. More... | |
| void | genShapeCenterStarts (bool generate) |
| Enables or disables the generation of a starting transformation at the shape centroid. More... | |
| bool | genShapeCenterStarts () const |
| Tells whether a starting transformation at the shape centroid is generated. More... | |
| void | genColorCenterStarts (bool generate) |
| Enables or disables the generation of starting transformations at color (pharmacophore) feature centers. More... | |
| bool | genColorCenterStarts () const |
| Tells whether starting transformations at color (pharmacophore) feature centers are generated. More... | |
| void | genNonColorCenterStarts (bool generate) |
| Enables or disables the generation of starting transformations at non-color (shape) element centers. More... | |
| bool | genNonColorCenterStarts () const |
| Tells whether starting transformations at non-color (shape) element centers are generated. More... | |
| void | genRandomStarts (bool generate) |
| Enables or disables the generation of random starting transformations. More... | |
| bool | genRandomStarts () const |
| Tells whether random starting transformations are generated. More... | |
| void | genForAlignedShapeCenters (bool generate) |
| Specifies whether element-/color-center starts shall be generated for centers of the aligned shape. More... | |
| bool | genForAlignedShapeCenters () const |
| Tells whether element-/color-center starts are generated for centers of the aligned shape. More... | |
| void | genForReferenceShapeCenters (bool generate) |
| Specifies whether element-/color-center starts shall be generated for centers of the reference shape. More... | |
| bool | genForReferenceShapeCenters () const |
| Tells whether element-/color-center starts are generated for centers of the reference shape. More... | |
| void | genForLargerShapeCenters (bool generate) |
| Specifies whether element-/color-center starts shall be generated for centers of the shape with more elements (instead of both shapes). More... | |
| bool | genForLargerShapeCenters () const |
| Tells whether element-/color-center starts are generated for centers of the shape with more elements (instead of both shapes). More... | |
| void | setSymmetryThreshold (double thresh) |
| Sets the relative threshold for treating two principal moments as equal. More... | |
| double | getSymmetryThreshold () |
| Returns the currently configured symmetry threshold. More... | |
| void | setMaxRandomTranslation (double max_trans) |
| Sets the maximum random translation magnitude applied to random starts. More... | |
| double | getMaxRandomTranslation () const |
| Returns the currently configured maximum random translation. More... | |
| void | setNumRandomStarts (std::size_t num_starts) |
| Sets the number of random starting transformations. More... | |
| std::size_t | getNumRandomStarts () const |
| Returns the currently configured number of random starts. More... | |
| void | setRandomSeed (unsigned int seed) |
| Sets the seed used by the random number generator that produces the random starts. More... | |
| bool | align (const GaussianShape &shape) |
| Aligns shape against all reference shapes. More... | |
| bool | align (const GaussianShapeSet &shapes) |
| Aligns each shape in shapes against all reference shapes. More... | |
| std::size_t | getNumResults () const |
| Returns the number of stored alignment results. More... | |
| const AlignmentResult & | getResult (std::size_t idx) const |
| Returns the alignment result at index idx. More... | |
| AlignmentResult & | getResult (std::size_t idx) |
| Returns the alignment result at index idx. More... | |
| ConstResultIterator | getResultsBegin () const |
| Returns a constant iterator pointing to the first alignment result. More... | |
| ConstResultIterator | getResultsEnd () const |
| Returns a constant iterator pointing one past the last alignment result. More... | |
| ResultIterator | getResultsBegin () |
| Returns a mutable iterator pointing to the first alignment result. More... | |
| ResultIterator | getResultsEnd () |
| Returns a mutable iterator pointing one past the last alignment result. More... | |
| ConstResultIterator | begin () const |
| Returns a constant iterator pointing to the first alignment result (range-based for support). More... | |
| ConstResultIterator | end () const |
| Returns a constant iterator pointing one past the last alignment result (range-based for support). More... | |
| ResultIterator | begin () |
| Returns a mutable iterator pointing to the first alignment result (range-based for support). More... | |
| ResultIterator | end () |
| Returns a mutable iterator pointing one past the last alignment result (range-based for support). More... | |
Static Public Attributes | |
| static constexpr double | DEF_OPTIMIZATION_STOP_GRADIENT = 1.0 |
| Default gradient norm at which the overlap optimization is stopped. More... | |
| static constexpr std::size_t | DEF_MAX_OPTIMIZATION_ITERATIONS = 20 |
| Default maximum number of overlap-optimization iterations. More... | |
| static constexpr unsigned int | DEF_RESULT_SELECTION_MODE = AlignmentResultSelectionMode::BEST_PER_REFERENCE_SET |
| Default alignment-result selection mode. More... | |
| static constexpr double | DEF_SYMMETRY_THRESHOLD = 0.15 |
| Default relative threshold for treating two principal moments as equal. More... | |
| static constexpr std::size_t | DEF_NUM_RANDOM_STARTS = 4 |
| Default number of random starting transformations. More... | |
| static constexpr double | DEF_MAX_RANDOM_TRANSLATION = 2.0 |
| Default maximum random translation magnitude applied to random starts. More... | |
High-level driver for the fast alignment of Gaussian shapes against a set of reference shapes.
Unlike Shape::GaussianShapeAlignment, which delegates the alignment to a separate Shape::GaussianShapeFunctionAlignment instance, FastGaussianShapeAlignment integrates the entire pipeline (start-transform generation, BFGS overlap optimization, result selection) into one class and operates on a self-contained Gaussian-product representation. The configuration combines settings exposed by Shape::PrincipalAxesAlignmentStartGenerator (start-transform options) and the iterative overlap optimization.
| typedef std::shared_ptr<FastGaussianShapeAlignment> CDPL::Shape::FastGaussianShapeAlignment::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated FastGaussianShapeAlignment instances.
| typedef ResultList::const_iterator CDPL::Shape::FastGaussianShapeAlignment::ConstResultIterator |
A constant iterator over the alignment results.
| typedef ResultList::iterator CDPL::Shape::FastGaussianShapeAlignment::ResultIterator |
A mutable iterator over the alignment results.
| typedef std::function<double(const AlignmentResult&)> CDPL::Shape::FastGaussianShapeAlignment::ScoringFunction |
Type of the function used to score an alignment result.
| typedef std::function<bool(const AlignmentResult&, const AlignmentResult&)> CDPL::Shape::FastGaussianShapeAlignment::ResultCompareFunction |
Type of the function used to compare two alignment results.
| CDPL::Shape::FastGaussianShapeAlignment::FastGaussianShapeAlignment | ( | ) |
Constructs the FastGaussianShapeAlignment instance.
| CDPL::Shape::FastGaussianShapeAlignment::FastGaussianShapeAlignment | ( | const GaussianShape & | ref_shape | ) |
Constructs the FastGaussianShapeAlignment instance with ref_shape as the single reference shape.
| ref_shape | The reference shape. |
| CDPL::Shape::FastGaussianShapeAlignment::FastGaussianShapeAlignment | ( | const GaussianShapeSet & | ref_shapes | ) |
Constructs the FastGaussianShapeAlignment instance with the shapes in ref_shapes as the reference set.
| ref_shapes | The reference shapes. |
|
delete |
| CDPL::Shape::FastGaussianShapeAlignment::~FastGaussianShapeAlignment | ( | ) |
Destructor.
|
delete |
| void CDPL::Shape::FastGaussianShapeAlignment::setResultCompareFunction | ( | const ResultCompareFunction & | func | ) |
Specifies the function used to compare two alignment results for sorting and filtering.
| func | The result-compare function. |
| const ResultCompareFunction& CDPL::Shape::FastGaussianShapeAlignment::getResultCompareFunction | ( | ) | const |
Returns the currently configured result-compare function.
const reference to the result-compare function. | void CDPL::Shape::FastGaussianShapeAlignment::setScoringFunction | ( | const ScoringFunction & | func | ) |
Specifies the function used to score an alignment result.
| func | The scoring function. |
| const ScoringFunction& CDPL::Shape::FastGaussianShapeAlignment::getScoringFunction | ( | ) | const |
Returns the currently configured scoring function.
const reference to the scoring function. | void CDPL::Shape::FastGaussianShapeAlignment::setResultSelectionMode | ( | unsigned int | mode | ) |
Sets the alignment-result selection mode (see namespace Shape::AlignmentResultSelectionMode).
| mode | The new result-selection mode. |
| unsigned int CDPL::Shape::FastGaussianShapeAlignment::getResultSelectionMode | ( | ) | const |
Returns the currently configured alignment-result selection mode.
| void CDPL::Shape::FastGaussianShapeAlignment::performAlignment | ( | bool | perf_align | ) |
Specifies whether the actual alignment shall be performed (vs. only evaluating overlaps in the initial pose).
| perf_align | true to perform the alignment, and false to only evaluate the initial pose. |
| bool CDPL::Shape::FastGaussianShapeAlignment::performAlignment | ( | ) | const |
Tells whether the actual alignment is performed.
true if the alignment is performed, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::optimizeOverlap | ( | bool | optimize | ) |
Specifies whether the overlap shall be optimized iteratively after the initial alignment.
| optimize | true to optimize the overlap, and false to skip optimization. |
| bool CDPL::Shape::FastGaussianShapeAlignment::optimizeOverlap | ( | ) | const |
Tells whether the overlap is optimized iteratively.
true if the overlap is optimized, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::greedyOptimization | ( | bool | greedy | ) |
Specifies whether the overlap optimization shall use a greedy strategy that stops at the first local maximum.
| greedy | true to use the greedy strategy, and false to use the full optimization. |
| bool CDPL::Shape::FastGaussianShapeAlignment::greedyOptimization | ( | ) | const |
Tells whether the overlap optimization uses a greedy strategy.
true if the greedy strategy is used, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::setMaxNumOptimizationIterations | ( | std::size_t | max_iter | ) |
Sets the maximum number of overlap-optimization iterations.
| max_iter | The new maximum number of iterations. |
| std::size_t CDPL::Shape::FastGaussianShapeAlignment::getMaxNumOptimizationIterations | ( | ) | const |
Returns the currently configured maximum number of overlap-optimization iterations.
| void CDPL::Shape::FastGaussianShapeAlignment::setOptimizationStopGradient | ( | double | grad_norm | ) |
Sets the gradient norm at which the overlap optimization is stopped.
| grad_norm | The new stop gradient norm. |
| double CDPL::Shape::FastGaussianShapeAlignment::getOptimizationStopGradient | ( | ) | const |
Returns the currently configured overlap-optimization stop gradient.
| void CDPL::Shape::FastGaussianShapeAlignment::clearReferenceShapes | ( | ) |
Removes all reference shapes and reference shape sets.
| void CDPL::Shape::FastGaussianShapeAlignment::addReferenceShape | ( | const GaussianShape & | shape, |
| bool | new_set = true |
||
| ) |
Adds shape to the reference shapes.
| shape | The reference shape. |
| new_set | If true, shape is added to a new reference set; otherwise it is appended to the most recent reference set. |
| void CDPL::Shape::FastGaussianShapeAlignment::addReferenceShapes | ( | const GaussianShapeSet & | shapes, |
| bool | new_set = true |
||
| ) |
Adds the shapes in shapes to the reference shapes.
| shapes | The reference shapes. |
| new_set | If true, the shapes are added to a new reference set; otherwise they are appended to the most recent reference set. |
| std::size_t CDPL::Shape::FastGaussianShapeAlignment::getNumReferenceShapes | ( | ) | const |
Returns the total number of reference shapes.
| void CDPL::Shape::FastGaussianShapeAlignment::genShapeCenterStarts | ( | bool | generate | ) |
Enables or disables the generation of a starting transformation at the shape centroid.
| generate | true to enable the shape-centroid start, and false to disable it. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genShapeCenterStarts | ( | ) | const |
Tells whether a starting transformation at the shape centroid is generated.
true if a shape-centroid start is generated, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genColorCenterStarts | ( | bool | generate | ) |
Enables or disables the generation of starting transformations at color (pharmacophore) feature centers.
| generate | true to enable the color-center starts, and false to disable them. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genColorCenterStarts | ( | ) | const |
Tells whether starting transformations at color (pharmacophore) feature centers are generated.
true if color-center starts are generated, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genNonColorCenterStarts | ( | bool | generate | ) |
Enables or disables the generation of starting transformations at non-color (shape) element centers.
| generate | true to enable the non-color-center starts, and false to disable them. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genNonColorCenterStarts | ( | ) | const |
Tells whether starting transformations at non-color (shape) element centers are generated.
true if non-color-center starts are generated, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genRandomStarts | ( | bool | generate | ) |
Enables or disables the generation of random starting transformations.
| generate | true to enable the random starts, and false to disable them. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genRandomStarts | ( | ) | const |
Tells whether random starting transformations are generated.
true if random starts are generated, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genForAlignedShapeCenters | ( | bool | generate | ) |
Specifies whether element-/color-center starts shall be generated for centers of the aligned shape.
| generate | true to consider aligned-shape centers, and false to ignore them. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genForAlignedShapeCenters | ( | ) | const |
Tells whether element-/color-center starts are generated for centers of the aligned shape.
true if aligned-shape centers are considered, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genForReferenceShapeCenters | ( | bool | generate | ) |
Specifies whether element-/color-center starts shall be generated for centers of the reference shape.
| generate | true to consider reference-shape centers, and false to ignore them. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genForReferenceShapeCenters | ( | ) | const |
Tells whether element-/color-center starts are generated for centers of the reference shape.
true if reference-shape centers are considered, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::genForLargerShapeCenters | ( | bool | generate | ) |
Specifies whether element-/color-center starts shall be generated for centers of the shape with more elements (instead of both shapes).
| generate | true to use only the centers of the larger shape, and false to use the centers of all configured shapes. |
| bool CDPL::Shape::FastGaussianShapeAlignment::genForLargerShapeCenters | ( | ) | const |
Tells whether element-/color-center starts are generated for centers of the shape with more elements (instead of both shapes).
true if only the centers of the larger shape are used, and false otherwise. | void CDPL::Shape::FastGaussianShapeAlignment::setSymmetryThreshold | ( | double | thresh | ) |
Sets the relative threshold for treating two principal moments as equal.
| thresh | The new symmetry threshold. |
| double CDPL::Shape::FastGaussianShapeAlignment::getSymmetryThreshold | ( | ) |
Returns the currently configured symmetry threshold.
| void CDPL::Shape::FastGaussianShapeAlignment::setMaxRandomTranslation | ( | double | max_trans | ) |
Sets the maximum random translation magnitude applied to random starts.
| max_trans | The new maximum random translation magnitude. |
| double CDPL::Shape::FastGaussianShapeAlignment::getMaxRandomTranslation | ( | ) | const |
Returns the currently configured maximum random translation.
| void CDPL::Shape::FastGaussianShapeAlignment::setNumRandomStarts | ( | std::size_t | num_starts | ) |
Sets the number of random starting transformations.
| num_starts | The new number of random starts. |
| std::size_t CDPL::Shape::FastGaussianShapeAlignment::getNumRandomStarts | ( | ) | const |
Returns the currently configured number of random starts.
| void CDPL::Shape::FastGaussianShapeAlignment::setRandomSeed | ( | unsigned int | seed | ) |
Sets the seed used by the random number generator that produces the random starts.
| seed | The new random seed. |
| bool CDPL::Shape::FastGaussianShapeAlignment::align | ( | const GaussianShape & | shape | ) |
Aligns shape against all reference shapes.
| shape | The shape to align. |
true if at least one alignment result was produced, and false otherwise. | bool CDPL::Shape::FastGaussianShapeAlignment::align | ( | const GaussianShapeSet & | shapes | ) |
Aligns each shape in shapes against all reference shapes.
| shapes | The shapes to align. |
true if at least one alignment result was produced, and false otherwise. | std::size_t CDPL::Shape::FastGaussianShapeAlignment::getNumResults | ( | ) | const |
Returns the number of stored alignment results.
| const AlignmentResult& CDPL::Shape::FastGaussianShapeAlignment::getResult | ( | std::size_t | idx | ) | const |
Returns the alignment result at index idx.
| idx | The zero-based result index. |
const reference to the result. | Base::IndexError | if the number of results is zero or idx is not in the range [0, getNumResults() - 1]. |
| AlignmentResult& CDPL::Shape::FastGaussianShapeAlignment::getResult | ( | std::size_t | idx | ) |
Returns the alignment result at index idx.
| idx | The zero-based result index. |
| Base::IndexError | if the number of results is zero or idx is not in the range [0, getNumResults() - 1]. |
| ConstResultIterator CDPL::Shape::FastGaussianShapeAlignment::getResultsBegin | ( | ) | const |
Returns a constant iterator pointing to the first alignment result.
| ConstResultIterator CDPL::Shape::FastGaussianShapeAlignment::getResultsEnd | ( | ) | const |
Returns a constant iterator pointing one past the last alignment result.
| ResultIterator CDPL::Shape::FastGaussianShapeAlignment::getResultsBegin | ( | ) |
Returns a mutable iterator pointing to the first alignment result.
| ResultIterator CDPL::Shape::FastGaussianShapeAlignment::getResultsEnd | ( | ) |
Returns a mutable iterator pointing one past the last alignment result.
| ConstResultIterator CDPL::Shape::FastGaussianShapeAlignment::begin | ( | ) | const |
Returns a constant iterator pointing to the first alignment result (range-based for support).
| ConstResultIterator CDPL::Shape::FastGaussianShapeAlignment::end | ( | ) | const |
Returns a constant iterator pointing one past the last alignment result (range-based for support).
| ResultIterator CDPL::Shape::FastGaussianShapeAlignment::begin | ( | ) |
Returns a mutable iterator pointing to the first alignment result (range-based for support).
| ResultIterator CDPL::Shape::FastGaussianShapeAlignment::end | ( | ) |
Returns a mutable iterator pointing one past the last alignment result (range-based for support).
|
staticconstexpr |
Default gradient norm at which the overlap optimization is stopped.
|
staticconstexpr |
Default maximum number of overlap-optimization iterations.
|
staticconstexpr |
Default alignment-result selection mode.
|
staticconstexpr |
Default relative threshold for treating two principal moments as equal.
|
staticconstexpr |
Default number of random starting transformations.
|
staticconstexpr |
Default maximum random translation magnitude applied to random starts.