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:
When instantiating a
MassModel
from acobra.Model
, any associatedcobra.Metabolite
will also be converted into aMassMetabolite
, and any associatedcobra.Reaction
will also be converted into aMassReaction
.Additionally, any groups associated with the model containing
cobra.Metabolites
orcobra.Reactions
will be updated with the correspondiningmass
objects.No
cobra
object can be directly added to theMassModel
with the exception ofGene
andGroup
objects. Anycobra
object will first be instantiated into its equivalentmass
object before beimg added to theMassModel
.
Module Contents
Classes
Class representation of a model. |
Attributes
Logger for |
|
Contains the six most abundant elements and charge for molecules. |
- mass.core.mass_model.LOGGER[source]
Logger for
mass_model
submodule.- Type
- mass.core.mass_model.CHOPNSQ = ['C', 'H', 'O', 'P', 'N', 'S', 'q'][source]
Contains the six most abundant elements and charge for molecules.
- Type
- 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 existingMassModel
is provided, a newMassModel
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 thematrix
module documentation for more information on thearray_type
.dtype (data-type) – The desired array data-type for the stoichiometric matrix. If
None
then the data-type will default tonumpy.float64
.
- reactions
A
DictList
where the keys are reaction identifiers and the values are the associatedMassReaction
s.- Type
- metabolites
A
DictList
where the keys are metabolite identifiers and the values are the associatedMassMetabolite
s.- Type
- groups
A
DictList
where the keys are group identifiers and the values are the associatedGroup
s.- Type
- enzyme_modules
A
DictList
where the keys are enzyme module identifiers and the values are the associatedEnzymeModuleDict
s.- Type
- custom_rates
A
dict
to store custom rate expressions for specific reactions, where the keys areMassReaction
s and values are the custom rate expressions given assympy
expressions. Custom rate expressions will always be prioritized over automatically generated mass action rates.- Type
- 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
- 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
- units
DictList
ofUnitDefinition
s to store in the model for referencing.- Type
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 S(self)[source]
Alias for the
stoichiometric_matrix
.
- property odes(self)[source]
Alias for the
ordinary_differential_equations
.
- property initial_conditions(self)[source]
Get
dict
ofMassMetabolite.initial_condition
s.
- property ics(self)[source]
Alias for the
initial_conditions
.
- property rates(self)[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 v(self)[source]
Alias for the
steady_state_fluxes
.
- property boundary_metabolites(self)[source]
Return a sorted
list
of all ‘boundary metabolites’ in the model.See also
- property exchanges(self)[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(self)[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(self)[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(self)[source]
Return a
list
of all irreversible reactions in the model.
- property compartments(self)[source]
Get or set a
dict
of all metabolite compartments.Assigning a
dict
to this property updates the model’sdict
of compartment descriptions with the new values.Notes
Setter extends
compartments()
of thecobra.Model
to enable resetting the attribute by setting an emptydict
- Parameters
compartment_dict (dict) – A
dict
mapping compartments abbreviations to full names. An emptydict
will reset the compartments.
- property conc_solver(self)[source]
Return the
ConcSolver
associated with the model.
- update_S(self, 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 currentarray_type
. See thematrix
module documentation for more information on thearray_type
.dtype (data-type) – The desired array data-type for the stoichiometric matrix. If
None
then the data-type will default to the currentdtype
.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 givenarray_type
and with a data-type ofdtype
.- Return type
matrix of type
array_type
- add_metabolites(self, 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
containingMassMetabolite
s to add to the model.
- remove_metabolites(self, 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
MassMetabolite
s to remove from the model.
- A list containing
destructive (bool) – If
False
, the metabolites are removed from all associated reactions. IfTrue
, also remove associatedMassReaction
s from the model.
- add_boundary_conditions(self, 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 thelist
returned byMassModel.boundary_metabolites
.
See also
- remove_boundary_conditions(self, 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.
See also
- add_reactions(self, reaction_list)[source]
Add reactions to the model.
The change is reverted upon exit when using the
MassModel
as a context.Notes
MassReaction
s with identifiers identical to an existing reaction are ignored.Extends
cobra.core.model.Model.add_reactions()
by first ensuring that the reactions to be added areMassReactions
s and notcobra.Reactions
. and error message raised reflects themass
object.If a
cobra.Reaction
is provided. a warning is raised and aMassReaction
will be instantiated using thecobra.Reaction
.
- Parameters
reaction_list (list) – A
list
ofMassReaction
s to add to the model.
- remove_reactions(self, 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 ifremove_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
ofMassReaction
s 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(self, 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 theMassReaction
.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 theMassConfiguration
. 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 givenboundary_type
, and the reaction will be set its reversible attribute toTrue
.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 specificallyexchanges
etc.boundary_condition (float, str, Basic) – The boundary condition value to set. Must be an
int
,float
, or asympy
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, orNone
to use the default specified in theMassConfiguration
.- ub :
float
for the upper bound of the resulting reaction, orNone
to use the default specified in theMassConfiguration
.- 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
- get_rate_expressions(self, 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 therate_type=0
.- Parameters
reaction_list (list) – A
list
ofMassReaction
s to get the rate expressions for. Reactions must already exist in the model. IfNone
, 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 theequilibrium_constant
.Type 2 will utilize the
forward_rate_constant
and thereverse_rate_constant
.Type 3 will utilize the
equilibrium_constant
and thereverse_rate_constant
.
Default is
0.
update_reactions (bool) – If
True
, update theMassReaction
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
- get_mass_action_ratios(self, 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
ofMassReaction
s to get the mass action ratios for. Reactions must already exist in the model. IfNone
, then return the ratios for all reactions in the model.sympy_expr (bool) – If
True
then return the mass action ratios as asympy
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
- get_disequilibrium_ratios(self, reaction_list=None, sympy_expr=True)[source]
Get disequilibrium ratios for a
list
of reactions in the model.- Parameters
reaction_list (list) – A
list
ofMassReaction
s to get the disequilibrium ratios for. Reactions must already exist in the model. IfNone
, then return the ratios for all reactions in the model.sympy_expr (bool) – If
True
then return the disequilibrium ratios as asympy
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
- add_custom_rate(self, 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. IfNone
, 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(self, 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(self)[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(self, unit_defs)[source]
Add a
UnitDefinition
to the modelunits
.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
ofUnitDefinition
s to add to the model.
- remove_units(self, unit_defs)[source]
Remove a
UnitDefinition
from the modelunits
.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
ofUnitDefinition
s or their string identifiers to remove from the model.
- reset_units(self)[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
UnitDefinition
s from the model. To remove aUnitDefinition
without affecting other units, useremove_units()
instead.
- get_elemental_matrix(self, 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 thematrix
module documentation for more information on thearray_type
.dtype (data-type) – The desired array data-type for the matrix. If
None
then the data-type will default tonumpy.float64
.
- Returns
The elemntal matrix for the
MassModel
returned as the givenarray_type
and with a data-type ofdtype
.- Return type
matrix of type
array_type
- get_elemental_charge_balancing(self, 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 thematrix
module documentation for more information on thearray_type
.dtype (data-type) – The desired array data-type for the matrix. If
None
then the data-type will default tonumpy.float64
.
- Returns
The charge balancing matrix for the
MassModel
returned as the givenarray_type
and with a data-type ofdtype
.- Return type
matrix of type
array_type
- repair(self, rebuild_index=True, rebuild_relationships=True)[source]
Update all indicies and pointers in the model.
Notes
Extends
repair()
of thecobra.Model
to include theMassModel.enzyme_modules
andMassModel.units
.
- copy(self)[source]
Create a partial “deepcopy” of the
MassModel
.All of the
MassMetabolite
s,MassReaction
s,Gene
s andEnzymeModuleDict
s, the boundary conditions, custom_rates, custom_parameters, and the stoichiometric matrix are created anew, but in a faster fashion thandeepcopy
.Notes
Overrides
copy()
of thecobra.Model
so that all objects aremass
objects and additional attributes of specific to theMassModel
.
- merge(self, 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 aMassModel
, the enzyme module is converted to anEnzymeModuleDict
and stored in aDictList
accessible via theenzyme_modules
attribute. If anEnzymeModuleDict
already exists in the model, it will be replaced.Extends
merge()
of thecobra.Model
by including additionalMassModel
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
orself
representing the merged model.- Return type
- compute_steady_state_fluxes(self, 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 inMassModel.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 whereMassReaction
s 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 theMassReaction.steady_state_flux
with the calculated steady state flux value for each reaction.
- Returns
A
dict
where key:value pairs are theMassReaction
s with their corresponding calculated steady state fluxes.- Return type
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(self, 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 theforward_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 whereMassReaction
s are keys and fluxes are the values. Only reactions provided will have their PERCs calculated. IfNone
, 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, whereMassMetabolite
s are keys and concentrations are the values. IfNone
, 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 byMassReaction.kf_str
) and values are the calculated PERC values.- Return type
- build_model_from_string(self, 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 theMassReaction
.- 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()
orNone
for forward irreversible reaction arrows. IfNone
, the arrow is expected to be'-->'
or'==>'
.- rev_arrow :
re.compile()
orNone
for backward irreversible reaction arrows. IfNone
, the arrow is expected to be'<--'
or'<=='
.- reversible_arrow :
re.compile()
orNone
for reversible reaction arrows. IfNone
, 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(self, 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
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(self, 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.
- update_custom_rates(self, custom_rates, custom_parameters=None)[source]
Update the custom rates of the model.
- Parameters
custom_rates (dict) – A
dict
whereMassReaction
s 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.
See also
- has_equivalent_odes(self, 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.
- set_steady_state_fluxes_from_solver(self)[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(self)[source]
Convert associated cobra objects to mass objects for self.
Warning
This method is intended for internal use only.
- _mk_stoich_matrix(self, 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(self)[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(self, 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(self, 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(self, 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(self, 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(self, new_model)[source]
Copy the groups in creating a partial “deepcopy” of model.
Warning
This method is intended for internal use only.
- _repr_html_(self)[source]
HTML representation of the overview for the MassModel.
Warning
This method is intended for internal use only.
- __setstate__(self, state)[source]
Ensure all objects in the model point to the MassModel.
Extends
Model.__setstate__
to include enzyme_modulesWarning
This method is intended for internal use only.