mass.enzyme_modules.enzyme_module

EnzymeModule is a class for handling reconstructions of enzymes.

The EnzymeModule is a reconstruction an enzyme’s mechanism and behavior in a context of a larger system. To aid in the reconstruction process, the EnzymeModule contains various methods to build and add associated EnzymeModuleForm and EnzymeModuleReactions of the enzyme module (see make_enzyme_module_forms() and make_enzyme_module_reaction() methods, respecitvely).

Given the wide variety of enzymes and the various interactions it can have with ligands (e.g. catalyzation, inhibition, activation, etc.), the enzyme module has the following “categorized dict” attributes:

These “categorized dict” attributes allow the user to define categories and place various objects into one or more categories in the respective “categorized dict” attribute (ligands a.k.a. MassMetabolites, EnzymeModuleForm, and EnzymeModuleReactions). Utilizing categories with these attributes can help with the management of complex enzymes, and are preserved upon merging an EnzymeModule into a MassModel.

Because the EnzymeModule is a subclass of the MassModel, it can be merged with a MassModel representing the larger network in which the enzyme is a part of. For best results, an EnzymeModule should always be merged into the model as follows:

model.merge(enzyme_module, inplace=False)
# OR
new_model = model.merge(enzyme_module, inplace=True)

Once merged, the EnzymeModuleForm and EnzymeModuleReactions of the EnzymeModule are treated like any other MassMetabolite or MassReaction.

Therefore, to prevent the loss of the enzyme specific information that was stored in the EnzymeModule, the enzyme module is converted into an ordered dictionary known as an EnzymeModuleDict, which contains most of the enzyme specific attribute information. Note that all enzyme specific attribute names start with either "enzyme" or "enzyme_module".

During the model merging process, the EnzymeModuleDict is created, then stored in the MassModel.enzyme_modules attribute for access at a later time. See the enzyme_module_dict documentation for more information about the EnzymeModuleDict.

Module Contents

Classes

EnzymeModule

Class representation of an enzyme module reconstruction.

class mass.enzyme_modules.enzyme_module.EnzymeModule(id_or_model=None, name=None, subsystem='', array_type='dense', dtype=np.float64)[source]

Bases: mass.core.mass_model.MassModel

Class representation of an enzyme module reconstruction.

Parameters
  • id_or_model (str, MassModel, EnzymeModule) – A string identifier to associate with the EnzymeModule, or an existing model object. If an existing model object is provided, a new EnzymeModule object is instantiated with the same properties as the original model.

  • name (str) – A human readable name for the model.

  • subsystem (str) – The subsystem in which the enzyme module is a part of.

  • array_type (str) – A string identifiying the desired format for the returned matrix. Valid matrix types include 'dense', 'dok', 'lil', 'DataFrame', and 'symbolic' Default is 'DataFrame'. See the matrix module documentation for more information on the array_type.

  • dtype (data-type) – The desired array data-type for the stoichiometric matrix. If None then the data-type will default to numpy.float64.

enzyme_module_ligands

A DictList where the keys are the metabolite identifiers and the values are the associated MassMetabolites.

Type

DictList

enzyme_module_forms

A DictList where the keys are the EnzymeModuleForm identifiers and the values are the associated EnzymeModuleForm.

Type

DictList

enzyme_module_reactions

A DictList where keys are the reaction identifiers and the values are the associated EnzymeModuleReactions.

Type

DictList

property enzyme_total_symbol_str[source]

Get the symbol as a string for the total enzyme concentration.

property enzyme_flux_symbol_str[source]

Get the symbol as a string for the net flux through the enzyme.

property enzyme_concentration_total[source]

Get or set the total concentration value.

Notes

The total concentration of the enzyme cannot be negative.

Parameters

concentration (float) – A non-negative number for the concentration of the enzyme.

Raises

ValueError – Occurs when trying to set a negative value.

property enzyme_rate[source]

Get or set the flux through the enzyme.

Parameters

value (float) – The value of the net flux through the enzyme.

property enzyme_concentration_total_equation[source]

Return the total concentration equation.

Notes

Returns

A sympy expression of the sum of the EnzymeModuleForm.

Return type

Basic

property enzyme_rate_equation[source]

Get or set the net flux rate equation of the enzyme.

