mass.core.mass_model

MassModel is a class for holding information regarding a mass model.

The MassModel class inherits and extends the Model class in cobra. It contains additional information required for simulations and other mass functions and workflows.

Some key differences between the cobra.Model and the mass.MassModel are listed below:

Module Contents

Classes

MassModel

Class representation of a model.

Attributes

LOGGER

Logger for mass_model submodule.

CHOPNSQ

Contains the six most abundant elements and charge for molecules.

mass.core.mass_model.LOGGER[source]

Logger for mass_model submodule.

Type

logging.Logger

mass.core.mass_model.CHOPNSQ = ['C', 'H', 'O', 'P', 'N', 'S', 'q'][source]

Contains the six most abundant elements and charge for molecules.

Type

list

class mass.core.mass_model.MassModel(id_or_model=None, name=None, array_type='dense', dtype=np.float64)[source]

Bases: cobra.core.model.Model

Class representation of a model.

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

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

  • 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.

reactions

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

Type

DictList

metabolites

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

Type

DictList

genes

A DictList where the keys are gene identifiers and the values are the associated Genes.

Type

DictList

groups

A DictList where the keys are group identifiers and the values are the associated Groups.

Type

DictList

enzyme_modules

A DictList where the keys are enzyme module identifiers and the values are the associated EnzymeModuleDicts.

Type

DictList

custom_rates

A dict to store custom rate expressions for specific reactions, where the keys are MassReactions and values are the custom rate expressions given as sympy expressions. Custom rate expressions will always be prioritized over automatically generated mass action rates.

Type

dict

custom_parameters

A dict to store the custom parameters for the custom rates, where key:value pairs are the string identifiers for the parameters and their corresponding numerical value.

Type

dict

boundary_conditions

A dict to store boundary conditions, where keys are string identifiers for ‘boundary metabolites’ of boundary reactions, and values are the corresponding boundary condition numerical value or function of time. Note that boundary conditions are treated as parameters and NOT as species.

Type

dict

units

DictList of UnitDefinitions to store in the model for referencing.

Type

DictList

Warning

  • Note that the MassModel does NOT track units, and it is therefore incumbent upon the user to maintain unit consistency the model.

  • Note that boundary conditions are considered parameters and NOT as species in a reaction.

property stoichiometric_matrix[source]

Return the stoichiometric matrix.

property S[source]

Alias for the stoichiometric_matrix.

property ordinary_differential_equations[source]

Return a dict of ODEs for the metabolites.

property odes[source]

Alias for the ordinary_differential_equations.

property initial_conditions[source]

Get dict of MassMetabolite.initial_conditions.

property ics[source]

Alias for the initial_conditions.

property fixed[source]

Return a dict of all metabolite fixed conditions.

property rates[source]

Return a dict of reaction rate expressions.

If a reaction has an associated custom rate expression, the custom rate will be prioritized and returned in the dict instead of the automatically generated rate law expression.

property steady_state_fluxes[source]

Return a dict of all reaction steady state fluxes.

property v[source]

Alias for the steady_state_fluxes.

property boundary[source]

Return a list of boundary reactions in the model.

property boundary_metabolites[source]

Return a sorted list of all ‘boundary metabolites’ in the model.

property exchanges[source]

Return exchange reactions in the model.

Exchange reactions are reactions that exchange mass with the exterior. Uses annotations and heuristics to exclude non-exchanges such as sink and demand reactions.

property demands[source]

Return demand reactions in the model.

Demands are irreversible reactions that accumulate or consume a metabolite in the inside of the model.

property sinks[source]

Return sink reactions in the model.

Sinks are reversible reactions that accumulate or consume a metabolite in the inside of the model.

property irreversible_reactions[source]

Return a list of all irreversible reactions in the model.

property parameters[source]

Return all parameters associateed with the model.

property compartments[source]

Get or set a dict of all metabolite compartments.

Assigning a dict to this property updates the model’s dict of compartment descriptions with the new values.

