gbacpp is a C++ implementation of the growth balance analysis mathematical formalism (GBA; Dourado et al. 2023). The software has been optimized to solve large-scale self-replicating cell (SRC) models, for which available solvers for non-linear constraint-based problems usually struggle. The optimization process relies on a gradient ascent approach, and is preferred for models offering a convex solution space (typically, when all reactions in the metabolic network are linearly independent).
☑️ Note that SRC models must comply to a standardized format. Guidelines are available in the SRC model format tutorial.
☑️ When building a SRC model, stoichiometric coefficients, and kinetic parameters must be converted following GBA formalism. See the units conversion tutorial.
☑️ The gradient ascent algorithm will be detailed in the documentation soon.
☑️ gbacpp will integrate evolutionary algorithms in the near future (see Roadmap).
☑️ A complete tutorial on GBA formalism is also available at https://cellgrowthsim.com/.
- 1) Roadmap
- 2) Contributing
- 3) Installation instructions
- 4) First usage
- 5) SRC model format tutorial
- 6) Units conversion tutorial
- 7) Copyright
- 8) License
Task | Status |
---|---|
Gradient ascent (best for full column-rank SRC models) | |
MCMC algorithm | |
Forward-in-time population level simulations | |
Lineage tracking |
If you wish to contribute, do not hesitate to reach the developer.
Download the latest release of gbacpp, and save it to a directory of your choice. Open a terminal and use the cd
command to navigate to this directory. Then follow the steps below to compile and build the executables.
gbacpp software has been primilary developed for Unix/Linux and macOS systems.
- A C++ compiler (GCC, LLVM, ...; C++17 required),
- CMake
$\geq$ 3.5 (command line version), - GSL
$\geq$ 2.8 (https://www.gnu.org/software/gsl/).
Download the latest release of gbacpp, and save it into a directory of your choice. Open a terminal and use the cd
command to navigate to this directory. To install gbacpp, simply call the script install.sh
on the command line:
sh install.sh
The script will compile and install the software in the appropriate folder (usually in a bin
directory, such as /usr/local/bin
).
The binary executable find_model_optimum
should be available in the terminal. If not, you may need to export the binary path. For example:
export PATH="/usr/bin:$PATH"
To manually compile gbacpp, run the following instructions on the command line:
cd cmake/
and
bash make.sh
To compile the software in DEBUG mode, use make_debug.sh
script instead of make.sh
:
bash make_debug.sh
This mode should only be used for test or development phases.
Binary executable files are in build/bin
folder.
To clean compiled files and binary executables, run:
bash make_clean.sh
Once gbacpp has been compiled and installed, follow the next steps for a first usage of the software.
SRC models are non-linear constraint-based problems. Solving such tasks in much more difficult than linear problems (e.g. FBA problems). A few solvers are available, and can usually handle small SRC models. However, we noticed that these solvers tend to fail when solving larger GBA problems, and are unable to handle genome-scale models.
As GBA formalism provides analytical solutions to calculate the growth rate gradient, we have implemented gbacpp to circumvent this limitation, allowing us to solve large, or even genome-scale SRC models in a reasonable timeframe.
In gbacpp, gradient ascent is timestep-adaptive, ensuring solutions stay consistent. In particular, we have implemented controls when concentrations or fluxes converge to zero to avoid algorithmic traps.
The gradient ascent implemented here relies on
gbacpp combines two benefits of using C++. Compilers natively optimize calculations (e.g., using vectorization), and we could strongly optimize calculations and memory management. This approach makes gbacpp a fast solution.
To run a gradient ascent optimization on a SRC model, execute the following command line:
find_model_optimum <parameters>
The command line parameters are described below. The description is also available by executing the following command line in a terminal:
find_model_optimum -h
-h
,--help
: Print the help, then exit,-v
,--version
: Print the current version, then exit,
-path
,--model-path
: Specify the path of the SRC model to be loaded,-name
,--model-name
: Specify the name of the SRC model to be loaded,-condition
,--condition
: Specify the external condition. Ifall
is selected, all conditions are applied.
-
-print
,--print-optimum
: Indicates if the optimum should be printed in the standard output. This option is useful to pass the result to another program (⚠️ -verbose
option should not be used), -
-optimum
,--write-optimum
: Indicates if the optimum should be written as output files, -
-trajectory
,--write-trajectory
: Indicates if the trajectory should be written as output files. Tracking the optimization trajectory can be useful during tests, -
-output
,--output-path
: Specify the path of output files, -
-tol
,--tolerance
: Specify the tolerance value ($10^{-10}$ by default), -
-stable
,--stable-count
: Specify the maximal number of iterations with unchanged growth rate as a stop criterium ($10,000$ by default), -
-max
,--max-iter
: Specify the maximal number of iterations as a stop criterium ($100,000,000$ by default), -
-reload
,--reload
: Indicates if the last trajectory point should be used as q0 -restart,
--restart
: Indicates if the last trajectory point should be used as a fresh start-
-verbose
,--verbose
: Indicates if the program should run in verbose mode (can conflict with the option-print
).
In this example, growth rate optimums are calculated for all the external conditions of the Escherichia coli toy model EC12b (see folder ./examples/toy_models
).
First, navigate to the folder ./examples
using the cd
command:
cd ./examples
Then, call the optimization algorithm:
find_model_optimum -path ./toy_models -name EC12b -condition all -output ./output -verbose
Here, optimums are calculated for all conditions, and saved in the folder ./examples/output
. Verbose mode is activated to get insights in the optimization process.
A tutorial is available to better understand the content of a self-replicating cell model:
:link: SRC model format tutorial
A tutorial is available for users starting from standard stoichiometric coefficients and kinetic parameters, and wanting to convert them into GBA formalism:
:link: Units conversion tutorial
Copyright © 2024-2025 Charles Rocabert. All rights reserved.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.