Skip to content

FRCBS/Hb_predictor_container

Repository files navigation

Hb_predictor_container

Hemoglobin predictor wrapped in a Docker container. Download the docker image with command docker pull toivoja/hb-predictor. A specific version (for example 0.23) can be downloaded with docker pull toivoja/hb-predictor:0.23.

The predictor is described in the following article:

Toivonen, J, Koski, Y, Turkulainen, E, Prinsze, F, della Briotta Parolo, P, Heinonen, M, et al.
Prediction and impact of personalized donation intervals.
Vox Sang. 2021; 1 – 9.

Running the container

Running from browser

You can run the final image using

docker container run -it --rm -p 127.0.0.1:8080:8080 toivoja/hb-predictor

Then go to the following address in the browser:

http://localhost:8080/hb-predictor

Kill the server (and the server) by pressing control-c.

For further instructions, see the usage page.

Running from command line

The option to do the analyses from command line are not currently supported anymore.

Creating the docker image from source

You can also build the docker image from source code yourself. One can compose a new docker image from several docker images building on top of each other. Building images in this layered fashion eases the development. There exists a ready-made docker image containing a recent base version of R called rocker/r-ubuntu.

Using command

docker build -f Dockerfile-r-base-tidyverse -t toivoja/r-base-tidyverse .

we build an intermediate image that adds many additional packages to the above image. Some R packages are also installed from sources. These packages are listed in file src/docker-install-packages2.R. This second phase takes about 40 minutes on my machine.

The third docker image adds our web application built with the Plumber library. Use command

docker build -f Dockerfile -t toivoja/hb-predictor .

to build it. This phase is very quick (currently 3 minutes 14 seconds), which makes it easy to test changes to the script. You can list the docker images on this machine using the command docker images

Exporting or importing a container to or from a file

The docker images are normally stored somewhere on the file system or on docker hub in an unspecified form. You can however export a docker image into a single tar file with

docker save toivoja/hb-predictor > hb-predictor.tar

Importing an image from a tar file is done by

docker load -i hb-predictor.tar

References