Notes

  • Setter extends compartments() of the cobra.Model to enable resetting the attribute by setting an empty dict

Parameters

compartment_dict (dict) – A dict mapping compartments abbreviations to full names. An empty dict will reset the compartments.

property conc_solver[source]

Return the ConcSolver associated with the model.

update_S(array_type=None, dtype=None, update_model=True)[source]

Update the stoichiometric matrix of the model.

Parameters
  • 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 the current array_type. 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 the current dtype.

  • update_model (bool) – If True, will update the stored stoichiometric matrix, the matrix type, and the data-type for the model.

Returns

The stoichiometric matrix for the MassModel returned as the given array_type and with a data-type of dtype.

Return type

matrix of type array_type

add_metabolites(metabolite_list)[source]

Add a list of metabolites to the model.

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

Parameters

metabolite_list (list) – A list containing MassMetabolites to add to the model.

remove_metabolites(metabolite_list, destructive=False)[source]

Remove a list of metabolites from the model.

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

Parameters
  • metabolite_list (list) –

    A list containing MassMetabolites to remove

    from the model.

  • destructive (bool) – If False, the metabolites are removed from all associated reactions. If True, also remove associated MassReactions from the model.

add_boundary_conditions(boundary_conditions)[source]

Add boundary conditions values for the given boundary metabolites.

Boundary condition values can be a numerical value, or they can be a string or sympy expression representing a function of time. The function must only depend on time.

Parameters

boundary_conditions (dict) – A dict of boundary conditions containing the ‘boundary metabolites’ and their corresponding value. The string representing the ‘boundary_metabolite’ must exist in the list returned by MassModel.boundary_metabolites.

remove_boundary_conditions(boundary_metabolite_list)[source]

Remove the boundary condition for a list of boundary metabolites.

Parameters

metabolite_list (list) – A list of metabolites to remove the boundary conditions for. Boundary metabolites must already exist in the model in order for them to be removed.

add_reactions(reaction_list)[source]

Add reactions to the model.

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

Notes

Parameters

reaction_list (list) – A list of MassReactions to add to the model.

remove_reactions(reactions, remove_orphans=False)[source]

Remove reactions from the model.

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

Notes

Extends cobra.core.model.Model.remove_reactions() by also removing any custom rates along with the reaction (and custom parameters if remove_orphans=True). Also removes the boundary condition if the reaction is a boundary reaction with a defined boundary condition.

Parameters
  • reaction_list (list) – A list of MassReactions to be removed from the model.

  • remove_orphans (bool) – If True, will also remove orphaned genes and metabolites from the model. If a custom rate is removed, the orphaned custom parameters will also be removed.

add_boundary(metabolite, boundary_type='exchange', reaction_id=None, boundary_condition=0.0, **kwargs)[source]

Add a boundary reaction for a given metabolite.

Accepted kwargs are passed to the underlying function for boundary reaction creation, cobra.Model.add_boundary, and initialization of the MassReaction.

There are three different types of pre-defined boundary reactions: exchange, demand, and sink reactions.

  • An exchange reaction is a reversible, unbalanced reaction that adds to or removes an extracellular metabolite from the extracellular compartment.

  • A demand reaction is an irreversible reaction that consumes an intracellular metabolite.

  • A sink is similar to an exchange but specifically for intracellular metabolites.

Notes

  • Extends cobra.core.model.Model.add_boundary() by allowing for metabolite identifers of existing metabolites in the model, boundary conditions and reaction subsystem to be set, and utilizes default bounds from the MassConfiguration. for creation of custom boundary reaction types.

  • To set the reaction boundary_type to something else, the desired identifier of the created reaction must be specified. The name will be given by the metabolite name and the given boundary_type, and the reaction will be set its reversible attribute to True.

    Bounds will be set to the defaults specified in the MassConfiguration.

