EnzymeReaction#

pydantic model pyenzyme.enzymeml.core.enzymereaction.EnzymeReaction[source]#

Bases: EnzymeMLBase

Describes an enzyme reaction by combining already defined reactants/proteins of an EnzymeML document. In addition, this class provides ways to integrate reaction conditions as well. It is also possible to add a kinetic law to this object by using the KineticModel class.

Show JSON schema
{
   "title": "EnzymeReaction",
   "description": "Describes an enzyme reaction by combining already defined\nreactants/proteins of an EnzymeML document. In addition,\nthis class provides ways to integrate reaction conditions\nas well. It is also possible to add a kinetic law to this\nobject by using the KineticModel class.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "Name of the reaction.",
         "template_alias": "Name",
         "type": "string"
      },
      "reversible": {
         "title": "Reversible",
         "description": "Whether the reaction is reversible or irreversible",
         "template_alias": "Reversible",
         "type": "boolean"
      },
      "temperature": {
         "title": "Temperature",
         "description": "Numeric value of the temperature of the reaction.",
         "template_alias": "Temperature value",
         "type": "number"
      },
      "temperature_unit": {
         "title": "Temperature Unit",
         "description": "Unit of the temperature of the reaction.",
         "pattern": "kelvin|Kelvin|k|K|celsius|Celsius|C|c",
         "template_alias": "Temperature unit",
         "type": "string"
      },
      "ph": {
         "title": "Ph",
         "description": "PH value of the reaction.",
         "template_alias": "pH value",
         "inclusiveMinimum": 0,
         "inclusiveMaximum": 14,
         "type": "number"
      },
      "ontology": {
         "description": "Ontology defining the role of the given species.",
         "default": "SBO:0000176",
         "allOf": [
            {
               "$ref": "#/definitions/SBOTerm"
            }
         ]
      },
      "meta_id": {
         "title": "Meta Id",
         "description": "Unique meta identifier for the reaction.",
         "type": "string"
      },
      "id": {
         "title": "Id",
         "description": "Unique identifier of the reaction.",
         "pattern": "r[\\d]+",
         "template_alias": "ID",
         "type": "string"
      },
      "uri": {
         "title": "Uri",
         "description": "URI of the reaction.",
         "type": "string"
      },
      "creator_id": {
         "title": "Creator Id",
         "description": "Unique identifier of the author.",
         "type": "string"
      },
      "model": {
         "title": "Model",
         "description": "Kinetic model decribing the reaction.",
         "allOf": [
            {
               "$ref": "#/definitions/KineticModel"
            }
         ]
      },
      "educts": {
         "title": "Educts",
         "description": "List of educts containing ReactionElement objects.",
         "template_alias": "Educts",
         "type": "array",
         "items": {
            "$ref": "#/definitions/ReactionElement"
         }
      },
      "products": {
         "title": "Products",
         "description": "List of products containing ReactionElement objects.",
         "template_alias": "Products",
         "type": "array",
         "items": {
            "$ref": "#/definitions/ReactionElement"
         }
      },
      "modifiers": {
         "title": "Modifiers",
         "description": "List of modifiers (Proteins, snhibitors, stimulators) containing ReactionElement objects.",
         "template_alias": "Modifiers",
         "type": "array",
         "items": {
            "$ref": "#/definitions/ReactionElement"
         }
      }
   },
   "required": [
      "name",
      "reversible"
   ],
   "definitions": {
      "SBOTerm": {
         "title": "SBOTerm",
         "description": "String enumeration used to assign ontologies derived from SBOTerms.",
         "enum": [
            "SBO:0000176",
            "SBO:0000208",
            "SBO:0000181",
            "SBO:0000182",
            "SBO:0000179",
            "SBO:0000180",
            "SBO:0000209",
            "SBO:0000377",
            "SBO:0000177",
            "SBO:0000200",
            "SBO:0000672",
            "SBO:0000252",
            "SBO:0000251",
            "SBO:0000247",
            "SBO:0000327",
            "SBO:0000328",
            "SBO:0000336",
            "SBO:0000015",
            "SBO:0000011",
            "SBO:0000013",
            "SBO:0000020",
            "SBO:0000461",
            "SBO:0000462",
            "SBO:0000021",
            "SBO:0000296",
            "SBO:0000297",
            "SBO:0000607",
            "SBO:0000028",
            "SBO:0000025",
            "SBO:0000027",
            "SBO:0000186"
         ],
         "type": "string"
      },
      "KineticParameter": {
         "title": "KineticParameter",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "Name of the estimated parameter.",
               "type": "string"
            },
            "value": {
               "title": "Value",
               "description": "Numerical value of the estimated parameter.",
               "type": "number"
            },
            "unit": {
               "title": "Unit",
               "description": "Unit of the estimated parameter.",
               "type": "string"
            },
            "initial_value": {
               "title": "Initial Value",
               "description": "Initial value that was used for the parameter estimation.",
               "type": "number"
            },
            "upper": {
               "title": "Upper",
               "description": "Upper bound of the estimated parameter.",
               "type": "number"
            },
            "lower": {
               "title": "Lower",
               "description": "Lower bound of the estimated parameter.",
               "type": "number"
            },
            "is_global": {
               "title": "Is Global",
               "description": "Specifies if this parameter is a global parameter.",
               "default": false,
               "type": "boolean"
            },
            "stdev": {
               "title": "Stdev",
               "description": "Standard deviation of the estimated parameter.",
               "type": "number"
            },
            "constant": {
               "title": "Constant",
               "description": "Specifies if this parameter is constant",
               "default": false,
               "type": "boolean"
            },
            "ontology": {
               "description": "Type of the estimated parameter.",
               "allOf": [
                  {
                     "$ref": "#/definitions/SBOTerm"
                  }
               ]
            }
         },
         "required": [
            "name"
         ]
      },
      "KineticModel": {
         "title": "KineticModel",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "Name of the kinetic law.",
               "type": "string"
            },
            "equation": {
               "title": "Equation",
               "description": "Equation for the kinetic law.",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "description": "List of estimated parameters.",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/KineticParameter"
               }
            },
            "ontology": {
               "description": "Type of the estimated parameter.",
               "allOf": [
                  {
                     "$ref": "#/definitions/SBOTerm"
                  }
               ]
            }
         },
         "required": [
            "name",
            "equation"
         ]
      },
      "ReactionElement": {
         "title": "ReactionElement",
         "description": "Describes an element of a chemical reaction.",
         "type": "object",
         "properties": {
            "species_id": {
               "title": "Species Id",
               "description": "Internal identifier to either a protein or reactant defined in the EnzymeMLDocument.",
               "type": "string"
            },
            "stoichiometry": {
               "title": "Stoichiometry",
               "description": "Positive float number representing the associated stoichiometry.",
               "exclusiveMinimum": 0,
               "type": "number"
            },
            "constant": {
               "title": "Constant",
               "description": "Whether or not the concentration of this species remains constant.",
               "type": "boolean"
            },
            "ontology": {
               "description": "Ontology defining the role of the given species.",
               "allOf": [
                  {
                     "$ref": "#/definitions/SBOTerm"
                  }
               ]
            }
         },
         "required": [
            "species_id",
            "stoichiometry",
            "constant",
            "ontology"
         ]
      }
   }
}

