![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Generic rule-based molecule fragmentation engine that splits a molecular graph along bonds matching user-defined fragmentation rules. More...
Inheritance diagram for CDPL.Chem.FragmentGenerator:Classes | |
| class | ExcludePattern |
| A pattern descriptor specifying bonds that shall not be cleaved. More... | |
| class | FragmentationRule |
| A single fragmentation rule, consisting of a bond substructure match pattern and a numeric rule ID. More... | |
| class | FragmentLink |
| Records the connectivity between two fragments produced by a single bond cleavage. More... | |
Public Member Functions | |
| None | __init__ () |
Constructs the FragmentGenerator instance. | |
| None | __init__ (FragmentGenerator gen) |
Constructs a copy of the FragmentGenerator instance gen. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| FragmentGenerator | assign (FragmentGenerator gen) |
| Replaces the state of this generator by a copy of the state of gen. More... | |
| None | addFragmentationRule (MolecularGraph match_ptn, int rule_id) |
| Registers a new fragmentation rule by its bond substructure match pattern and rule ID. More... | |
| None | addFragmentationRule (FragmentationRule rule) |
| Appends a copy of the pre-built fragmentation rule rule. More... | |
| None | removeFragmentationRule (int idx) |
| Removes the fragmentation rule at index idx. More... | |
| FragmentationRule | getFragmentationRule (int idx) |
| Returns the fragmentation rule at index idx. More... | |
| None | clearFragmentationRules () |
| Removes all registered fragmentation rules. | |
| int | getNumFragmentationRules () |
| Returns the number of registered fragmentation rules. More... | |
| None | addExcludePattern (MolecularGraph match_ptn, int rule_id) |
| Registers a rule-specific exclude pattern. More... | |
| None | addExcludePattern (ExcludePattern excl_ptn) |
| Appends a copy of the pre-built exclude pattern excl_ptn. More... | |
| None | removeExcludePattern (int idx) |
| Removes the exclude pattern at index idx. More... | |
| ExcludePattern | getExcludePattern (int idx) |
| Returns the exclude pattern at index idx. More... | |
| None | clearExcludePatterns () |
| Removes all registered exclude patterns. | |
| int | getNumExcludePatterns () |
| Returns the number of registered exclude patterns. More... | |
| None | setFragmentFilterFunction (BoolConstMolecularGraphFunctor func) |
Sets the predicate used to filter the generated fragments (fragments for which the predicate returns False are discarded). More... | |
| BoolConstMolecularGraphFunctor | getFragmentFilterFunction () |
| Returns the predicate used to filter the generated fragments. More... | |
| None | generate (MolecularGraph molgraph, FragmentList frag_list, bool append=False) |
| Performs the fragmentation of molgraph and appends the resulting fragments to frag_list. More... | |
| FragmentLink | getFragmentLink (int idx) |
| Returns the fragment link at index idx. More... | |
| int | getNumFragmentLinks () |
| Returns the number of fragment links produced by the most recent generate() call. More... | |
| None | includeSplitBonds (bool include) |
| Specifies whether the split (cleaved) bonds shall be retained in the output fragments. More... | |
Properties | |
| objectID = property(getObjectID) | |
| fragmentFilterFunction = property(getFragmentFilterFunction, setFragmentFilterFunction) | |
| incSplitBonds = property(splitBondsIncluded, includeSplitBonds) | |
| numFragmentationRules = property(getNumFragmentationRules) | |
| numExcludePatterns = property(getNumExcludePatterns) | |
| numFragmentLinks = property(getNumFragmentLinks) | |
Generic rule-based molecule fragmentation engine that splits a molecular graph along bonds matching user-defined fragmentation rules.
Fragmentation rules are added via addFragmentationRule() (each rule has a substructure pattern describing a bond plus a numeric rule ID). Bonds matching any registered rule are scheduled for splitting, unless a registered exclude pattern overrides the split. The optional fragment filter rejects generated fragments based on a user-supplied predicate. The connectivity between the resulting fragments is exposed via the FragmentLink list, recording for each cleaved bond the two adjacent fragment indices, the cleaved bond, the matching rule and per-side atom labels.
| None CDPL.Chem.FragmentGenerator.__init__ | ( | FragmentGenerator | gen | ) |
Constructs a copy of the FragmentGenerator instance gen.
| gen | The FragmentGenerator to copy. |
| int CDPL.Chem.FragmentGenerator.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python FragmentGenerator 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 FragmentGenerator 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().
| FragmentGenerator CDPL.Chem.FragmentGenerator.assign | ( | FragmentGenerator | gen | ) |
Replaces the state of this generator by a copy of the state of gen.
| gen | The FragmentGenerator instance to copy. |
| None CDPL.Chem.FragmentGenerator.addFragmentationRule | ( | MolecularGraph | match_ptn, |
| int | rule_id | ||
| ) |
Registers a new fragmentation rule by its bond substructure match pattern and rule ID.
| match_ptn | The bond substructure match pattern (must match a single bond to be cleaved). |
| rule_id | The rule identifier. |
| None CDPL.Chem.FragmentGenerator.addFragmentationRule | ( | FragmentationRule | rule | ) |
Appends a copy of the pre-built fragmentation rule rule.
| rule | The rule to copy and register. |
| None CDPL.Chem.FragmentGenerator.removeFragmentationRule | ( | int | idx | ) |
Removes the fragmentation 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, getNumFragmentationRules() - 1]. |
| FragmentationRule CDPL.Chem.FragmentGenerator.getFragmentationRule | ( | int | idx | ) |
Returns the fragmentation 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, getNumFragmentationRules() - 1]. |
| int CDPL.Chem.FragmentGenerator.getNumFragmentationRules | ( | ) |
Returns the number of registered fragmentation rules.
| None CDPL.Chem.FragmentGenerator.addExcludePattern | ( | MolecularGraph | match_ptn, |
| int | rule_id | ||
| ) |
Registers a rule-specific exclude pattern.
| match_ptn | The substructure match pattern. |
| rule_id | The rule ID this exclusion applies to. |
| None CDPL.Chem.FragmentGenerator.addExcludePattern | ( | ExcludePattern | excl_ptn | ) |
Appends a copy of the pre-built exclude pattern excl_ptn.
| excl_ptn | The exclude pattern to copy and register. |
| None CDPL.Chem.FragmentGenerator.removeExcludePattern | ( | int | idx | ) |
Removes the exclude pattern at index idx.
| idx | The zero-based pattern index. |
| Base.IndexError | if the number of exclude patterns is zero or idx is not in the range [0, getNumExcludePatterns() - 1]. |
| ExcludePattern CDPL.Chem.FragmentGenerator.getExcludePattern | ( | int | idx | ) |
Returns the exclude pattern at index idx.
| idx | The zero-based pattern index. |
| Base.IndexError | if the number of exclude patterns is zero or idx is not in the range [0, getNumExcludePatterns() - 1]. |
| int CDPL.Chem.FragmentGenerator.getNumExcludePatterns | ( | ) |
Returns the number of registered exclude patterns.
| None CDPL.Chem.FragmentGenerator.setFragmentFilterFunction | ( | BoolConstMolecularGraphFunctor | func | ) |
Sets the predicate used to filter the generated fragments (fragments for which the predicate returns False are discarded).
| func | The new fragment filter function. |
| BoolConstMolecularGraphFunctor CDPL.Chem.FragmentGenerator.getFragmentFilterFunction | ( | ) |
Returns the predicate used to filter the generated fragments.
| None CDPL.Chem.FragmentGenerator.generate | ( | MolecularGraph | molgraph, |
| FragmentList | frag_list, | ||
| bool | append = False |
||
| ) |
Performs the fragmentation of molgraph and appends the resulting fragments to frag_list.
| molgraph | The molecular graph to fragment. |
| frag_list | The output fragment list. |
| append | If True, new fragments are appended to frag_list. Otherwise, the list is cleared first. |
| FragmentLink CDPL.Chem.FragmentGenerator.getFragmentLink | ( | int | idx | ) |
Returns the fragment link at index idx.
| idx | The zero-based link index. |
| Base.IndexError | if the number of fragment links is zero or idx is not in the range [0, getNumFragmentLinks() - 1]. |
| int CDPL.Chem.FragmentGenerator.getNumFragmentLinks | ( | ) |
Returns the number of fragment links produced by the most recent generate() call.
| None CDPL.Chem.FragmentGenerator.includeSplitBonds | ( | bool | include | ) |
Specifies whether the split (cleaved) bonds shall be retained in the output fragments.
| include | If True, the cleaved bonds remain part of the adjacent output fragments. |