Parameters
  • metabolite (MassMetabolite or str) – Any MassMetabolite, or an identifier of a metabolite that already exists in the model. The metabolite compartment is not checked but it is encouraged to stick to the definition of exchanges, demands, and sinks.

  • boundary_type (str) – One of the pre-defined boundary types, or a user-defined type. Pre-defined boundary types include "exchange", "demand", and "sink". Using one of the pre-defined reaction types is easiest. To create a user-defined kind of boundary reaction choose any other string, e.g., ‘my-boundary’.

  • reaction_id (str) – The ID of the resulting reaction. This takes precedence over the auto-generated identifiers but beware that it might make boundary reactions harder to identify afterwards when using boundary or specifically exchanges etc.

  • boundary_condition (float, str, Basic) – The boundary condition value to set. Must be an int, float, or a sympy expression dependent only on time. Default value is 0.

  • **kwargs

    subsystem :

    str for subsystem where the reaction is meant to occur.

    lb :

    float for the lower bound of the resulting reaction, or None to use the default specified in the MassConfiguration.

    ub :

    float for the upper bound of the resulting reaction, or None to use the default specified in the MassConfiguration.

    sbo_term :

    str for the SBO term. A correct SBO term is set for the available boundary types. If a custom boundary type is chosen, a suitable SBO term should also be set.

Returns

The MassReaction of the new boundary reaction.

Return type

MassReaction

get_rate_expressions(reaction_list=None, rate_type=0, update_reactions=False)[source]

Get the rate expressions for a list of reactions in the model.

Notes

If a reaction has a custom rate in the MassModel.custom_rates attribute, it will be returned only when the rate_type=0.

Parameters
  • reaction_list (list) – A list of MassReactions to get the rate expressions for. Reactions must already exist in the model. If None, then return the rates for all reactions in the model.

  • rate_type (int) –

    The type of rate law to return. Must be 0, 1, 2, or 3.

    • If 0, the currrent rate expression is returned.

    • 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 0.

  • update_reactions (bool) – If True, update the MassReaction rate in addition to returning the rate expressions. Will not remove a custom rate.

Returns

A dict of reaction rates where keys are the reaction ids and values are the rate law expressions.

Return type

dict

get_mass_action_ratios(reaction_list=None, sympy_expr=True)[source]

Get mass action ratios for a list of reactions in the model.

Parameters
  • reaction_list (list) – A list of MassReactions to get the mass action ratios for. Reactions must already exist in the model. If None, then return the ratios for all reactions in the model.

  • sympy_expr (bool) – If True then return the mass action ratios as a sympy expression, otherwise return the ratio as a human readable string.

Returns

A dict of mass action ratios where keys are the reaction ids and values are the ratios.

Return type

dict

get_disequilibrium_ratios(reaction_list=None, sympy_expr=True)[source]

Get disequilibrium ratios for a list of reactions in the model.

Parameters
  • reaction_list (list) – A list of MassReactions to get the disequilibrium ratios for. Reactions must already exist in the model. If None, then return the ratios for all reactions in the model.

  • sympy_expr (bool) – If True then return the disequilibrium ratios as a sympy expression, otherwise return the ratio as a human readable string.

Returns

A dict of mass action ratios where keys are the reaction ids and values are the ratios.

Return type

dict

add_custom_rate(reaction, custom_rate, custom_parameters=None)[source]

Add a custom rate for a reaction to the model.

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

Notes

  • Metabolites must already exist in the MassModel.

  • Default parameters of a MassReaction are automatically taken into account and do not need to be defined as additional custom parameters.

Parameters
  • reaction (MassReaction) – The reaction associated with the custom rate.

  • custom_rate (str) – The string representation of the custom rate expression. The string representation of the custom rate will be used to create a sympy expression that represents the custom rate.

  • custom_parameters (dict) – A dict of custom parameters for the custom rate where the key:value pairs are the strings representing the custom parameters and their numerical values. The string representation of the custom parametes will be used to create the symbols needed for the sympy expression of the custom rate. If None, then parameters are assumed to already exist in the model.

See also

all_parameter_ids

Lists the default reaction parameters automatically accounted for.