Config
  • validate_all: bool = True

  • validate_assignment: bool = True

Fields
Validators
field creator_id: Optional[str] = None#

Unique identifier of the author.

field educts: List[ReactionElement] [Optional]#

List of educts containing ReactionElement objects.

field id: Optional[str] = None#

Unique identifier of the reaction.

Constraints
  • pattern = r[d]+

Validated by
field meta_id: Optional[str] = None#

Unique meta identifier for the reaction.

field model: Optional[KineticModel] = None#

Kinetic model decribing the reaction.

field modifiers: List[ReactionElement] [Optional]#

List of modifiers (Proteins, snhibitors, stimulators) containing ReactionElement objects.

field name: str [Required]#

Name of the reaction.

field ontology: SBOTerm = SBOTerm.BIOCHEMICAL_REACTION#

Ontology defining the role of the given species.

field ph: Optional[float] = None#

PH value of the reaction.

field products: List[ReactionElement] [Optional]#

List of products containing ReactionElement objects.

field reversible: bool [Required]#

Whether the reaction is reversible or irreversible

field temperature: Optional[float] = None#

Numeric value of the temperature of the reaction.

field temperature_unit: Optional[str] = None#

Unit of the temperature of the reaction.

Constraints
  • pattern = kelvin|Kelvin|k|K|celsius|Celsius|C|c

