mass.thermo.conc_solution
Provide unified interfaces for optimization solutions for concentrations.
Based on solution implementations in cobra.core.solution
Module Contents
Classes
A unified interface to a |
Functions
|
Generate a solution representation of a |
|
Update a |
- class mass.thermo.conc_solution.ConcSolution(objective_value, status, concentrations, Keqs, concentration_reduced_costs=None, Keq_reduced_costs=None, shadow_prices=None)[source]
A unified interface to a
ConcSolver
optimization solution.Notes
The
ConcSolution
is meant to be constructed byget_concentration_solution()
please look at that function to fully understand theConcSolution
class.- concentrations
Contains the metabolite concentrations which are the primal values of metabolite variables.
- Type
pandas.pd.Series
- concentration_reduced_costs
Contains metabolite reduced costs, which are the dual values of metabolites variables.
- Type
pandas.pd.Series
- Keqs
Contains the reaction equilibrium constant values, which are primal values of Keq variables.
- Type
pandas.pd.Series
- Keq_reduced_costs
Contains reaction equilibrium constant reduced costs, which are the dual values of Keq variables.
- Type
pandas.pd.Series
- shadow_prices
Contains reaction shadow prices (dual values of constraints).
- Type
pandas.pd.Series
- _repr_html_()[source]
HTML representation of the overview for the ConcSolution.
Warning
This method is intended for internal use only.
- __repr__()[source]
Set string representation of the solution instance.
Warning
This method is intended for internal use only.
- mass.thermo.conc_solution.get_concentration_solution(concentration_solver, metabolites=None, reactions=None, raise_error=False, **kwargs)[source]
Generate a solution representation of a
ConcSolver
state.- Parameters
concentration_solver (ConcSolver) – The
ConcSolver
containing the mathematical problem solved.metabolites (list) – An iterable of
MassMetabolite
objects. UsesConcSolver.included_metabolites
by default.reactions (list) – An iterable of
MassReaction
objects. UsesConcSolver.included_reactions
by default.raise_error (bool) – Whether to raise an OptimizationError if solver status is not optimal.
**kwargs –
- decimal_precision :
bool
indicating whether to apply thedecimal_precision
attribute of theMassConfiguration
to the solution values.Default is
False
.
- Returns
The solution of the optimization as a
ConcSolution
object.- Return type
- mass.thermo.conc_solution.update_model_with_concentration_solution(model, concentration_solution, concentrations=True, Keqs=True, inplace=True)[source]
Update a
mass
model with values from aConcSolution
.- Parameters
model (MassModel) – A
mass
model to update with the new solution values.concentration_solution (ConcSolution) – The
ConcSolution
containing the solution values to use.concentrations (bool) – Whether to update the metabolite concentrations of the model (the
MassMetabolite.initial_condition
values).Keqs (bool) – Whether to update the reaction equilibrium constants of the model (the
MassReaction.equilibrium_constant
values).inplace (bool) – Whether to modify the given model or to modify a copy of the model.
- Returns
Either the given model if
inplace=True
, or a new copy of the modelinplace=False
.- Return type