![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Pattern-driven editor that rewrites matched substructures of a molecule according to a given editing template. More...
#include <SubstructureEditor.hpp>
Public Types | |
| typedef std::shared_ptr< SubstructureEditor > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated SubstructureEditor instances. More... | |
| typedef boost::transform_iterator< GetMolGraphFunc, PatternList::const_iterator > | ConstPatternIterator |
| A constant iterator used to iterate over the stored search/exclude pattern Chem::MolecularGraph objects. More... | |
| typedef boost::transform_iterator< GetMolGraphFunc, PatternList::iterator > | PatternIterator |
| A mutable iterator used to iterate over the stored search/exclude pattern Chem::MolecularGraph objects. More... | |
Public Member Functions | |
| SubstructureEditor () | |
Constructs the SubstructureEditor instance. More... | |
| SubstructureEditor (const SubstructureEditor &editor) | |
Constructs a copy of the SubstructureEditor instance editor. More... | |
| ~SubstructureEditor () | |
| Destructor. More... | |
| void | addSearchPattern (const MolecularGraph::SharedPointer &molgraph) |
| Appends a new substructure search pattern to the current set of patterns. More... | |
| std::size_t | getNumSearchPatterns () const |
| Returns the number of stored substructure search patterns. More... | |
| const MolecularGraph::SharedPointer & | getSearchPattern (std::size_t idx) const |
| Returns the molecular graph of the substructure search pattern at index idx. More... | |
| void | removeSearchPattern (std::size_t idx) |
| Removes the substructure search pattern at index idx. More... | |
| void | removeSearchPattern (const PatternIterator &it) |
| Removes the substructure search pattern pointed to by it. More... | |
| void | clearSearchPatterns () |
| Clears the current set of substructure search patterns. More... | |
| PatternIterator | getSearchPatternsBegin () |
| Returns a mutable iterator pointing to the beginning of the stored search pattern Chem::MolecularGraph objects. More... | |
| PatternIterator | getSearchPatternsEnd () |
| Returns a mutable iterator pointing to the end of the stored search pattern Chem::MolecularGraph objects. More... | |
| ConstPatternIterator | getSearchPatternsBegin () const |
Returns a constant iterator pointing to the beginning of the stored search pattern const Chem::MolecularGraph objects. More... | |
| ConstPatternIterator | getSearchPatternsEnd () const |
Returns a constant iterator pointing to the end of the stored search pattern const Chem::MolecularGraph objects. More... | |
| void | addExcludePattern (const MolecularGraph::SharedPointer &molgraph) |
| Appends a new substructure exclude pattern to the current set of patterns. More... | |
| std::size_t | getNumExcludePatterns () const |
| Returns the number of stored substructure exclude patterns. More... | |
| const MolecularGraph::SharedPointer & | getExcludePattern (std::size_t idx) const |
| Returns the molecular graph of the substructure exclude pattern at index idx. More... | |
| void | removeExcludePattern (std::size_t idx) |
| Removes the substructure exclude pattern at index idx. More... | |
| void | removeExcludePattern (const PatternIterator &it) |
| Removes the substructure exclude pattern pointed to by it. More... | |
| void | clearExcludePatterns () |
| Clears the current set of substructure exclude patterns. More... | |
| PatternIterator | getExcludePatternsBegin () |
| Returns a mutable iterator pointing to the beginning of the stored exclude pattern Chem::MolecularGraph objects. More... | |
| PatternIterator | getExcludePatternsEnd () |
| Returns a mutable iterator pointing to the end of the stored exclude pattern Chem::MolecularGraph objects. More... | |
| ConstPatternIterator | getExcludePatternsBegin () const |
Returns a constant iterator pointing to the beginning of the stored exclude pattern const Chem::MolecularGraph objects. More... | |
| ConstPatternIterator | getExcludePatternsEnd () const |
Returns a constant iterator pointing to the end of the stored exclude pattern const Chem::MolecularGraph objects. More... | |
| void | setResultPattern (const MolecularGraph::SharedPointer &pattern) |
| Sets the result pattern that defines how each matched search pattern instance will be rewritten. More... | |
| const MolecularGraph::SharedPointer & | getResultPattern () const |
| Returns the currently set result pattern. More... | |
| void | clear () |
| Clears the current editing result pattern and the sets of substructure search and exclude patterns. More... | |
| std::size_t | edit (Molecule &mol) |
| Edits the molecule mol in place by applying the result pattern at every search pattern match that is not covered by an exclude pattern. More... | |
| std::size_t | edit (const MolecularGraph &molgraph, Molecule &res_mol) |
| Copies the molecular graph molgraph into the molecule res_mol and then edits it by calling edit(Molecule&). More... | |
| SubstructureEditor & | operator= (const SubstructureEditor &gen) |
Copies the state of the SubstructureEditor instance gen. More... | |
Pattern-driven editor that rewrites matched substructures of a molecule according to a given editing template.
Search patterns supply the substructures the editor will look for. The (single) result pattern defines what each match is rewritten to and exclude patterns mark matches that must be skipped (a search match is discarded when its atoms/bonds form a subset of any exclude match). The editor iterates until no further matches can be transformed and returns the number of applied edits.
| typedef std::shared_ptr<SubstructureEditor> CDPL::Chem::SubstructureEditor::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated SubstructureEditor instances.
| typedef boost::transform_iterator<GetMolGraphFunc, PatternList::const_iterator> CDPL::Chem::SubstructureEditor::ConstPatternIterator |
A constant iterator used to iterate over the stored search/exclude pattern Chem::MolecularGraph objects.
| typedef boost::transform_iterator<GetMolGraphFunc, PatternList::iterator> CDPL::Chem::SubstructureEditor::PatternIterator |
A mutable iterator used to iterate over the stored search/exclude pattern Chem::MolecularGraph objects.
| CDPL::Chem::SubstructureEditor::SubstructureEditor | ( | ) |
Constructs the SubstructureEditor instance.
| CDPL::Chem::SubstructureEditor::SubstructureEditor | ( | const SubstructureEditor & | editor | ) |
Constructs a copy of the SubstructureEditor instance editor.
| editor | The other editor instance to copy. |
| CDPL::Chem::SubstructureEditor::~SubstructureEditor | ( | ) |
Destructor.
Destroys the SubstructureEditor instance and frees all allocated resources.
| void CDPL::Chem::SubstructureEditor::addSearchPattern | ( | const MolecularGraph::SharedPointer & | molgraph | ) |
Appends a new substructure search pattern to the current set of patterns.
| molgraph | A smart pointer to the molecular graph of the substructure search pattern to add. |
| std::size_t CDPL::Chem::SubstructureEditor::getNumSearchPatterns | ( | ) | const |
Returns the number of stored substructure search patterns.
| const MolecularGraph::SharedPointer& CDPL::Chem::SubstructureEditor::getSearchPattern | ( | std::size_t | idx | ) | const |
Returns the molecular graph of the substructure search pattern at index idx.
| idx | The zero-based search pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumSearchPatterns()). |
| void CDPL::Chem::SubstructureEditor::removeSearchPattern | ( | std::size_t | idx | ) |
Removes the substructure search pattern at index idx.
| idx | The zero-based search pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumSearchPatterns()). |
| void CDPL::Chem::SubstructureEditor::removeSearchPattern | ( | const PatternIterator & | it | ) |
Removes the substructure search pattern pointed to by it.
| it | An iterator pointing to the search pattern. |
| Base::RangeError | if it is not in the range [getSearchPatternsBegin(), getSearchPatternsEnd()). |
| void CDPL::Chem::SubstructureEditor::clearSearchPatterns | ( | ) |
Clears the current set of substructure search patterns.
| PatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored search pattern Chem::MolecularGraph objects.
| PatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored search pattern Chem::MolecularGraph objects.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored search pattern const Chem::MolecularGraph objects.
const Chem::MolecularGraph objects. | ConstPatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored search pattern const Chem::MolecularGraph objects.
const Chem::MolecularGraph objects. | void CDPL::Chem::SubstructureEditor::addExcludePattern | ( | const MolecularGraph::SharedPointer & | molgraph | ) |
Appends a new substructure exclude pattern to the current set of patterns.
| molgraph | A smart pointer to the molecular graph of the substructure exclude pattern to add. |
| std::size_t CDPL::Chem::SubstructureEditor::getNumExcludePatterns | ( | ) | const |
Returns the number of stored substructure exclude patterns.
| const MolecularGraph::SharedPointer& CDPL::Chem::SubstructureEditor::getExcludePattern | ( | std::size_t | idx | ) | const |
Returns the molecular graph of the substructure exclude pattern at index idx.
| idx | The zero-based exclude pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumExcludePatterns()). |
| void CDPL::Chem::SubstructureEditor::removeExcludePattern | ( | std::size_t | idx | ) |
Removes the substructure exclude pattern at index idx.
| idx | The zero-based exclude pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumExcludePatterns()). |
| void CDPL::Chem::SubstructureEditor::removeExcludePattern | ( | const PatternIterator & | it | ) |
Removes the substructure exclude pattern pointed to by it.
| it | An iterator pointing to the exclude pattern. |
| Base::RangeError | if it is not in the range [getExcludePatternsBegin(), getExcludePatternsEnd()). |
| void CDPL::Chem::SubstructureEditor::clearExcludePatterns | ( | ) |
Clears the current set of substructure exclude patterns.
| PatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored exclude pattern Chem::MolecularGraph objects.
| PatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored exclude pattern Chem::MolecularGraph objects.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored exclude pattern const Chem::MolecularGraph objects.
const Chem::MolecularGraph objects. | ConstPatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored exclude pattern const Chem::MolecularGraph objects.
const Chem::MolecularGraph objects. | void CDPL::Chem::SubstructureEditor::setResultPattern | ( | const MolecularGraph::SharedPointer & | pattern | ) |
Sets the result pattern that defines how each matched search pattern instance will be rewritten.
| pattern | A smart pointer to the molecular graph of the result pattern. |
| const MolecularGraph::SharedPointer& CDPL::Chem::SubstructureEditor::getResultPattern | ( | ) | const |
Returns the currently set result pattern.
| void CDPL::Chem::SubstructureEditor::clear | ( | ) |
Clears the current editing result pattern and the sets of substructure search and exclude patterns.
| std::size_t CDPL::Chem::SubstructureEditor::edit | ( | Molecule & | mol | ) |
Edits the molecule mol in place by applying the result pattern at every search pattern match that is not covered by an exclude pattern.
| mol | The molecule to edit. |
| std::size_t CDPL::Chem::SubstructureEditor::edit | ( | const MolecularGraph & | molgraph, |
| Molecule & | res_mol | ||
| ) |
Copies the molecular graph molgraph into the molecule res_mol and then edits it by calling edit(Molecule&).
| molgraph | The source molecular graph. |
| res_mol | The molecule receiving the edited result. |
| SubstructureEditor& CDPL::Chem::SubstructureEditor::operator= | ( | const SubstructureEditor & | gen | ) |
Copies the state of the SubstructureEditor instance gen.
| gen | The other editor instance to copy. |