dfba.model

Definition of DfbaModel class.

Module Contents

Classes

DfbaModel

Class representation for a dynamic FBA model.

Attributes

logger

dfba.model.logger[source]
class dfba.model.DfbaModel(cobra_object: cobra.Model)[source]

Bases: cobra.Object

Class representation for a dynamic FBA model.

Parameters

cobra_object (cobra.Model) – Existing cobra.Model object representing FBA model.

cobra_model[source]

Existing cobra.Model object containing FBA model (reactions, metabolites, objective).

Type

cobra.Model

reactions[source]

A DictList object where the key is the reaction identifier and the value a cobra.Reaction object in cobra_model attribute.

Type

DictList

objectives[source]

A list containing identifiers of reactions to be used as objectives in lexicographic optimization (currently not supported)

Type

list

directions[source]

A list containing directions (max or min) of each objective in lexicographic optimization (currently not supported)

Type

list

kinetic_variables[source]

A DictList object where the key is the kinetic variable identifier and the value a KineticVariable object.

Type

DictList

exchange_fluxes[source]

A DictList object where the key is the reaction identifier and the value an ExchangeFlux object.

Type

DictList

user_data[source]

A read only attribute containing user data of the model to be passed to algorithm prior to simulation.

Type

dfba_utils.UserData

solver_data[source]

An attribute containing data for the solver to be used for simulation of the model.

Type

dfba_utils.SolverData

add_objectives(self, objectives: List, directions: List)None[source]

Add objectives.

Parameters
  • objectives (list) – The list of reaction indetifiers to be added to the model as objectives for lexicographic optimization.

  • directions (list) – The list of directions (max or min) of each objective to be added to the model for lexicographic optimization.

add_kinetic_variables(self, kinetic_variable_list: List)None[source]

Add kinetic variables.

Parameters

kinetic_variable_list (list) – The list of indetifiers of kinetic variables to be added to the model.

add_exchange_fluxes(self, exchange_flux_list: List)None[source]

Add exchange fluxes.

Parameters

exchange_flux_list (list) – list of identifiers of exchange fluxes to be added to the model.

add_initial_conditions(self, initial_conditions: Dict)None[source]

Add initial conditions.

Parameters

initial_conditions (dict) – A dict where the key is the kinetic variable identifier and the value an initial condition.

add_rhs_expression(self, kinetic_variable_id: str, expression: dfba.types.Expression, control_parameters: Optional[List[dfba.control.ControlParameter]] = None)None[source]

Add rhs expression.

Parameters
  • kinetic_variable_id (string) – Identifier of the kinetic variable to be supplied with rhs expression for calculating its derivative wrt time.

  • expression (optlang.symbolics expression) – The symbolic expression for calculating derivative of kinetic variable wrt time.

  • control_parameters (list) – A list of ControlParameter objects (if any) appearing in the supplied symbolic expression.

add_exchange_flux_lb(self, exchange_flux_id: str, expression: dfba.types.Expression, condition: Optional[dfba.types.Expression] = None, control_parameters: Optional[List[dfba.control.ControlParameter]] = None)None[source]

Add exchange flux lower bound.

Parameters
  • exchange_flux_id (string) – Indetifier of the exchange flux to be supplied with expression for calculating its lower bound.

  • expression (optlang.symbolics expression) – The symbolic expression for calculating lower bound of exchange flux. Convention is that lower bounds of exchange fluxes come with negative sign and therefore expression should be non-negative,representing the magnitude of this lower bound.

  • condition (optlang.symbolics expression) – The symbolic expression for non-negative condition on metabolite concentrations required for correct evaluation of lower bound expression. Numerical approximation can generate unphysical, negative concetration values.

  • control_parameters (list) – A list of ControlParameter objects (if any) appearing in the supplied symbolic expression.

add_exchange_flux_ub(self, exchange_flux_id: str, expression: dfba.types.Expression, condition: Optional[dfba.types.Expression] = None, control_parameters: Optional[List[dfba.control.ControlParameter]] = None)None[source]

Add exchange flux upper bound.

Parameters
  • exchange_flux_id (string) – Indetifier of the exchange flux to be supplied with expression for calculating its upper bound.

  • expression (optlang.symbolics expression) – The symbolic expression for calculating upper bound of exchange flux. Convention is that upper bounds of exchange fluxes come with positive sign and therefore expression should be non-negative, representing the magnitude of this upper bound.

  • condition (optlang.symbolics expression) – The symbolic expression for non-negative condition on metabolite concentrations required for correct evaluation of upper bound expression. Numerical approximation can generate unphysical, negative concetration values.

  • control_parameters (list) – A list of ControlParameter objects (if any) appearing in the supplied symbolic expression.

simulate(self, tstart: float, tstop: float, tout: float, output_fluxes: Optional[List[str]] = None)Tuple[pandas.DataFrame, pandas.DataFrame][source]

Simulate model.

Parameters
  • tstart (float) – Initial time point to be used in simulation of the model.

  • tstop (float) – Final time point to be used in simulation of the model.

  • tout (float) – Output frequency to be used in simulation of the model.

  • output_fluxes (list) – Optional list of reaction ids whose fluxes are to be printed to results along with kinetic variables.

Returns

  1. time, concentrations (in self.kinetic_variables)

  2. time, flux trajectories (in )

Return type

tuple of 2 pd.Dataframe’s

lp_problem(self)dfba.types.Problem[source]

LP problem.

Returns

lp_problem – SWIGLPK object representing FBA model as pointer to GLPK problem

Return type

Swig Object of type glp_prob *

property id(self)str[source]

.

property cobra_model(self)cobra.Model[source]

.

property reactions(self)cobra.DictList[source]

.

property objectives(self)List[source]

.

property directions(self)List[source]

.

property kinetic_variables(self)cobra.DictList[source]

.

property exchange_fluxes(self)cobra.DictList[source]

.

property user_data(self)UserData[source]

.

property solver_data(self)SolverData[source]

.

add_to_library(self, tstart: float, tstop: float, tout: float, print_fluxes: List[cobra.Reaction], directory: str)None[source]

Add model to library.

Parameters ——- tstart : float

Initial time point to be used in simulation of the model.

tstopfloat

Final time point to be used in simulation of the model.

toutfloat

Length of time interval for output.

print_fluxeslist

List of reactions whose fluxes are to be printed to results along with kinetic variables.

directory: string

Path to temporary directory containing library.