Parameters

equation (str, Basic) – Either a string representing the equationcthat will be sympified via the sympify() function., or a sympy expression representing the of the expression.

Returns

A sympy expression representing the net flux through the enzyme.

Return type

Basic

property enzyme_module_ligands_categorized[source]

Get or set categories for ligands.

Notes

  • A ligand must already exist in the EnzymeModule as a MassMetabolite in order to set its category.

  • If categories already exists, their existing contents are updated.

  • Setting an empty list for a category in the dict will cause that particular category group to be removed completely from the model.

  • Setting an empty dict will cause ALL category groups to be removed completely from the model.

Parameters

value (Group or dict) –

Either a cobra.Group to add to the categorized ligands, or a dict where keys are strings representing categories for the ligands, and values are lists containing the corresponding MassMetabolites or their identifiers.

An empty list will remove the corresponding category from the model and attribute.

An empty dict will remove all categories from the attribute and the model.

property enzyme_module_forms_categorized[source]

Get or set categories for enzyme module forms.

Notes

  • An enzyme module form must already exist in the EnzymeModule as an EnzymeModuleForm in order to set its category.

  • If categories already exists, their existing contents are updated.

  • Setting an empty list for a category in the dict will cause that particular category group to be removed completely from the model.

  • Setting an empty dict will cause ALL category groups to be removed completely from the model.

Parameters

value (Group or dict) –

Either a cobra.Group to add to the categorized enzyme module forms, or a dict where keys are strings representing categories for the enzyme module forms, and values are lists containing the corresponding EnzymeModuleForms or their identifiers.

An empty list will remove the corresponding category from the model and attribute.

An empty dict will remove all categories from the attribute and the model.

property enzyme_module_reactions_categorized[source]

Get or set categories for enzyme module reactions.

Notes

  • An enzyme module reaction must already exist in the EnzymeModule as an EnzymeModuleReaction in order to set its category.

  • If categories already exists, their existing contents are updated.

  • Setting an empty list for a category in the dict will cause that particular category group to be removed completely from the model.

  • Setting an empty dict will cause ALL category groups to be removed completely from the model.

Parameters

value (Group or dict) –

Either a cobra.Group to add to the categorized enzyme module reaction, or a dict where keys are strings representing categories for the enzyme module reactions, and values are lists containing the corresponding EnzymeModuleReactionss or their identifiers.

An empty list will remove the corresponding category from the model and attribute.

An empty dict will remove all categories from the attribute and the model.

make_enzyme_module_form(id=None, name='automatic', categories=None, bound_metabolites=None, compartment=None)[source]

Create and add an EnzymeModuleForm to the module.

Notes

Parameters
  • id (str) – A string identifier to associate with the enzymatic forms.

  • name (str) – Either a human readable name for the enzyme module forms, or the string "automatic". If set to "automatic", a name will be generated based on the identifier of the enzyme module forms and its bound ligands.

  • categories (str or list) – A string representing the category, or a list of strings containing several categories for the enzyme module forms.

  • bound_metabolites (dict) – A dict representing the ligands bound to the enzyme, with MassMetabolites or their identifiers as keys and the number bound as values.

  • compartment (str) – The compartment where the enzyme module forms is located.

Returns

The newly created EnzymeModuleForm.

Return type

EnzymeModuleForm

See also

EnzymeModuleForm.generate_enzyme_module_forms_name

Automatic generation of the name for an EnzymeModuleForm.

make_enzyme_module_reaction(id=None, name='', subsystem=None, reversible=True, categories=None, metabolites_to_add=None)[source]

Create and add an EnzymeModuleReaction to the module.

Notes

  • When adding metabolites, a final coefficient of < 0 implies a reactant and a final coefficient of > 0 implies a product.

Parameters
  • id (str) – The identifier associated with the enzyme module reaction.

  • name (str) – A human readable name for the enzyme module reaction. If name is set to match "automatic", a name will be generated based on the EnzymeModuleForm and their bound ligands.

  • subsystem (str) – The subsystem where the reaction is meant to occur.

  • reversible (bool) – The kinetic reversibility of the reaction. Irreversible reactions have an equilibrium constant and a reverse rate constant as set in the irreversible_Keq and irreversible_kr attributes of the MassConfiguration. Default is True.

  • categories (str or list) – A string representing the category, or a list of strings containing several categories for the enzyme module reactions.

  • metabolites_to_add (dict) – A dict with MassMetabolites and EnzymeModuleForm or their identifiers as keys and stoichiometric coefficients as values. If keys are string identifiers then the MassMetabolites and EnzymeModuleForm must already be a part of model.

