Skip to content

liacs-EDA/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.

Running from command line

Note, this section contains obsolete information! The option to do the analyses from command line are not currently supported. Use the browser user interface instead.

docker container run -i --rm -v /whicheverfolderinputisin:/input toivoja/hb-predictor src/hb-predictor.sh date=2020-07-15 gender=female sample_fraction=0.002 method=icp-fix hlen=1 input_file=/input/inputfilename.rdata

Options:

  • gender is either 'male', 'female', or 'both'
  • method is either 'no-fix', 'icp-fix', or 'both'
  • The input file can be specified with input_file option

The results will be stored to file results.tar.gz.

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

About

Hemoglobin predictor wrapped in a Docker container

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 89.8%
  • R 8.8%
  • JavaScript 0.5%
  • Stan 0.5%
  • C++ 0.2%
  • CSS 0.1%
  • Other 0.1%