remove_custom_rate(reaction, remove_orphans=True)[source]

Remove the custom rate for a given reaction from the model.

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

Parameters
  • reaction (MassReaction) – The reaction assoicated with the custom rate to be removed.

  • remove_orphans (bool) – If True, then remove any orphaned custom parameters from the model.

reset_custom_rates()[source]

Reset all custom rate expressions and parameters in a model.

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

Warning

Using this method will remove all custom rates and custom rate parameters in the model. To remove a specific rate without affecting the other custom rates or parameters, use remove_custom_rate() instead.

add_units(unit_defs)[source]

Add a UnitDefinition to the model units.

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

Notes

The model will not automatically track or convert units. Therefore, it is up to the user to ensure unit consistency in the model.

Parameters

unit_defs (list) – A list of UnitDefinitions to add to the model.

remove_units(unit_defs)[source]

Remove a UnitDefinition from the model units.

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

Notes

The model will not automatically track or convert units. Therefore, it is up to the user to ensure unit consistency in the model.

Parameters

unit_defs (list) – A list of UnitDefinitions or their string identifiers to remove from the model.

reset_units()[source]

Reset all unit definitions in a model.

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

Warning

Using this method will remove all UnitDefinitions from the model. To remove a UnitDefinition without affecting other units, use remove_units() instead.

get_elemental_matrix(array_type=None, dtype=None)[source]

Get the elemental matrix for a model.

Parameters
  • 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 'dense'. See the matrix module documentation for more information on the array_type.

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

Returns

The elemntal matrix for the MassModel returned as the given array_type and with a data-type of dtype.

Return type

matrix of type array_type

get_elemental_charge_balancing(array_type=None, dtype=None)[source]

Get the elemental charge balance as a matrix for a model.

Parameters
  • 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 'dense'. See the matrix module documentation for more information on the array_type.

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

Returns

The charge balancing matrix for the MassModel returned as the given array_type and with a data-type of dtype.

Return type

matrix of type array_type

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

Update all indicies and pointers in the model.

Notes

Extends repair() of the cobra.Model to include the MassModel.enzyme_modules and MassModel.units.

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, enzyme_modules, and the MassModel, and rebuilds them.

copy()[source]

Create a partial “deepcopy” of the MassModel.

All of the MassMetabolites, MassReactions, Genes and EnzymeModuleDicts, the boundary conditions, custom_rates, custom_parameters, and the stoichiometric matrix are created anew, but in a faster fashion than deepcopy.

Notes

Overrides copy() of the cobra.Model so that all objects are mass objects and additional attributes of specific to the MassModel.

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.

Custom constraints and variables from right models are also copied to left model, however note that, constraints and variables are assumed to be the same if they have the same name.

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.

  • Extends merge() of the cobra.Model by including additional MassModel attributes.

Parameters
  • right (MassModel) – The model to merge into the left 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 (right) model directly to the first (left) model. Otherwise, create a new model leaving the left 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".

Returns

A new MassModel or self representing the merged model.

Return type

MassModel

compute_steady_state_fluxes(pathways, independent_fluxes, update_reactions=False)[source]

Calculate the unique steady state flux for each reaction.

The unique steady state flux for each reaction in the MassModel is calculated using defined pathways, independently defined fluxes, and steady state concentrations, where index of values in the pathways must correspond to the index of the reaction in MassModel.reactions.

Notes

The number of individually defined fluxes must be the same as the number of pathways in order to determine the solution. For best results, the number of pathways to specify must equal the dimension of the right nullspace.

Parameters
  • pathways (array-like) – An array-like object that define the pathways through the reaction network of the model. The given pathway vectors must be the same length as the number of reactions in the model, with indicies of values in the pathway vector corresponding to the indicies of reactions in the reactions attribute.

  • independent_fluxes (dict) – A dict of steady state fluxes where MassReactions are keys and fluxes are values to utilize in order to calculate all other steady state fluxes. Must be the same length as the number of specified pathways.

  • update_reactions (bool) – If True then update the MassReaction.steady_state_flux with the calculated steady state flux value for each reaction.