Returns

The newly created EnzymeModuleReaction.

Return type

EnzymeModuleReaction

See also

EnzymeModuleReaction.generate_enzyme_module_reaction_name

Automatic generation of the name for an EnzymeModuleReaction.

unify_rate_parameters(reaction_list, new_parameter_id, rate_type=1, enzyme_prefix=False)[source]

Unify rate law parameters for a list of enzyme module reactions.

After unification, the new parameters and rate laws are placed into the custom_parameters and custom_rates attributes, repsectively.

Parameters
  • reaction_list (list) – A list containing EnzymeModuleReactions or their string identifiers. EnzymeModuleReactions must already exist in the EnzymeModule.

  • new_parameter_id (str) – The new parameter ID to use for the unified reaction parameters. The forward rate, reverse rate, and/or equilibrium constants in the current rate law will have the reaction ID component replaced with the new_parameter_id in the parameter ID.

  • rate_type (int) –

    The type of rate law to utilize in unification. Must be 1, 2, or 3.

    • Type 1 will utilize the forward_rate_constant and the equilibrium_constant.

    • Type 2 will utilize the forward_rate_constant and the reverse_rate_constant.

    • Type 3 will utilize the equilibrium_constant and the reverse_rate_constant.

    Default is 1.

  • enzyme_prefix (bool) – If True, add the EnzymeModule ID as a prefix to the new_parameter_id before using the new_parameter_id in the rate parameter unification. Default is False.

make_enzyme_rate_equation(enzyme_module_reactions, use_rates=False, update_enzyme=False)[source]

Create an equation representing the net flux through the enzyme.

The left side of the rate equation will always be the flux symbol of the enzyme, accessible via enzyme_flux_symbol_str.

Parameters
  • enzyme_module_reactions (list) – A list containing the EnzymeModuleReactions or their identifiers to be summed for the equation.

  • use_rates (bool) – If True, then the rates of the provided reactions are used in creating the expression. Otherwise the arguments in the expression are left as the EnzymeModuleReaction.flux_symbol_strs.

  • update_enzyme (bool) – If True, update the enzyme_rate_equation attribute and, if necessary, the enzyme_module_reactions attribute of the module in addition to returning the generated equation. Otherwise just return the net flux equation without making any updates. Default is False.

Returns

A sympy expression of the net flux equation.

Return type

Basic

sum_enzyme_module_form_concentrations(enzyme_module_forms, use_values=False)[source]

Sum the forms concentrations for a list of enzyme module forms.

Parameters
  • enzyme_module_forms (list) – A list containing the EnzymeModuleForm or their identifiers to be summed. Forms must already exist in the EnzymeModule.

  • use_values (bool) – If True, then numerical values are substituted into the expression. Otherwise arguments in the expression are left as sympy symbols.

Returns

The sum of the concentrations for the given enzyme module forms as a float if use_values is True and all values are present. Otherwise returns a sympy expression representing the sum of the given enzyme module forms.

Return type

float or Basic

sum_enzyme_module_reaction_fluxes(enzyme_module_reactions, use_values=False)[source]

Sum the enzyme reaction steady state fluxes for a list of reactions.

Parameters
  • enzyme_module_reactions (list) – A list a containing the EnzymeModuleReaction or their identifiers to be summed. Reactions must already exist in the module and must be considered an enzyme module reaction.

  • use_values (bool) – If True, then numerical values are substituted into the expression. Otherwise arguments in the expression are left as sympy symbols.

Returns

The sum of the steady state fluxes for the given enzyme reaction as a float if use_values is True and all values are present. Otherwise returns a sympy expression representing the sum of the enzyme module reaction fluxes.

Return type

float or Basic

enzyme_concentration_total_error(use_values=False)[source]

Return the error for the total enzyme concentrations.

