This repository holds the code for the Pseudobatch Python package, Excel-templates, the documentation, example datasets and the code required to reproduce simulations, analysis and figures in the article LINK-TO-ARTICLE.
The Pseudobatch transformation is a method to transform data from fed-batch processes to ease analysis both through visual inspection and through statistical modelling. The transformation is especially useful when samples are drawn during the fed-batch fermentation.
A simple example is the following (simulated) fed-batch fermentation. During the fermentation we have simulated several samples. Typically samples are removed to have more comprehensive analysis through e.g. HPLC, transcriptomics, proteomics, metabolomics, Optical density (OD), etc.
The grey line show the simulated biomass in mass units (not concentration). The biomass curve makes sudden drops because mass is removed samples are withdrawn. The blue point are biomass measurements at the sampling point e.g. OD measurements.
A typical analysis of such fermentation data is the estimate the growth rate. This is typically done through a log-linear model, i.e. first log-transforming the biomass measurements and the fit a linear model. If we fit a log-linear model to the raw growth data, we obtain the wrong estimate of the growth rate (blue line). It visually clear that the slope of the blue line is not the same as the slope of the grey line. However, if we first apply the Pseudobatch transformation, we remove the sudden drops in mass and now we obtain the correct growth rate from the log-linear model.
There are multiple ways to use the pseudobatch transformation.
Download the excel template from the excel-pseudobatch folder and follow the instructions in the template. NB the excel template can also be used to import data into Python (See here).
The Python package holds functions which apply the pseudobatch transformation to data either in the form of Numpy
Arrays or Pandas
dataframe. Please visit our documentation to how to use the Python package.
The Pseudobatch Python package can be install through PYPI using pip. Most of the functionality can be installed simply be calling
pip install pseudobatch
The error propagation functionality requires installation of cmdstanpy and CmdStan. Thus, installing the error propagation functionality takes a few steps. First install cmdstanpy in the prefered virtual environment.
pip install cmdstanpy
Second, use cmdstanpy to install CmdStan. To due this you need to call use the function cmdstanpy.install_cmdstan()
. This can for example be done by opening a python session in the terminal and run the following two Python commands
import cmdstanpy
cmdstanpy.install_cmdstan()
Now exit the Python session and install the remaining dependencies of the error propagation module through pip.
pip install pseudobatch[error_propagation]
Now the error propagation module is installed and ready to use.
If you use the pseudobatch transformation please cite the original article XXX.
The article folder holds the code which was used create the simulated datasets, to proof that the transformation works, analyse the error propagation and create the illustrations for the paper.
To increase reproducibility we have provided a docker container. Inside this container all simulations and analysis can be reproduced. Instructions on how to download and use the docker container is found in the article folder.
Pseudobatch's documentation lives in the folder docs
, written in Jupyter
notebooks and restructured text documents and built using
Sphinx.
The source files can be found in the folder docs/source
.
In order to rebuild the documentation after editing, first make sure that you
have installed all the dependencies by running pip install -e .'[development]'
from the project root. Next, change directory to docs
and
run the command make html
. To view your changes run open build/html/index.html
or just click through to this file using your file
explorer.
This is a note to developers who wants to rebuild/update the docker image. If you simply want to use the docker image see the description in the article folder.
The Docker container relies on the jupyter/datascience-notebook, see also here. We used this image because it includes both Python and Julia out of the box, the down side is that it is quite large. To create the image you need a local copy of this repository and inside that folder run the following command:
docker build . -t pseudobatch:{version}
This recreates the docker image. Be aware that installing the Julia packages and cmdstan are both take quite some time, thus expect that it take ~ 15 - 30 min to build.