Returns

A dict where key:value pairs are the MassReactions with their corresponding calculated steady state fluxes.

Return type

dict

Warning

The indicies of the values in the pathway vector must correspond to the indicies of the reactions in the reactions attribute in order for the method to work as intended.

calculate_PERCs(at_equilibrium_default=100000, update_reactions=False, verbose=False, **kwargs)[source]

Calculate pseudo-order rate constants for reactions in the model.

Pseudo-order rate constants (PERCs) are considered to be the same as forward_rate_constant attributes, and are calculated based on the steady state concentrations and fluxes.

Notes

  • All fluxes and concentrations used in calculations must be provided, including relevant boundary conditions. By default, the relevant values are taken from objects associated with the model.

  • To calculate PERCs for a subset of model reactions, use the fluxes kwawrg.

Parameters
  • at_equilibrium_default (float) – The value to set the pseudo-order rate constant if the reaction is at equilibrium. Default is 100,000.

  • update_reactions (bool) – If True then will update the values for the forward_rate_constant attributes with the calculated PERC values.

  • verbose (bool) – Whether to output more verbose messages for errors and logging.

  • **kwargs

    fluxes :

    A dict of reaction fluxes where MassReactions are keys and fluxes are the values. Only reactions provided will have their PERCs calculated. If None, PERCs are calculated using the current steady state fluxes for all reactions in the model.

    Default is None.

    concentrationsdict

    A dict of concentrations necessary for the PERC calculations, where MassMetabolites are keys and concentrations are the values. If None, the relevant concentrations that exist in the model are used.

    Default is None.

Returns

A dict where keys are strings identifers of the pseudo-order rate constants (as given by MassReaction.kf_str) and values are the calculated PERC values.

Return type

dict

build_model_from_string(model_str, verbose=True, reaction_split=';', reaction_id_split=':', **kwargs)[source]

Create a MassModel from strings of reaction equations.

Accepted kwargs are passed to the underlying function for reaction creation, MassReaction.build_reaction_from_string().

Takes a string representation of the reactions and uses the specifications supplied in the optional arguments to first infer a set of reactions and their identifiers, then to infer metabolites, metabolite compartments, and stoichiometries for the reactions. It also infers the reversibility of the reaction from the reaction arrow. For example:

'''
RID_1: S + E <=> ES;
RID_2: ES -> E + P;
RID_3: E + I <=> EI;
'''

where RID represents the identifier to assign the MassReaction.

Parameters
  • model (str) – A string representing the reaction formulas (equation) for the model.

  • verbose (bool) – Setting the verbosity of the function.

  • reaction_split (str) – Dividing individual reaction entries. Default is ";".

  • reaction_id_split (str) – Dividing individual reaction entries from their identifiers. Default is ":".

  • **kwargs

    fwd_arrow :

    re.compile() or None for forward irreversible reaction arrows. If None, the arrow is expected to be '-->' or '==>'.

    rev_arrow :

    re.compile() or None for backward irreversible reaction arrows. If None, the arrow is expected to be '<--' or '<=='.

    reversible_arrow :

    re.compile() or None for reversible reaction arrows. If None, the arrow is expected to be '<=>' or '<->'.

    term_splitstr

    Dividing individual metabolite entries. Default is "+".

See also

MassReaction.build_reaction_from_string()

Base method for building reactions.

update_parameters(parameters, verbose=True)[source]

Update the parameters associated with the MassModel.

Parameters can be the following:

Notes

The reactions must already exist in the model in order to change associated parameters. Any identifiers that are not identifiers of standard reaction parameter or of any ‘boundary metabolites’ will be set as a custom parameter.

Parameters
  • parameters (dict) – A dict containing the parameter identifiers as strings and their corresponding values to set in the model.

  • verbose (bool) – If True then display the warnings that may be raised when setting reaction parameters. Default is True.

See also

MassReaction.all_parameter_ids

