Welcome to dfba’s documentation!

Current PyPI Version Supported Python Versions GPLv3+ Pipeline Status Coverage Report Black Contributor Covenant https://joss.theoj.org/papers/10.21105/joss.02342/status.svg

This project provides an object-oriented software package for dynamic flux-balance analysis (DFBA) simulations using implementations of the direct method or Algorithm 1 described in the paper Harwood et al., 2016. The main algorithms for solving embedded LP problems are written in C++ and use the GNU Linear Programming Kit (GLPK) and the Suite of Nonlinear and Differential/Algebraic Equation Solvers (SUNDIALS) CVODE or IDA. Extension modules to cobrapy are provided for easy generation and simulation of DFBA models.


This software package implements the fastest and most robust DFBA simulation algorithms in a compiled programming language that is made accessible to users through a simple and intuitive interface with cobrapy. The target audience is researchers wanting to build and efficiently simulate specific DFBA models of interest, but not spend their time wrestling with the numerical challenges of DFBA. Users are not expected to interact directly with the lower-level C++ interface and once installed the package should ideally remain untouched. Instead, the classes and functions for solving embedded LP problems have been exposed to Python using pybind11. Combined with the provided cobrapy extension modules, this provides the user with the ability to build their own DFBA model exclusively in Python.

The Python class dfba.DfbaModel intuitively encapsulates all the data required for a full definition of a DFBA model by combining an underlying cobrapy object with instances of the dfba.KineticVariable and dfba.ExchangeFlux classes. The dfba.DfbaModel class instance ensures all user data are consistent with the initialization and simulation requirements of an embedded LP problem. User data are passed directly to the algorithms and symbolic functions are dynamically compiled and loaded prior to simulation.

The directory examples also contains scripts for the examples described in the Example DFBA models section, and details on how the user can adapt these to build and simulate their own model are outlined in the section Creating and simulating a DFBA model.

Indices and tables