![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Pattern-driven editor that rewrites matched substructures of a Chem::Molecule using a result template, with optional exclude patterns guarding sites that must not be touched. 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 over the molecular graphs of the stored search/exclude patterns. More... | |
| typedef boost::transform_iterator< GetMolGraphFunc, PatternList::iterator > | PatternIterator |
| A mutable iterator over the molecular graphs of the stored search/exclude patterns. 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 search pattern at index idx. More... | |
| void | removeSearchPattern (std::size_t idx) |
| Removes the search pattern at index idx. More... | |
| void | removeSearchPattern (const PatternIterator &it) |
| Removes the search pattern pointed to by it. More... | |
| void | clearSearchPatterns () |
| Clears the current set of substructuresearch patterns. More... | |
| PatternIterator | getSearchPatternsBegin () |
| Returns a mutable iterator pointing to the beginning of the stored search patterns. More... | |
| PatternIterator | getSearchPatternsEnd () |
| Returns a mutable iterator pointing to the end of the stored search patterns. More... | |
| ConstPatternIterator | getSearchPatternsBegin () const |
| Returns a constant iterator pointing to the beginning of the stored search patterns. More... | |
| ConstPatternIterator | getSearchPatternsEnd () const |
| Returns a constant iterator pointing to the end of the stored search patterns. 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 exclude pattern at index idx. More... | |
| void | removeExcludePattern (std::size_t idx) |
| Removes the exclude pattern at index idx. More... | |
| void | removeExcludePattern (const PatternIterator &it) |
| Removes the 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 patterns. More... | |
| PatternIterator | getExcludePatternsEnd () |
| Returns a mutable iterator pointing to the end of the stored exclude patterns. More... | |
| ConstPatternIterator | getExcludePatternsBegin () const |
| Returns a constant iterator pointing to the beginning of the stored exclude patterns. More... | |
| ConstPatternIterator | getExcludePatternsEnd () const |
| Returns a constant iterator pointing to the end of the stored exclude patterns. 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 mol in place by applying the result pattern at every search-pattern match that is not covered by an exclude pattern; repeats until no further changes occur. More... | |
| std::size_t | edit (const MolecularGraph &molgraph, Molecule &res_mol) |
| Copies molgraph into res_mol and then edits res_mol via 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 Chem::Molecule using a result template, with optional exclude patterns guarding sites that must not be touched.
Search patterns supply the substructures the editor will look for; the (single) result pattern defines what each match is rewritten to; 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 over the molecular graphs of the stored search/exclude patterns.
| typedef boost::transform_iterator<GetMolGraphFunc, PatternList::iterator> CDPL::Chem::SubstructureEditor::PatternIterator |
A mutable iterator over the molecular graphs of the stored search/exclude patterns.
| 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 SubstructureEditor instance to copy. |
| CDPL::Chem::SubstructureEditor::~SubstructureEditor | ( | ) |
Destructor.
| void CDPL::Chem::SubstructureEditor::addSearchPattern | ( | const MolecularGraph::SharedPointer & | molgraph | ) |
Appends a new substructure search pattern to the current set of patterns.
| molgraph | 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 search pattern at index idx.
| idx | The zero-based search-pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumSearchPatterns() - 1]. |
| void CDPL::Chem::SubstructureEditor::removeSearchPattern | ( | std::size_t | idx | ) |
Removes the search pattern at index idx.
| idx | The zero-based search-pattern index to remove. |
| Base::IndexError | if idx is not in the range [0, getNumSearchPatterns() - 1]. |
| void CDPL::Chem::SubstructureEditor::removeSearchPattern | ( | const PatternIterator & | it | ) |
Removes the search pattern pointed to by it.
| it | An iterator pointing to the search pattern to remove. |
| Base::RangeError | if it does not point into the current search-pattern range. |
| void CDPL::Chem::SubstructureEditor::clearSearchPatterns | ( | ) |
Clears the current set of substructuresearch patterns.
| PatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored search patterns.
| PatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored search patterns.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored search patterns.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getSearchPatternsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored search patterns.
| void CDPL::Chem::SubstructureEditor::addExcludePattern | ( | const MolecularGraph::SharedPointer & | molgraph | ) |
Appends a new substructure exclude pattern to the current set of patterns.
| molgraph | 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 exclude pattern at index idx.
| idx | The zero-based exclude-pattern index. |
| Base::IndexError | if idx is not in the range [0, getNumExcludePatterns() - 1]. |
| void CDPL::Chem::SubstructureEditor::removeExcludePattern | ( | std::size_t | idx | ) |
Removes the exclude pattern at index idx.
| idx | The zero-based exclude-pattern index to remove. |
| Base::IndexError | if idx is not in the range [0, getNumExcludePatterns() - 1]. |
| void CDPL::Chem::SubstructureEditor::removeExcludePattern | ( | const PatternIterator & | it | ) |
Removes the exclude pattern pointed to by it.
| it | An iterator pointing to the exclude pattern to remove. |
| Base::RangeError | if it does not point into the current exclude-pattern range. |
| 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 patterns.
| PatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored exclude patterns.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored exclude patterns.
| ConstPatternIterator CDPL::Chem::SubstructureEditor::getExcludePatternsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored exclude patterns.
| 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 | 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 mol in place by applying the result pattern at every search-pattern match that is not covered by an exclude pattern; repeats until no further changes occur.
| mol | The molecule to edit. |
| std::size_t CDPL::Chem::SubstructureEditor::edit | ( | const MolecularGraph & | molgraph, |
| Molecule & | res_mol | ||
| ) |
Copies molgraph into res_mol and then edits res_mol via 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 SubstructureEditor instance to copy. |