dfba

Create top level imports.

Subpackages

Submodules

Package Contents

Classes

ControlParameter(name: str, change_point: str = None, values: List = None, change_points: List = None, *args, **kwargs) Holds information regarding a control parameter in a DfbaModel object.
ExchangeFlux(name: str, *args, **kwargs) Class for holding information for an exchange flux in a DfbaModel object.
KineticVariable(name: str, initial_condition: Number = 0.0, *args, **kwargs) Class for holding information for a kinetic variable in a DfbaModel object.
DfbaModel(cobra_object: Model) Class representation for a dynamic FBA model.

Functions

get_versions() Get version information or return default if unable to do so.
show_versions() Print dependency information.
dfba.__author__ =[source]

David S. Tourigny, Columbia University Irving Medical Center, New York, USA Moritz E. Beber, Novo Nordisk Foundation Center for Biocustainability, Technical University of Denmark

dfba.__email__ =[source]

dst2156@cumc.columbia.edu morbeb@biosustain.dtu.dk

dfba.get_versions()[source]

Get version information or return default if unable to do so.

dfba.__version__[source]
dfba.show_versions() → None[source]

Print dependency information.

class dfba.ControlParameter(name: str, change_point: str = None, values: List = None, change_points: List = None, *args, **kwargs)[source]

Bases: optlang.symbolics.Symbol

Holds information regarding a control parameter in a DfbaModel object.

id

The identifier to associate with this control parameter.

Type:string
change_points

The time points at which this control parameter changes value.

Type:list
values

The values taken by this control parameter.

Type:list
id :str

For convenience, synonym with .name from symbolics.Symbol.

change_points :List

Time points at which this control parameter changes value.

values :List

Actual values of the control parameter.

set_parameters(self, change_points: List, values: List)

Standardize input attributes.

class dfba.ExchangeFlux(name: str, *args, **kwargs)[source]

Bases: optlang.symbolics.Symbol

Class for holding information for an exchange flux in a DfbaModel object.

id

The identifier to associate with this exchange flux.

Type:string
lower_bound_expression

The symbolic expression for calculating the lower bound of this exchange flux.

Type:optlang.symbolics expression
upper_bound_expression

The Symbolic expression for calculating the upper bound of this exchange flux.

Type:optlang.symbolics expression
id :str

For convenience, synonym with .name from symbolics.Symbol.

lower_bound_expression :Expression

Relate the exchange rate to some symbolic expression.

upper_bound_expression :Expression

Relate the exchange rate to some symbolic expression.

class dfba.KineticVariable(name: str, initial_condition: Number = 0.0, *args, **kwargs)[source]

Bases: optlang.symbolics.Symbol

Class for holding information for a kinetic variable in a DfbaModel object.

id

The identifier to associate with this kinetic variable.

Type:string
rhs_expression

The symbolic expression for calculating derivative of this kinetic variable wrt time.

Type:optlang.symbolics expression
initital_condition

The initial value of this kinetic variable to be used at start of simulation.

Type:int or float
id :str

For convenience, synonym with .name from symbolics.Symbol.

rhs_expression :Union[Expression, None]

Relate the rhs expression to some symbolic expression.

initial_condition :Number

Relate the ininital condition to some int or float value.

class dfba.DfbaModel(cobra_object: 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

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

Type:cobra.Model
reactions

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

Type:DictList
objectives

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

Type:list
directions

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

Type:list
kinetic_variables

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

Type:DictList
exchange_fluxes

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

Type:DictList
user_data

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

Type:dfba_utils.UserData
solver_data

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

Type:dfba_utils.SolverData
id :str

.

cobra_model :Model

.

reactions :DictList

.

objectives :List

.

directions :List

.

kinetic_variables :DictList

.

exchange_fluxes :DictList

.

user_data :UserData

.

solver_data :SolverData

.

add_objectives(self, objectives: List, directions: List)

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)

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)

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)

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: Expression, control_parameters: Optional[List[ControlParameter]] = None)

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: Expression, condition: Optional[Expression] = None, control_parameters: Optional[List[ControlParameter]] = None)

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: Expression, condition: Optional[Expression] = None, control_parameters: Optional[List[ControlParameter]] = None)

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)

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)

LP problem.

Returns:lp_problem – SWIGLPK object representing FBA model as pointer to GLPK problem
Return type:Swig Object of type glp_prob *
add_to_library(self, tstart: float, tstop: float, tout: float, print_fluxes: List[Reaction], directory: str)

Add model to library.

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
Length of time interval for output.
print_fluxes : list
List of reactions whose fluxes are to be printed to results along with kinetic variables.
directory: string
Path to temporary directory containing library.