![]() |
Chemical Data Processing Library Python 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...
Inheritance diagram for CDPL.Chem.SubstructureEditor:Public Member Functions | |
| None | __init__ () |
Constructs the SubstructureEditor instance. | |
| None | __init__ (SubstructureEditor editor) |
Constructs a copy of the SubstructureEditor instance editor. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| SubstructureEditor | assign (SubstructureEditor editor) |
Replaces the current state of self with a copy of the state of the SubstructureEditor instance editor. More... | |
| None | addSearchPattern (MolecularGraph molgraph) |
| Appends a new substructure search pattern to the current set of patterns. More... | |
| int | getNumSearchPatterns () |
| Returns the number of stored substructure search patterns. More... | |
| MolecularGraph | getSearchPattern (int idx) |
| Returns the molecular graph of the search pattern at index idx. More... | |
| None | removeSearchPattern (int idx) |
| Removes the search pattern at index idx. More... | |
| None | clearSearchPatterns () |
| Clears the current set of substructuresearch patterns. | |
| None | addExcludePattern (MolecularGraph molgraph) |
| Appends a new substructure exclude pattern to the current set of patterns. More... | |
| int | getNumExcludePatterns () |
| Returns the number of stored substructure-exclude patterns. More... | |
| MolecularGraph | getExcludePattern (int idx) |
| Returns the molecular graph of the exclude pattern at index idx. More... | |
| None | removeExcludePattern (int idx) |
| Removes the exclude pattern at index idx. More... | |
| None | clearExcludePatterns () |
| Clears the current set of substructure exclude patterns. | |
| None | setResultPattern (MolecularGraph molgraph) |
| MolecularGraph | getResultPattern () |
| Returns the currently set result pattern. More... | |
| None | clear () |
| Clears the current editing result pattern and the sets of substructure search and exclude patterns. | |
| int | 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... | |
| int | edit (MolecularGraph molgraph, Molecule res_mol) |
| Copies molgraph into res_mol and then edits res_mol via edit(Molecule&). More... | |
Properties | |
| objectID = property(getObjectID) | |
| numSearchPatterns = property(getNumSearchPatterns) | |
| numExcludePatterns = property(getNumExcludePatterns) | |
| resultPattern = property(getResultPattern, setResultPattern) | |
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.
| None CDPL.Chem.SubstructureEditor.__init__ | ( | SubstructureEditor | editor | ) |
Constructs a copy of the SubstructureEditor instance editor.
| editor | The SubstructureEditor instance to copy. |
| int CDPL.Chem.SubstructureEditor.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python SubstructureEditor instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two SubstructureEditor instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().
| SubstructureEditor CDPL.Chem.SubstructureEditor.assign | ( | SubstructureEditor | editor | ) |
Replaces the current state of self with a copy of the state of the SubstructureEditor instance editor.
| editor | The SubstructureEditor instance to copy. |
| None CDPL.Chem.SubstructureEditor.addSearchPattern | ( | MolecularGraph | molgraph | ) |
Appends a new substructure search pattern to the current set of patterns.
| molgraph | The molecular graph of the substructure search pattern to add. |
| int CDPL.Chem.SubstructureEditor.getNumSearchPatterns | ( | ) |
Returns the number of stored substructure search patterns.
| MolecularGraph CDPL.Chem.SubstructureEditor.getSearchPattern | ( | int | idx | ) |
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]. |
| None CDPL.Chem.SubstructureEditor.removeSearchPattern | ( | int | 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]. |
| None CDPL.Chem.SubstructureEditor.addExcludePattern | ( | MolecularGraph | molgraph | ) |
Appends a new substructure exclude pattern to the current set of patterns.
| molgraph | The molecular graph of the substructure exclude pattern to add. |
| int CDPL.Chem.SubstructureEditor.getNumExcludePatterns | ( | ) |
Returns the number of stored substructure-exclude patterns.
| MolecularGraph CDPL.Chem.SubstructureEditor.getExcludePattern | ( | int | idx | ) |
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]. |
| None CDPL.Chem.SubstructureEditor.removeExcludePattern | ( | int | 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]. |
| None CDPL.Chem.SubstructureEditor.setResultPattern | ( | MolecularGraph | molgraph | ) |
| molgraph |
| MolecularGraph CDPL.Chem.SubstructureEditor.getResultPattern | ( | ) |
Returns the currently set result pattern.
| int 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. |
| int CDPL.Chem.SubstructureEditor.edit | ( | 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. |