![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Enumerates the tautomers of a molecular graph by iteratively applying a configurable set of Chem::TautomerizationRule instances and reporting each accepted tautomer to a user-supplied callback. More...
#include <TautomerGenerator.hpp>
Inheritance diagram for CDPL::Chem::TautomerGenerator:Public Types | |
| enum | Mode { TOPOLOGICALLY_UNIQUE , GEOMETRICALLY_UNIQUE , EXHAUSTIVE } |
| Constants specifying the output tautomer filtering strategy. More... | |
| typedef std::shared_ptr< TautomerGenerator > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated TautomerGenerator instances. More... | |
| typedef std::function< bool(MolecularGraph &)> | CallbackFunction |
Type of the callback invoked for every generated tautomer (returning false aborts the enumeration). More... | |
| typedef std::function< void(MolecularGraph &)> | CustomSetupFunction |
| Type of the optional setup function invoked on the input molecular graph before enumeration starts. More... | |
Public Member Functions | |
| TautomerGenerator () | |
Constructs the TautomerGenerator instance. More... | |
| TautomerGenerator (const TautomerGenerator &gen) | |
Constructs a copy of the TautomerGenerator instance gen. More... | |
| virtual | ~TautomerGenerator () |
| Virtual destructor. More... | |
| TautomerGenerator & | operator= (const TautomerGenerator &gen) |
| Replaces the state of this generator by a copy of the state of gen. More... | |
| void | addTautomerizationRule (const TautomerizationRule::SharedPointer &rule) |
| Registers a new tautomerization rule. More... | |
| const TautomerizationRule::SharedPointer & | getTautomerizationRule (std::size_t idx) const |
| Returns the registered tautomerization rule at index idx. More... | |
| void | removeTautomerizationRule (std::size_t idx) |
| Removes the registered tautomerization rule at index idx. More... | |
| std::size_t | getNumTautomerizationRules () const |
| Returns the number of registered tautomerization rules. More... | |
| void | setCallbackFunction (const CallbackFunction &func) |
| Sets the callback invoked for every accepted output tautomer. More... | |
| const CallbackFunction & | getCallbackFunction () const |
| Returns the currently configured callback. More... | |
| void | setMode (Mode mode) |
| Sets the tautomer duplicate filtering mode. More... | |
| Mode | getMode () const |
| Returns the currently configured tautomer duplicate filtering mode. More... | |
| void | regardStereochemistry (bool regard) |
| Specifies whether atom/bond stereochemistry shall be regarded by the tautomer duplicate detection algorithm. More... | |
| bool | stereochemistryRegarded () const |
| Tells whether atom/bond stereochemistry is regarded by the tautomer duplicate detection algorithm. More... | |
| void | regardIsotopes (bool regard) |
| Specifies whether atom isotope information shall be regarded by the tautomer duplicate detection algorithm. More... | |
| bool | isotopesRegarded () const |
| Tells whether atom isotope information is regarded by the tautomer duplicate detection algorithm. More... | |
| void | clearCoordinates2D (bool clear) |
| Specifies whether 2D atom coordinates shall be cleared from the generated tautomers. More... | |
| bool | coordinates2DCleared () const |
| Tells whether 2D atom coordinates are cleared from the generated tautomers. More... | |
| void | clearCoordinates3D (bool clear) |
| Specifies whether 3D atom coordinates shall be cleared from the generated tautomers. More... | |
| bool | coordinates3DCleared () const |
| Tells whether 3D atom coordinates are cleared from the generated tautomers. More... | |
| void | removeResonanceDuplicates (bool remove) |
| Specifies whether tautomers that differ only by resonance (no atom-connectivity change) shall be filtered out. More... | |
| bool | resonanceDuplicatesRemoved () const |
| Tells whether resonance-only duplicates are filtered out. More... | |
| void | setCustomSetupFunction (const CustomSetupFunction &func) |
| Sets the optional setup function invoked on the generated tautomers. More... | |
| void | generate (const MolecularGraph &molgraph) |
| Enumerates the tautomers of molgraph and reports each accepted one to the registered callback. More... | |
Enumerates the tautomers of a molecular graph by iteratively applying a configurable set of Chem::TautomerizationRule instances and reporting each accepted tautomer to a user-supplied callback.
After registering tautomerization rules (via addTautomerizationRule()) and a callback (via setCallbackFunction()), each call to generate() seeds the enumeration with the input molecular graph, applies every registered rule to every intermediate tautomer to derive the next generation, and reports each newly-generated tautomer to the callback. The Mode setting controls how various types of duplicates shall be handled.
| typedef std::shared_ptr<TautomerGenerator> CDPL::Chem::TautomerGenerator::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated TautomerGenerator instances.
| typedef std::function<bool(MolecularGraph&)> CDPL::Chem::TautomerGenerator::CallbackFunction |
Type of the callback invoked for every generated tautomer (returning false aborts the enumeration).
| typedef std::function<void(MolecularGraph&)> CDPL::Chem::TautomerGenerator::CustomSetupFunction |
Type of the optional setup function invoked on the input molecular graph before enumeration starts.
Constants specifying the output tautomer filtering strategy.
| CDPL::Chem::TautomerGenerator::TautomerGenerator | ( | ) |
Constructs the TautomerGenerator instance.
| CDPL::Chem::TautomerGenerator::TautomerGenerator | ( | const TautomerGenerator & | gen | ) |
Constructs a copy of the TautomerGenerator instance gen.
| gen | The TautomerGenerator to copy. |
|
inlinevirtual |
Virtual destructor.
| TautomerGenerator& CDPL::Chem::TautomerGenerator::operator= | ( | const TautomerGenerator & | gen | ) |
Replaces the state of this generator by a copy of the state of gen.
| gen | The source TautomerGenerator. |
| void CDPL::Chem::TautomerGenerator::addTautomerizationRule | ( | const TautomerizationRule::SharedPointer & | rule | ) |
Registers a new tautomerization rule.
| rule | The tautomerization rule to register. |
| const TautomerizationRule::SharedPointer& CDPL::Chem::TautomerGenerator::getTautomerizationRule | ( | std::size_t | idx | ) | const |
Returns the registered tautomerization rule at index idx.
| idx | The zero-based rule index. |
const reference to the rule smart pointer. | Base::IndexError | if the number of rules is zero or idx is not in the range [0, getNumTautomerizationRules() - 1]. |
| void CDPL::Chem::TautomerGenerator::removeTautomerizationRule | ( | std::size_t | idx | ) |
Removes the registered tautomerization rule at index idx.
| idx | The zero-based rule index. |
| Base::IndexError | if the number of rules is zero or idx is not in the range [0, getNumTautomerizationRules() - 1]. |
| std::size_t CDPL::Chem::TautomerGenerator::getNumTautomerizationRules | ( | ) | const |
Returns the number of registered tautomerization rules.
| void CDPL::Chem::TautomerGenerator::setCallbackFunction | ( | const CallbackFunction & | func | ) |
Sets the callback invoked for every accepted output tautomer.
The callback receives the tautomer molecular graph as its argument and returns a boolean: returning false aborts the enumeration.
| func | The new callback function. |
| const CallbackFunction& CDPL::Chem::TautomerGenerator::getCallbackFunction | ( | ) | const |
Returns the currently configured callback.
const reference to the callback function. | void CDPL::Chem::TautomerGenerator::setMode | ( | Mode | mode | ) |
Sets the tautomer duplicate filtering mode.
| mode | The new duplicate filtering mode. |
| Mode CDPL::Chem::TautomerGenerator::getMode | ( | ) | const |
Returns the currently configured tautomer duplicate filtering mode.
| void CDPL::Chem::TautomerGenerator::regardStereochemistry | ( | bool | regard | ) |
Specifies whether atom/bond stereochemistry shall be regarded by the tautomer duplicate detection algorithm.
| regard | If true, atom/bond stereo configurations are taken into account. |
| bool CDPL::Chem::TautomerGenerator::stereochemistryRegarded | ( | ) | const |
Tells whether atom/bond stereochemistry is regarded by the tautomer duplicate detection algorithm.
true if stereochemistry is regarded, and false otherwise. | void CDPL::Chem::TautomerGenerator::regardIsotopes | ( | bool | regard | ) |
Specifies whether atom isotope information shall be regarded by the tautomer duplicate detection algorithm.
| regard | If true, atom isotope information is taken into account. |
| bool CDPL::Chem::TautomerGenerator::isotopesRegarded | ( | ) | const |
Tells whether atom isotope information is regarded by the tautomer duplicate detection algorithm.
true if atom isotope information is regarded, and false otherwise. | void CDPL::Chem::TautomerGenerator::clearCoordinates2D | ( | bool | clear | ) |
Specifies whether 2D atom coordinates shall be cleared from the generated tautomers.
| clear | If true, the output tautomers have no 2D coordinates. |
| bool CDPL::Chem::TautomerGenerator::coordinates2DCleared | ( | ) | const |
Tells whether 2D atom coordinates are cleared from the generated tautomers.
true if 2D coordinates are cleared, and false otherwise. | void CDPL::Chem::TautomerGenerator::clearCoordinates3D | ( | bool | clear | ) |
Specifies whether 3D atom coordinates shall be cleared from the generated tautomers.
| clear | If true, the output tautomers have no 3D coordinates. |
| bool CDPL::Chem::TautomerGenerator::coordinates3DCleared | ( | ) | const |
Tells whether 3D atom coordinates are cleared from the generated tautomers.
true if 3D coordinates are cleared, and false otherwise. | void CDPL::Chem::TautomerGenerator::removeResonanceDuplicates | ( | bool | remove | ) |
Specifies whether tautomers that differ only by resonance (no atom-connectivity change) shall be filtered out.
| remove | If true, resonance-only duplicates are not reported. |
| bool CDPL::Chem::TautomerGenerator::resonanceDuplicatesRemoved | ( | ) | const |
Tells whether resonance-only duplicates are filtered out.
true if resonance duplicates are removed, and false otherwise. | void CDPL::Chem::TautomerGenerator::setCustomSetupFunction | ( | const CustomSetupFunction & | func | ) |
Sets the optional setup function invoked on the generated tautomers.
| func | The new custom setup function. |
| void CDPL::Chem::TautomerGenerator::generate | ( | const MolecularGraph & | molgraph | ) |
Enumerates the tautomers of molgraph and reports each accepted one to the registered callback.
| molgraph | The molecular graph whose tautomers shall be generated. |