![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Enumerates the atom and bond self-mappings (automorphism group) of a molecular graph. More...
Inheritance diagram for CDPL.Chem.AutomorphismGroupSearch:Public Member Functions | |
| None | __init__ (int atom_flags=12702, int bond_flags=30) |
Constructs and initializes the AutomorphismGroupSearch instance for the specified atom and bond properties. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| None | setAtomPropertyFlags (int flags) |
| Specifies the atomic properties considered for atom matching during automorphism search. More... | |
| int | getAtomPropertyFlags () |
| Returns the atomic properties currently considered for atom matching. More... | |
| None | setBondPropertyFlags (int flags) |
| Specifies the bond properties considered for bond matching during automorphism search. More... | |
| int | getBondPropertyFlags () |
| Returns the bond properties currently considered for bond matching. More... | |
| None | includeIdentityMapping (bool include) |
| Specifies whether the identity mapping shall be included in the search results. More... | |
| bool | identityMappingIncluded () |
| Tells whether the identity mapping is included in the search results. More... | |
| bool | findMappings (MolecularGraph molgraph) |
| Searches for the possible atom/bond mappings in the automorphism group of the molecular graph molgraph. More... | |
| None | stopSearch () |
| Aborts a currently running findMappings() call. More... | |
| int | getNumMappings () |
| Returns the number of atom/bond mappings that were recorded in the last call to findMappings(). More... | |
| AtomBondMapping | getMapping (int idx) |
| Returns a reference to the stored atom/bond mapping object at index idx. More... | |
| int | getMaxNumMappings () |
| Returns the specified limit on the number of stored atom/bond mappings. More... | |
| None | setMaxNumMappings (int max_num_mappings) |
| Allows to specify a limit on the number of stored atom/bond mappings. More... | |
| None | clearAtomMappingConstraints () |
| Clears all previously defined atom mapping constraints. More... | |
| None | addAtomMappingConstraint (int atom1_idx, int atom2_idx) |
| Adds a constraint on the allowed atom mappings. More... | |
| None | clearBondMappingConstraints () |
| Clears all previously defined bond mapping constraints. More... | |
| None | addBondMappingConstraint (int bond1_idx, int bond2_idx) |
| Adds a constraint on the allowed bond mappings. More... | |
| None | setFoundMappingCallback (BoolMolecularGraphAtomBondMappingFunctor func) |
| Sets a callback function that is invoked for every atom/bond mapping found during findMappings(). More... | |
| BoolMolecularGraphAtomBondMappingFunctor | getFoundMappingCallback () |
| Returns the currently installed callback function invoked for every found atom/bond mapping. More... | |
| AtomBondMapping | __getitem__ (int idx) |
| int | __len__ () |
Properties | |
| objectID = property(getObjectID) | |
| atomPropertyFlags = property(getAtomPropertyFlags, setAtomPropertyFlags) | |
| bondPropertyFlags = property(getBondPropertyFlags, setBondPropertyFlags) | |
| incIdentityMapping = property(identityMappingIncluded, includeIdentityMapping) | |
| numMappings = property(getNumMappings) | |
| maxNumMappings = property(getMaxNumMappings, setMaxNumMappings) | |
| foundMappingCallback = property(getFoundMappingCallback, setFoundMappingCallback) | |
Enumerates the atom and bond self-mappings (automorphism group) of a molecular graph.
The automorphism group of a molecular graph is the set of self-mappings (atom permutations and the induced bond permutations) that preserve the molecular graph structure under the configured atom and bond mapping constraints. Atom and bond matching is configurable via bit masks composed by a bitwise-OR combination of the constants defined in namespace Chem.AtomPropertyFlag and Chem.BondPropertyFlag that are set using the methods setAtomPropertyFlags() and setBondPropertyFlags(), respectively. Found mappings are recorded as Chem.AtomBondMapping objects that can be accessed via index through the method getMapping() or iteration using the iterator pair returned by the methods begin() and end(). The method setFoundMappingCallback() allows to register a user-defined callback function that gets invoked whenever a new mapping has been found. The maximum number of stored solutions can be bounded by setMaxNumMappings() and stopSearch() allows an immediate abort of the search process. Furthermore, query ↔ target atom and bond mappings can be restricted to user-defined subsets by the methods addAtomMappingConstraint() and addBondMappingConstraint(), respectively.
| None CDPL.Chem.AutomorphismGroupSearch.__init__ | ( | int | atom_flags = 12702, |
| int | bond_flags = 30 |
||
| ) |
Constructs and initializes the AutomorphismGroupSearch instance for the specified atom and bond properties.
| atom_flags | Bitwise-OR combination of Chem.AtomPropertyFlag values specifying atomic properties considered for atom matching. |
| bond_flags | Bitwise-OR combination of Chem.BondPropertyFlag values specifying bond properties considered for bond matching. |
| int CDPL.Chem.AutomorphismGroupSearch.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python AutomorphismGroupSearch 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 AutomorphismGroupSearch 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().
| None CDPL.Chem.AutomorphismGroupSearch.setAtomPropertyFlags | ( | int | flags | ) |
Specifies the atomic properties considered for atom matching during automorphism search.
| flags | The new bitwise-OR combination of corresponding Chem.AtomPropertyFlag values. |
| int CDPL.Chem.AutomorphismGroupSearch.getAtomPropertyFlags | ( | ) |
Returns the atomic properties currently considered for atom matching.
| None CDPL.Chem.AutomorphismGroupSearch.setBondPropertyFlags | ( | int | flags | ) |
Specifies the bond properties considered for bond matching during automorphism search.
| flags | The new bitwise-OR combination of corresponding Chem.BondPropertyFlag values. |
| int CDPL.Chem.AutomorphismGroupSearch.getBondPropertyFlags | ( | ) |
Returns the bond properties currently considered for bond matching.
| None CDPL.Chem.AutomorphismGroupSearch.includeIdentityMapping | ( | bool | include | ) |
Specifies whether the identity mapping shall be included in the search results.
| include | If True, the identity mapping is also reported. |
| bool CDPL.Chem.AutomorphismGroupSearch.identityMappingIncluded | ( | ) |
Tells whether the identity mapping is included in the search results.
True if the identity mapping is included, and False otherwise. | bool CDPL.Chem.AutomorphismGroupSearch.findMappings | ( | MolecularGraph | molgraph | ) |
Searches for the possible atom/bond mappings in the automorphism group of the molecular graph molgraph.
The method will store all found mappings up to the maximum number of recorded mappings specified by setMaxNumMappings().
| molgraph | The molecular graph that has to be searched for automorphisms. |
True if any mappings of the specified molecular graph have been found, and False otherwise.| None CDPL.Chem.AutomorphismGroupSearch.stopSearch | ( | ) |
Aborts a currently running findMappings() call.
Intended to be invoked from within the callback installed via setFoundMappingCallback() to stop the automorphism enumeration early.
| int CDPL.Chem.AutomorphismGroupSearch.getNumMappings | ( | ) |
Returns the number of atom/bond mappings that were recorded in the last call to findMappings().
| AtomBondMapping CDPL.Chem.AutomorphismGroupSearch.getMapping | ( | int | idx | ) |
Returns a reference to the stored atom/bond mapping object at index idx.
| idx | The zero-based index of the atom/bond mapping object to return. |
| Base.IndexError | if idx is not in the range [0, getNumMappings()). |
| int CDPL.Chem.AutomorphismGroupSearch.getMaxNumMappings | ( | ) |
Returns the specified limit on the number of stored atom/bond mappings.
| None CDPL.Chem.AutomorphismGroupSearch.setMaxNumMappings | ( | int | max_num_mappings | ) |
Allows to specify a limit on the number of stored atom/bond mappings.
In a call to findMappings() the automorphism search will terminate as soon as the specified maximum number of stored atom/bond mappings has been reached. A previously set limit on the number of mappings can be disabled by providing zero for the value of max_num_mappings.
| max_num_mappings | The maximum number of atom/bond mappings to store. |
| None CDPL.Chem.AutomorphismGroupSearch.clearAtomMappingConstraints | ( | ) |
Clears all previously defined atom mapping constraints.
| None CDPL.Chem.AutomorphismGroupSearch.addAtomMappingConstraint | ( | int | atom1_idx, |
| int | atom2_idx | ||
| ) |
Adds a constraint on the allowed atom mappings.
By default, an atom can be mapped to any valid other atom. When this method gets called for a particular atom pair (specified by atom1_idx and atom2_idx), a future search will report only those solutions which feature the specified mapping of the two atoms. Multiple calls to addAtomMappingConstraint() for a particular atom enlarges the set of valid mapping solutions.
| atom1_idx | The index of the first atom. |
| atom2_idx | The index of the second atom. |
| None CDPL.Chem.AutomorphismGroupSearch.clearBondMappingConstraints | ( | ) |
Clears all previously defined bond mapping constraints.
| None CDPL.Chem.AutomorphismGroupSearch.addBondMappingConstraint | ( | int | bond1_idx, |
| int | bond2_idx | ||
| ) |
Adds a constraint on the allowed bond mappings.
By default, an bond can be mapped to any valid other bond. When this method gets called for a particular bond pair (specified by bond1_idx and bond2_idx), a future search will report only those solutions which feature the specified mapping of the two bonds. Multiple calls to addBondMappingConstraint() for a particular bond enlarges the set of valid mapping solutions.
| bond1_idx | The index of the first bond. |
| bond2_idx | The index of the second bond. |
| None CDPL.Chem.AutomorphismGroupSearch.setFoundMappingCallback | ( | BoolMolecularGraphAtomBondMappingFunctor | func | ) |
Sets a callback function that is invoked for every atom/bond mapping found during findMappings().
Returning False from the function discards the found mapping (will not be part of the search results).
| func | The new callback function. |
| BoolMolecularGraphAtomBondMappingFunctor CDPL.Chem.AutomorphismGroupSearch.getFoundMappingCallback | ( | ) |
Returns the currently installed callback function invoked for every found atom/bond mapping.