mass.thermo.conc_solution

Provide unified interfaces for optimization solutions for concentrations.

Based on solution implementations in cobra.core.solution

Module Contents

Classes

ConcSolution

A unified interface to a ConcSolver optimization solution.

Functions

get_concentration_solution(concentration_solver[, ...])

Generate a solution representation of a ConcSolver state.

update_model_with_concentration_solution(model, ...[, ...])

Update a mass model with values from a ConcSolution.

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 by get_concentration_solution() please look at that function to fully understand the ConcSolution class.

objective_value

The (optimal) value for the objective function.

Type

float

status

The solver status related to the solution.

Type

str

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

get_primal_by_id[source]
concentrations_to_frame()[source]

Get a pandas.pd.DataFrame of concs. and reduced costs.

Keqs_to_frame()[source]

Get a pandas.pd.DataFrame of Keqs and reduced costs.

to_frame()[source]

Get a pandas.pd.DataFrame of variables and reduced costs.

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

__getitem__(variable)[source]

Return the value of a metabolite concentration or reaction Keq.

Parameters

variable (str) – A variable ID for a variable in the solution.

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.

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
Returns

The solution of the optimization as a ConcSolution object.

Return type

ConcSolution

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 a ConcSolution.

Parameters
Returns

Either the given model if inplace=True, or a new copy of the model inplace=False.

Return type

MassModel