Validated by
field uri: Optional[str] = None#

URI of the reaction.

addEduct(species_id: str, stoichiometry: PositiveFloat, enzmldoc, constant: bool = False, ontology: SBOTerm = SBOTerm.SUBSTRATE) None[source]#

Adds element to EnzymeReaction object. Replicates as well as initial concentrations are optional.

Parameters
  • species_id – str (string): Reactant/Protein ID - Needs to be pre-defined!

  • stoichiometry (float) – Stoichiometric coefficient

  • constant – (bool): Whether constant or not

  • enzmldoc (EnzymeMLDocument) – Checks and adds IDs

Raises

SpeciesNotFoundError – If Reactant/Protein hasnt been defined yet

addModifier(species_id: str, stoichiometry: PositiveFloat, enzmldoc, constant: bool, ontology: SBOTerm = SBOTerm.CATALYST) None[source]#

Adds element to EnzymeReaction object. Replicates as well as initial concentrations are optional.

Parameters
  • species_id – str (string): Reactant/Protein ID - Needs to be pre-defined!

  • stoichiometry (float) – Stoichiometric coefficient

  • constant – (bool): Whether constant or not

  • enzmldoc (EnzymeMLDocument) – Checks and adds IDs

Raises

SpeciesNotFoundError – If Reactant/Protein hasnt been defined yet

addProduct(species_id: str, stoichiometry: PositiveFloat, enzmldoc, constant: bool = False, ontology: SBOTerm = SBOTerm.PRODUCT) None[source]#

Adds element to EnzymeReaction object. Replicates as well as initial concentrations are optional.

Parameters
  • species_id – str (string): Reactant/Protein ID - Needs to be pre-defined!

  • stoichiometry (float) – Stoichiometric coefficient

  • constant – (bool): Whether constant or not

  • enzmldoc (EnzymeMLDocument) – Checks and adds IDs

Raises

SpeciesNotFoundError – If Reactant/Protein hasnt been defined yet

apply_initial_values(config: Dict[str, dict], to_values: bool = False) None[source]#

Applies the initial values for all given parameters to the underlying model.

Parameters

kwargs (Dict[str, float]) – Mapping from the parameter name to the given initial value.

validator convert_temperature_unit  »  temperature_unit[source]#

Converts celsius to kelvin due to SBML limitations

classmethod fromEquation(equation: str, name: str, enzmldoc, modifiers: Union[List[str], str] = [], temperature: Optional[float] = None, temperature_unit: Optional[str] = None, ph: Optional[float] = None)[source]#

Creates an EnzymeReaction object from a reaction equation.

Please make sure that the equation follows either of the following patterns:

‘1.0 Substrate -> 1.0 Product’ (for irreversible)

or

‘1.0 Substrate <=> 1.0 Product’ (for reversible)

Parameters
  • equation (str) – Reaction equation with educt and product sides.

  • name (str) – Name of the reaction.

  • reversible (bool) – If the reaction is reversible or not. Defaults

  • enzmldoc ([type]) – Used to validate species IDs.

getEduct(id: str) ReactionElement[source]#

Returns a ReactionElement including information about the following properties:

  • Reactant/Protein Identifier

  • Stoichiometry of the element

  • Whether or not the element’s concentration is constant

Parameters

id (string) – Reactant/Protein ID

Raises

SpeciesNotFoundError – If species ID is unfindable

Returns

Object including species ID, stoichiometry, constant)

Return type

ReactionElement

getEducts()[source]#

Deprecated since version Use: the attribute educts instead.

getId() Optional[str][source]#

Deprecated since version Use: the attribute id instead.

getMetaid() Optional[str][source]#

Deprecated since version Use: the attribute meta_id instead.

getModel() Optional[KineticModel][source]#

Deprecated since version Use: the attribute model instead.

getModifier(id: str) ReactionElement[source]#

Returns a ReactionElement including information about the following properties:

  • Reactant/Protein Identifier

  • Stoichiometry of the element

  • Whether or not the element’s concentration is constant

Parameters

id (string) – Reactant/Protein ID

Raises

SpeciesNotFoundError – If species ID is unfindable

Returns

Object including species ID, stoichiometry, constant)

Return type

ReactionElement

getModifiers()[source]#

Deprecated since version Use: the attribute modifier instead.

