Chemical Data Processing Library Python API - Version 1.1.1
Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
CDPL.Chem.Reaction Class Reference

Reaction. 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 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 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)
 
tuple __getstate__ ()
 
Molecule __getitem__ (int idx)
 
Base.Any __getitem__ (Base.LookupKey key)
 
None __delitem__ (int idx)
 
bool __delitem__ (Base.LookupKey key)
 
bool __contains__ (Molecule mol)
 Returns the result of the membership test operation mol in self. More...
 
bool __contains__ (Base.LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
None __setitem__ (Base.LookupKey key, Base.Any value)
 
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)
 
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)
 

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)
 

Detailed Description

Reaction.

Member Function Documentation

◆ addComponent()

Molecule CDPL.Chem.Reaction.addComponent ( int  role)

Creates a new reaction component with the specified role.

Parameters
roleA flag specifying the reaction role of the new component (see namespace Chem.ReactionRole).
Returns
A reference to the newly created component molecule.
Exceptions
Base.ValueErrorif the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

Reimplemented in CDPL.Chem.BasicReaction.

◆ containsComponent()

bool CDPL.Chem.Reaction.containsComponent ( Molecule  mol)

Tells whether the specified molecule is a component of this reaction.

Parameters
molThe molecule to look for.
Returns
True if the specified molecule is a component of this reaction, and False otherwise.

◆ getComponentRole()

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.

Parameters
molThe component for which to return the reaction role.
Returns
A flag that specifies the reaction role of the component (see namespace Chem.ReactionRole).

◆ getComponentIndex()

int CDPL.Chem.Reaction.getComponentIndex ( Molecule  mol)

Returns the index of the specified reaction component.

Parameters
molThe component for which to return the index.
Returns
The zero-based index of the specified reaction component.
Exceptions
Base.ItemNotFoundif the specified molecule is not a component of this reaction.

◆ getNumComponents() [1/2]

int CDPL.Chem.Reaction.getNumComponents ( int  role)

Returns the number of reaction components with the specified role.

Parameters
roleA flag that specifies the reaction role (see namespace Chem.ReactionRole).
Returns
The number of reaction components with the specified role.
Exceptions
Base.ValueErrorif the value of role is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

◆ getNumComponents() [2/2]

int CDPL.Chem.Reaction.getNumComponents ( )

Returns the number of reaction components.

Returns
The number of reaction components.

◆ getComponent() [1/2]

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.

Parameters
idxThe zero-based index of the reaction component to return.
roleA flag indicating the reaction role of the component (see namespace Chem.ReactionRole).
Returns
A reference to the reaction component with the specified role and index.
Exceptions
Base.IndexErrorif the number of components with the specified role is zero or idx is not in the range [0, getNumComponents(role) - 1]. Base.ValueError if the value of role is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

◆ getComponent() [2/2]

Molecule CDPL.Chem.Reaction.getComponent ( int  idx)

Returns a reference to the reaction component at index idx.

Parameters
idxThe zero-based index of the reaction component to return.
Returns
A reference to the reaction component at the specified index.
Exceptions
Base.IndexErrorif the number of components is zero or idx is not in the range [0, getNumComponents() - 1].

◆ removeComponents()

None CDPL.Chem.Reaction.removeComponents ( int  role)

Removes all components with the specified role.

Parameters
roleA flag specifying the reaction role of the components to remove (see namespace Chem.ReactionRole).
Exceptions
Base.ValueErrorif the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

◆ removeComponent() [1/2]

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.

Parameters
idxThe zero-based index of the component to remove.
roleThe reaction role of the components
Exceptions
Base.IndexErrorif the number of components with the specified role is zero or idx is not in the range [0, getNumComponents(role) - 1]. Base.ValueError if the value of role is not Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

◆ removeComponent() [2/2]

None CDPL.Chem.Reaction.removeComponent ( int  idx)

Removes the reaction component at the specified index.

Parameters
idxThe zero-based index of the component to remove.
Exceptions
Base.IndexErrorif the number of components is zero or idx is not in the range [0, getNumComponents() - 1].

◆ swapComponentRoles()

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.

Parameters
role1A flag specifying the reaction role of the first component set (see namespace Chem.ReactionRole).
role2A flag specifying the reaction role of the second component set (see namespace Chem.ReactionRole).
Exceptions
Base.ValueErrorif the value of role1 and/or role2 is not equal to Chem.ReactionRole.REACTANT, Chem.ReactionRole.AGENT or Chem.ReactionRole.PRODUCT.

◆ clone()

Reaction CDPL.Chem.Reaction.clone ( )

Creates a copy of the current reaction state.

Returns
A smart reference to the copy of the reaction.

◆ copy()

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.

Parameters
rxnThe reaction to copy.

Reimplemented in CDPL.Chem.BasicReaction.

◆ assign()

Reaction CDPL.Chem.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.

Internally calls copy() to perform the actual work.

Parameters
rxnThe reaction to copy.
Returns
self

Reimplemented in CDPL.Chem.BasicReaction.

◆ getReactants()

ComponentSequence CDPL.Chem.Reaction.getReactants ( )
Returns

◆ getAgents()

ComponentSequence CDPL.Chem.Reaction.getAgents ( )
Returns

◆ getProducts()

ComponentSequence CDPL.Chem.Reaction.getProducts ( )
Returns

◆ registerCopyPostprocessingFunction()

None CDPL.Chem.Reaction.registerCopyPostprocessingFunction ( VoidMoleculeMolecularGraphFunctor  func)
static
Parameters
func

◆ invokeCopyPostprocessingFunctions()

None CDPL.Chem.Reaction.invokeCopyPostprocessingFunctions ( Reaction  src_rxn)
Parameters
src_rxn

◆ __getstate__()

tuple CDPL.Chem.Reaction.__getstate__ ( )
Parameters
arg1
Returns

◆ __getitem__() [1/2]

Molecule CDPL.Chem.Reaction.__getitem__ ( int  idx)
Parameters
idx
Returns

◆ __getitem__() [2/2]

Base.Any CDPL.Chem.Reaction.__getitem__ ( Base.LookupKey  key)
Parameters
key
Returns

◆ __delitem__() [1/2]

None CDPL.Chem.Reaction.__delitem__ ( int  idx)
Parameters
idx

◆ __delitem__() [2/2]

bool CDPL.Chem.Reaction.__delitem__ ( Base.LookupKey  key)
Parameters
key
Returns

◆ __contains__() [1/2]

bool CDPL.Chem.Reaction.__contains__ ( Molecule  mol)

Returns the result of the membership test operation mol in self.

Parameters
molThe value to test for membership.
Returns
The result of the membership test operation.

◆ __contains__() [2/2]

bool CDPL.Chem.Reaction.__contains__ ( Base.LookupKey  key)

Returns the result of the membership test operation key in self.

Parameters
keyThe value to test for membership.
Returns
The result of the membership test operation.

◆ __setitem__()

None CDPL.Chem.Reaction.__setitem__ ( Base.LookupKey  key,
Base.Any  value 
)
Parameters
key
value

◆ __len__()

int CDPL.Chem.Reaction.__len__ ( )
Returns

Reimplemented from CDPL.Base.PropertyContainer.