![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Pattern-driven editor that rewrites matched substructures of a molecule according to a given editing template. 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 substructure search pattern at index idx. More... | |
| None | removeSearchPattern (int idx) |
| Removes the substructure search pattern at index idx. More... | |
| None | clearSearchPatterns () |
| Clears the current set of substructure search 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 substructure exclude pattern at index idx. More... | |
| None | removeExcludePattern (int idx) |
| Removes the substructure 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 the molecule mol in place by applying the result pattern at every search pattern match that is not covered by an exclude pattern. More... | |
| int | edit (MolecularGraph molgraph, Molecule res_mol) |
| Copies the molecular graph molgraph into the molecule res_mol and then edits it by calling 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 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.
| None CDPL.Chem.SubstructureEditor.__init__ | ( | SubstructureEditor | editor | ) |
Constructs a copy of the SubstructureEditor instance editor.
| editor | The other editor 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 | A smart reference to 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 substructure search pattern at index idx.
| idx | The zero-based search pattern index. |
| Base.IndexError | if idx is not in the range [0, getNumSearchPatterns()). |
| None CDPL.Chem.SubstructureEditor.removeSearchPattern | ( | int | 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()). |
| None CDPL.Chem.SubstructureEditor.addExcludePattern | ( | MolecularGraph | molgraph | ) |
Appends a new substructure exclude pattern to the current set of patterns.
| molgraph | A smart reference to 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 substructure exclude pattern at index idx.
| idx | The zero-based exclude pattern index. |
| Base.IndexError | if idx is not in the range [0, getNumExcludePatterns()). |
| None CDPL.Chem.SubstructureEditor.removeExcludePattern | ( | int | 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()). |
| MolecularGraph CDPL.Chem.SubstructureEditor.getResultPattern | ( | ) |
Returns the currently set result pattern.
| int 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. |
| int CDPL.Chem.SubstructureEditor.edit | ( | 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. |