![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Abstract base class for chemical reactions composed of role-tagged reaction components of type Chem.Molecule. More...
Inheritance diagram for CDPL.Chem.Reaction:Classes | |
| class | ComponentSequence |
Public Member Functions | |
| None | __init__ () |
Initializes the Reaction instance. | |
| None | clear () |
| Removes all components and clears all properties of the reaction. | |
| Molecule | addComponent (int role) |
| Creates a new reaction component with the specified role. More... | |
| bool | containsComponent (Molecule mol) |
| Tells whether the specified molecule is a component of this reaction. More... | |
| int | getComponentRole (Molecule mol) |
| Returns the reaction role of the specified component. More... | |
| int | getComponentIndex (Molecule mol) |
| Returns the index of the specified reaction component. More... | |
| int | getNumComponents (int role) |
| Returns the number of reaction components with the specified role. More... | |
| int | getNumComponents () |
| Returns the total number of reaction components. More... | |
| Molecule | getComponent (int idx, int role) |
| Returns a reference to the reaction component at index idx in the list of components with the specified role. More... | |
| Molecule | getComponent (int idx) |
| Returns a reference to the reaction component at index idx. More... | |
| None | removeComponents (int role) |
| Removes all components with the specified role. More... | |
| None | removeComponent (int idx, int role) |
| Removes the reaction component at index idx in the list of components with the specified role. More... | |
| None | removeComponent (int idx) |
| Removes the reaction component at the specified index. More... | |
| None | swapComponentRoles (int role1, int role2) |
| Swaps the reaction roles of the component sets specified by role1 and role2. More... | |
| Reaction | clone () |
| Creates a deep copy of the current reaction state. More... | |
| None | copy (Reaction rxn) |
| Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
| Reaction | assign (Reaction rxn) |
| Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
| ComponentSequence | getReactants () |
| ComponentSequence | getAgents () |
| ComponentSequence | getProducts () |
| None | invokeCopyPostprocessingFunctions (Reaction src_rxn) |
Invokes all registered copy postprocessing functions with self as the target and src_rxn as the source reaction. More... | |
| tuple | __getstate__ () |
| Base.Any | __getitem__ (Base.LookupKey key) |
| Molecule | __getitem__ (int idx) |
| bool | __contains__ (Base.LookupKey key) |
Returns the result of the membership test operation key in self. More... | |
| bool | __contains__ (Molecule mol) |
Returns the result of the membership test operation mol in self. More... | |
| None | __setitem__ (Base.LookupKey key, Base.Any value) |
| bool | __delitem__ (Base.LookupKey key) |
| None | __delitem__ (int idx) |
| int | __len__ () |
Public Member Functions inherited from CDPL.Base.PropertyContainer | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| int | getNumProperties () |
| Returns the number of property entries. More... | |
| Any | getPropertyOrDefault (LookupKey key, Any def_value) |
| list | getPropertyKeys () |
| list | getPropertyValues () |
| list | getProperties () |
| Returns a reference to itself. More... | |
| None | setProperty (LookupKey key, Any value) |
| bool | removeProperty (LookupKey key) |
| Clears the value of the property specified by key. More... | |
| Any | getProperty (LookupKey key, bool throw_=False) |
| Returns the value of the property specified by key. More... | |
| bool | isPropertySet (LookupKey key) |
| Tells whether or not a value has been assigned to the property specified by key. More... | |
| None | clearProperties () |
| Clears all property values. | |
| None | addProperties (PropertyContainer cntnr) |
Adds the property value entries in the PropertyContainer instance cntnr. More... | |
| None | copyProperties (PropertyContainer cntnr) |
| Replaces the current set of properties by a copy of the entries in cntnr. More... | |
| None | swap (PropertyContainer cntnr) |
| Exchanges the properties of this container with the properties of the container cntnr. More... | |
| Any | __getitem__ (LookupKey key) |
| Returns the value of the property specified by key. More... | |
| bool | __contains__ (LookupKey key) |
Returns the result of the membership test operation key in self. More... | |
| None | __setitem__ (LookupKey key, Any value) |
| bool | __delitem__ (LookupKey key) |
Static Public Member Functions | |
| None | registerCopyPostprocessingFunction (VoidMoleculeMolecularGraphFunctor func) |
| Registers a global postprocessing function invoked after every reaction copy operation. More... | |
Properties | |
| reactants = property(getReactants) | |
| agents = property(getAgents) | |
| products = property(getProducts) | |
| numComponents = property(getNumComponents) | |
Properties inherited from CDPL.Base.PropertyContainer | |
| objectID = property(getObjectID) | |
| propertyKeys = property(getPropertyKeys) | |
| propertyValues = property(getPropertyValues) | |
| properties = property(getProperties) | |
| numProperties = property(getNumProperties) | |
Abstract base class for chemical reactions composed of role-tagged reaction components of type Chem.Molecule.
Each component carries a reaction role that is specified by one of the constants declared in namespace Chem.ReactionRole. Reaction roles divide the components into three different subsets: reactants, agents/catalysts and products. For component management/access the methods getComponentRole(), getNumComponents(), getComponent(), getComponentsBegin() and getComponentsEnd() are available. For reaction editing the methods addComponent(), removeComponent(), swapComponentRoles() and clear(). The method clone() allows the creation of polymorphic deep copies and reaction properties can be stored/retrieved via the methods of the Base.PropertyContainer base class.
| Molecule CDPL.Chem.Reaction.addComponent | ( | int | role | ) |
Creates a new reaction component with the specified role.
| role | The reaction role of the new component (see namespace Chem.ReactionRole). |
| Base.ValueError | if the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
Reimplemented in CDPL.Chem.BasicReaction.
| bool CDPL.Chem.Reaction.containsComponent | ( | Molecule | mol | ) |
Tells whether the specified molecule is a component of this reaction.
| mol | The molecule to look for. |
True if the specified molecule is a component of this reaction, and False otherwise. | int CDPL.Chem.Reaction.getComponentRole | ( | Molecule | mol | ) |
Returns the reaction role of the specified component.
If the specified molecule is not a component of this reaction, Chem.ReactionRole.NONE will be returned.
| mol | The component for which to return the reaction role. |
| int CDPL.Chem.Reaction.getComponentIndex | ( | Molecule | mol | ) |
Returns the index of the specified reaction component.
| mol | The component for which to return the index. |
| Base.ItemNotFound | if the specified molecule is not a component of this reaction. |
| int CDPL.Chem.Reaction.getNumComponents | ( | int | role | ) |
Returns the number of reaction components with the specified role.
| role | The reaction role (see namespace Chem.ReactionRole). |
| Base.ValueError | if the value of role is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
| int CDPL.Chem.Reaction.getNumComponents | ( | ) |
Returns the total number of reaction components.
| Molecule CDPL.Chem.Reaction.getComponent | ( | int | idx, |
| int | role | ||
| ) |
Returns a reference to the reaction component at index idx in the list of components with the specified role.
| idx | The zero-based index of the reaction component to return. |
| role | A flag indicating the reaction role of the component (see namespace Chem.ReactionRole). |
| Base.IndexError | if idx is not in the range [0, getNumComponents(role)). Base.ValueError if the value of role is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
| Molecule CDPL.Chem.Reaction.getComponent | ( | int | idx | ) |
Returns a reference to the reaction component at index idx.
| idx | The zero-based index of the reaction component to return. |
| Base.IndexError | if idx is not in the range [0, getNumComponents()). |
| None CDPL.Chem.Reaction.removeComponents | ( | int | role | ) |
Removes all components with the specified role.
| role | The reaction role of the components to remove (see namespace Chem.ReactionRole). |
| Base.ValueError | if the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
| None CDPL.Chem.Reaction.removeComponent | ( | int | idx, |
| int | role | ||
| ) |
Removes the reaction component at index idx in the list of components with the specified role.
| idx | The zero-based index of the component to remove. |
| role | The reaction role of the component (see namespace Chem.ReactionRole). |
| Base.IndexError | if idx is not in the range [0, getNumComponents(role)). Base.ValueError if the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
| None CDPL.Chem.Reaction.removeComponent | ( | int | idx | ) |
Removes the reaction component at the specified index.
| idx | The zero-based index of the component to remove. |
| Base.IndexError | if idx is not in the range [0, getNumComponents()). |
| None CDPL.Chem.Reaction.swapComponentRoles | ( | int | role1, |
| int | role2 | ||
| ) |
Swaps the reaction roles of the component sets specified by role1 and role2.
If role1 is equal to role2, the method has no effect.
| role1 | The reaction role of the first component set (see namespace Chem.ReactionRole). |
| role2 | The reaction role of the second component set (see namespace Chem.ReactionRole). |
| Base.ValueError | if the value of role1 and/or role2 is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT. |
| Reaction CDPL.Chem.Reaction.clone | ( | ) |
Creates a deep copy of the current reaction state.
| None CDPL.Chem.Reaction.copy | ( | Reaction | rxn | ) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
| rxn | The reaction to copy. |
Reimplemented in CDPL.Chem.BasicReaction.
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
Internally calls copy() to perform the actual work.
| rxn | The reaction to copy. |
Reimplemented in CDPL.Chem.BasicReaction.
|
static |
Registers a global postprocessing function invoked after every reaction copy operation.
| func | The function to register. |
| None CDPL.Chem.Reaction.invokeCopyPostprocessingFunctions | ( | Reaction | src_rxn | ) |
Invokes all registered copy postprocessing functions with self as the target and src_rxn as the source reaction.
| src_rxn | The source reaction the copy was made from. |
| bool CDPL.Chem.Reaction.__contains__ | ( | Base.LookupKey | key | ) |
Returns the result of the membership test operation key in self.
| key | The value to test for membership. |
| bool CDPL.Chem.Reaction.__contains__ | ( | Molecule | mol | ) |
Returns the result of the membership test operation mol in self.
| mol | The value to test for membership. |