The error of the total enzyme concentration is defined to be the difference between the enzyme_concentration_total value and the sum of all EnzymeModuleForm initial conditions in the model.

Notes

Positive values indicate the value in the enzyme_concentration_total attribute is greater than the value calculated using the expression from the enzyme_concentration_total_equation attribute.

Parameters

use_values (bool) – If True, then numerical values are substituted into the expression. Otherwise arguments in the expression are left as sympy symbols.

Returns

The error between the set enzyme_concentration_total and the sum of the EnzymeModuleForm initial condition values in the model as a float if use_values is True and all values are present. Otherwise returns a sympy expression representing the error.

Return type

float or Basic

enzyme_rate_error(use_values=False)[source]

Return the error for the net flux through the enzyme.

The error of the enzyme net flux is defined to be the difference between the enzyme_rate value and the calculated value for the enzyme_rate_equation.

Notes

Positive values indicate the value in enzyme_rate attribute is greater than the value calculated using the expression from the enzyme_rate_equation attribute.

Parameters

use_values (bool) – If True, then numerical values are substituted into the expression. Otherwise arguments in the expression are left as sympy symbols.

Returns

The error between the set enzyme_rate and the calculated value for the enzyme_rate_equation attribute as a float if use_values is True and all values are present in the model. Otherwise returns a sympy expression representing the error.

Return type

float or Basic

make_enzyme_fraction(categorized_attr, top, bottom, use_values=False)[source]

Make the expression for a ratio of categorized enzyme objects.

Notes

The string "Equation" can be passed to either top or bottom to utilize the equation in the corresponding attribute (i.e. enzyme_concentration_total_equation for 'forms' and enzyme_rate_equation for 'reactions').

Parameters
  • categorized_attr (str) – Either a string representing which categorized attribute to use or the attribute itself to use in making the enzyme ratio expression. Use the string 'forms' for enzyme_module_forms_categorized, or 'reactions' for enzyme_module_reactions_categorized.

  • top (str) – A string representing a category in the categorized attribute. The summation expression of the objects in the corresponding list is used as the top (numerator) of the fraction to be made. Alternatively, the string "Equation" can be provided to utilize an equation attribute.

  • bottom (str) – A string representing a category in the categorized attribute. The summation expression of the objects in the corresponding list is used as the bottom (denominator) of the fraction to be made. Alternatively, the string "Equation" can be provided to utilize an equation attribute.

  • use_values (bool) – If True, then numerical values are substituted into the expression. Otherwise arguments in the expression are left as sympy symbols.

Returns

The fraction either calculated and returned as float if use_values is True and all values are present in the model, or a sympy expression representing the formula for the fraction.

Return type

float or Basic

add_metabolites(metabolite_list)[source]

Add a list of metabolites and enzyme forms to the module.

The change is reverted upon exit when using the EnzymeModule as a context.

Notes

Extends from MassModel.add_metabolites().

Parameters
  • metabolite_list (list) – A list of MassMetabolites and EnzymeModuleForm to add to the EnzymeModule.

  • add_initial_conditons (bool) – If True, the initial conditions associated with the species are also added to the model. Otherwise, the species are added without their initial conditions.

remove_metabolites(metabolite_list, destructive=False)[source]

Remove a list of metabolites and enzyme forms from the module.

The species’ initial conditions will also be removed from the model.

The change is reverted upon exit when using the EnzymeModule as a context.

Notes

Extends from MassModel.remove_metabolites().

Parameters
add_reactions(reaction_list)[source]

Add a list of reactions to the EnzymeModule.

MassReactions and EnzymeModuleReactions with identifiers identical to an existing reaction are ignored.

The change is reverted upon exit when using the EnzymeModule as a context.

Notes

Extends from MassModel.add_reactions().

Parameters

reaction_list (list) – A list of MassReaction and EnzymeModuleReaction to add.

remove_reactions(reactions, remove_orphans=False)[source]

Remove reactions from the EnzymeModule.

The change is reverted upon exit when using the EnzymeModule as a context.

Notes

Extends from MassModel.remove_reactions().

Parameters
repair(rebuild_index=True, rebuild_relationships=True)[source]

Update all indicies and pointers in the model.

In addition to updating indicies and pointers, the enzyme_module_reactions attribute will be updated to ensure it contains all existing reactions involving EnzymeModuleForm.