Lists the default reaction parameter identifiers.

MassModel.boundary_metabolites

Lists the ‘boundary metabolites’ found in the model.

update_initial_conditions(initial_conditions, verbose=True)[source]

Update the initial conditions of the model.

Can also be used to update initial conditions of fixed metabolites to change the concentration value at which the metabolite is fixed.

Notes

The metabolite(s) must already exist in the model to set the initial conditions. Initial conditions for the metabolites are accessed through MassMetabolite.initial_condition. If an initial condition for a metabolite already exists, it will be replaced.

Parameters
  • initial_conditions (dict) – A dict where metabolites are the keys and the initial conditions are the values.

  • verbose (bool) – If True then display the warnings that may be raised when setting metabolite initial conditions. Default is True.

update_custom_rates(custom_rates, custom_parameters=None)[source]

Update the custom rates of the model.

Parameters
  • custom_rates (dict) – A dict where MassReactions or their string identifiers are the keys and the rates are the string representations of the custom rate expression.

  • custom_parameters (dict) – A dict of custom parameters for the custom rates, where the key:value pairs are the strings representing the custom parameters and their numerical values. If a custom parameter already exists in the model, it will be updated.

Notes

The reaction(s) must already exist in the model to set the custom rate.

has_equivalent_odes(right, verbose=False)[source]

Determine whether odes between two models are equivalent.

Notes

The ODEs between two models are compared to determine whether the models can be considered equivalent, meaning that the models contain the same metabolites, reactions, and rate expressions such that they require the same set of parameters and initial conditions for simulation.

Parameters
  • right (MassModel) – The MassModel to compare to the left model (self).

  • verbose (bool) – If True, display the reason(s) for the differences in the left and right models. Default is False.

Returns

Returns a bool indicating whether the model ODEs are equivalent.

Return type

bool

set_steady_state_fluxes_from_solver()[source]

Set reaction steady state fluxes based on the state of the solver.

Only works when reaction is associated with a model that has been optimized.

_cobra_to_mass_repair()[source]

Convert associated cobra objects to mass objects for self.

Warning

This method is intended for internal use only.

_mk_stoich_matrix(array_type=None, dtype=None, update_model=True)[source]

Return the stoichiometric matrix for a given MassModel.

The rows represent the chemical species and the columns represent the reaction. S[i, j] therefore contains the quantity of species ‘i’ produced (positive) or consumed (negative) by reaction ‘j’.

Warning

This method is intended for internal use only. To safely update the stoichiometric matrix, use update_S() instead.

_get_all_parameters()[source]

Get a dict containing all of defined model parameters in the model.

Warning

This method is intended for internal use only.

_copy_model_metabolites(new_model)[source]

Copy the metabolites in creating a partial “deepcopy” of model.

Warning

This method is intended for internal use only.

_copy_model_genes(new_model)[source]

Copy the genes in creating a partial “deepcopy” of model.

Warning

This method is intended for internal use only.

_copy_model_reactions(new_model)[source]

Copy the reactions in creating a partial “deepcopy” of model.

Warning

This method is intended for internal use only.

_copy_model_enzyme_modules(new_model)[source]

Copy the enzyme_modules in creating a partial “deepcopy” of model.

Warning

This method is intended for internal use only.

_copy_model_groups(new_model)[source]

Copy the groups in creating a partial “deepcopy” of model.

Warning

This method is intended for internal use only.

_repr_html_()[source]

HTML representation of the overview for the MassModel.

Warning

This method is intended for internal use only.

__setstate__(state)[source]

Ensure all objects in the model point to the MassModel.

Extends Model.__setstate__ to include enzyme_modules

Warning

This method is intended for internal use only.

__getstate__()[source]

Get the state for serialization.

Ensures that the context stack is cleared prior to serialization, since partial functions cannot be pickled reliably

Warning

This method is intended for internal use only.

__dir__()[source]

Override default dir() implementation to list only public items.

Warning

This method is intended for internal use only.