getName() str[source]#

Deprecated since version Use: the attribute name instead instead.

getPh() PositiveFloat[source]#
getProduct(id: str) ReactionElement[source]#

Returns a ReactionElement including information about the following properties:

  • Reactant/Protein Identifier

  • Stoichiometry of the element

  • Whether or not the element’s concentration is constant

Parameters

id (string) – Reactant/Protein ID

Raises

SpeciesNotFoundError – If species ID is unfindable

Returns

Object including species ID, stoichiometry, constant)

Return type

ReactionElement

getProducts()[source]#

Deprecated since version Use: the attribute products instead.

getReversible() bool[source]#

Deprecated since version Use: the attribute reveserible instead.

getStoichiometricCoefficients() Dict[str, float][source]#

Returns the approprate stoichiometric coefficients of all educts and products.

This function is intended to be used for modeling, where data should be easily accessible.

Returns

Mapping from identifier to stiochiometric coefficient.

Return type

Dict[str, float]

getTemperature() float[source]#
getTempunit() str[source]#
get_reaction_scheme(by_name: bool = False, enzmldoc=None)[source]#
setModel(model: KineticModel, enzmldoc, mapping: Dict[str, str] = {}, log: bool = True) None[source]#

Sets the kinetic model of the reaction and in addition converts all units to UnitDefs.

Parameters
  • model (KineticModel) – Kinetic model that has been derived.

  • enzmldoc (EnzymeMLDocument) – The EnzymeMLDocument that holds the reaction.

validator set_meta_id  »  id[source]#

Sets the meta ID when an ID is provided

unitdef()[source]#

Returns the appropriate unitdef if an enzmldoc is given

pydantic model pyenzyme.enzymeml.core.enzymereaction.ReactionElement[source]#

Bases: BaseModel

Describes an element of a chemical reaction.

Show JSON schema
{
   "title": "ReactionElement",
   "description": "Describes an element of a chemical reaction.",
   "type": "object",
   "properties": {
      "species_id": {
         "title": "Species Id",
         "description": "Internal identifier to either a protein or reactant defined in the EnzymeMLDocument.",
         "type": "string"
      },
      "stoichiometry": {
         "title": "Stoichiometry",
         "description": "Positive float number representing the associated stoichiometry.",
         "exclusiveMinimum": 0,
         "type": "number"
      },
      "constant": {
         "title": "Constant",
         "description": "Whether or not the concentration of this species remains constant.",
         "type": "boolean"
      },
      "ontology": {
         "description": "Ontology defining the role of the given species.",
         "allOf": [
            {
               "$ref": "#/definitions/SBOTerm"
            }
         ]
      }
   },
   "required": [
      "species_id",
      "stoichiometry",
      "constant",
      "ontology"
   ],
   "definitions": {
      "SBOTerm": {
         "title": "SBOTerm",
         "description": "String enumeration used to assign ontologies derived from SBOTerms.",
         "enum": [
            "SBO:0000176",
            "SBO:0000208",
            "SBO:0000181",
            "SBO:0000182",
            "SBO:0000179",
            "SBO:0000180",
            "SBO:0000209",
            "SBO:0000377",
            "SBO:0000177",
            "SBO:0000200",
            "SBO:0000672",
            "SBO:0000252",
            "SBO:0000251",
            "SBO:0000247",
            "SBO:0000327",
            "SBO:0000328",
            "SBO:0000336",
            "SBO:0000015",
            "SBO:0000011",
            "SBO:0000013",
            "SBO:0000020",
            "SBO:0000461",
            "SBO:0000462",
            "SBO:0000021",
            "SBO:0000296",
            "SBO:0000297",
            "SBO:0000607",
            "SBO:0000028",
            "SBO:0000025",
            "SBO:0000027",
            "SBO:0000186"
         ],
         "type": "string"
      }
   }
}

Fields
field constant: bool [Required]#

Whether or not the concentration of this species remains constant.

field ontology: SBOTerm [Required]#

Ontology defining the role of the given species.

field species_id: str [Required]#

Internal identifier to either a protein or reactant defined in the EnzymeMLDocument.

field stoichiometry: PositiveFloat [Required]#

Positive float number representing the associated stoichiometry.

Constraints
  • exclusiveMinimum = 0

get_id() str[source]#

Internal usage to get IDs from objects without ID attribute