Notes

Extends from MassModel.repair().

Parameters
  • rebuild_index (bool) – If True, then rebuild the indicies kept in the reactions, metabolites, and genes.

  • rebuild_relationships (bool) – If True, then reset all associations between the reactions, metabolites, genes, and the model, and rebuilds them.

copy()[source]

Create a partial “deepcopy” of the EnzymeModule.

All of the MassMetabolites, MassReactions, Genes, EnzymeModuleForm, EnzymeModuleReactions, and EnzymeModuleDicts, the boundary conditions, custom rates, custom parameters, and the stoichiometric matrix are created anew, but in a faster fashion than deepcopy.

Notes

merge(right, prefix_existing=None, inplace=True, objective='left')[source]

Merge two models into one model with the objects from both.

The reactions, metabolites, genes, enzyme modules, boundary conditions, custom rate expressions, rate parameters, compartments, units, notes, and annotations from the right model are also copied to left model. However, note that in cases where identifiers for objects are identical or a dict item has an identical key(s), priority will be given to what already exists in the left model.

Notes

  • When merging an EnzymeModule into a MassModel, the enzyme module is converted to an EnzymeModuleDict and stored in a DictList accessible via the enzyme_modules attribute. If an EnzymeModuleDict already exists in the model, it will be replaced.

  • If an EnzymeModule already exists in the model, it will be replaced.

  • When merging an EnzymeModule with another EnzymeModule, a new EnzymeModule will be returned, where the EnzymeModule is a copy of the ‘left’ model (self) with the 'right' model is contained within.

  • Overrides MassModel.merge().

Parameters
  • right (MassModel) – The model to merge into the left model. If a MassModel then the first model refers to the right model and the second model refers to the left model. Otherwise the first model refers to the left model and the second model refers to the right model.

  • prefix_existing (str) – If provided, the string is used to prefix the reaction identifier of a reaction in the second model if that reaction already exists within the first model. Will also apply prefix to identifiers of enzyme modules in the second model.

  • inplace (bool) – If True then add reactions from second model directly to the first model. Otherwise, create a new model leaving the first model untouched. When done within the model as context, changes to the models are reverted upon exit.

  • objective (str) – One of "left", "right" or "sum" for setting the objective of the resulting model to that of the corresponding model or the sum of both. Default is "left". Note that when merging a MassModel with an EnzymeModule, "left" will refer to the MassModel.

Returns

A new MassModel or EnzymeModule representing the merged model.

Return type

MassModel or EnzymeModule

_set_category_attribute(item, attr, to_filter)[source]

Set the categorized attribute after ensuring it is valid.

Warning

This method is intended for internal use only.

_set_enzyme_object_category(attr, category, object_list)[source]

Add a list of objects to a new or existing category.

Notes

  • If a category already exists, the objects will be added to the corresponding cobra.Group.

  • The objects to be categorized must already exist in the EnzymeModule.

  • An empty object_list will cause the group representing the category to be removed.

Parameters
  • category (str) – A string representing the category for the list of objects to be categorized.

  • object_list (list) –

    A list containing the objects to be categorized. The list must contain ONLY one of the following mass object types:

_update_object_pointers()[source]

Update objects in the attributes to be the objects from the model.

Warning

This method is intended for internal use only.

_get_current_enzyme_module_objs(attr, update_enzyme=True)[source]

Get the enzyme module objects for ‘attr’ that exist in the model.

Parameters
  • attr (str {'ligands', 'forms', 'reactions'}) – A string representing which attribute to update.

  • update_enzyme (bool) – If True, update the enzyme_module_reactions attribute of the EnzymeModule.

Warning

This method is intended for internal use only.

_make_summation_expr(items, object_type)[source]

Create a sympy expression of the summation of the given items.

Warning

This method is intended for internal use only.

_sub_values_into_expr(expr, object_type, additional=None)[source]

Substitute values into an expression and try to return a float.

Warning

This method is intended for internal use only.

_add_self_to_model(model, prefix_existing, inplace, objective)[source]

Add self to the model and return the MassModel object.

Warning

This method is intended for internal use only.

_repr_html_()[source]

HTML representation of the overview for the EnzymeModule.

Warning

This method is intended for internal use only.