-
Laurent Modolo authoredLaurent Modolo authored
title: "TP for computational biologists"
author: Laurent Modolo [laurent.modolo@ens-lyon.fr](mailto:laurent.modolo@ens-lyon.fr)
date: 20 Jun 2018
output:
pdf_document:
toc: true
toc_depth: 3
number_sections: true
highlight: tango
latex_engine: xelatex
The goal of this practical is to learn how to wrap tools in Docker or Environment Module to make them available to nextflow on a personal computer or at the PSMN.
Here we assume that you followed the TP for experimental biologists, and that you know the basics of Docker containers and Environment Module. We are also going to assume that you know how to build and use a nextflow pipeline from the template pipelines/nextflow.
For the practical you can either work with the WebIDE of Gitlab, or locally as described in the git: basis formation.
Docker
To run a tool within a Docker container you need to write a Dockerfile
.
Dockerfile
are found in the pipelines/nextflow project under src/docker_modules/
. Each Dockerfile
is paired with a docker_init.sh
file like following the example for Kallisto
version 0.43.1
:
$ ls -l src/docker_modules/kallisto/0.43.1/
total 16K
drwxr-xr-x 2 laurent users 4.0K Jun 5 19:06 ./
drwxr-xr-x 3 laurent users 4.0K Jun 6 09:49 ../
-rw-r--r-- 1 laurent users 587 Jun 5 19:06 Dockerfile
-rwxr-xr-x 1 laurent users 79 Jun 5 19:06 docker_init.sh*
docker_init.sh
The docker_init.sh
is a simple sh script with executable rights (chmod +x
). By executing this script, the user creates a Docker container with the tool installed a specific version. You can check the docker_init.sh
file of any implemented tools as a template.
Remember that the name of the container must be in lower case and in the format <tool_name>:<version>
.
For tools without a version number you can use a commit hash instead.
Dockerfile
The recipe to wrap your tool in a Docker container is written in a Dockerfile
file.
For Kallisto
version 0.44.0
the header of the Dockerfile
is :
FROM ubuntu:18.04
MAINTAINER Laurent Modolo
ENV KALLISTO_VERSION=0.44.0
The FROM
instruction means that the container is initialized from a bare installation of Ubuntu 18.04. You can check the versions of Ubuntu available here or others operating systems like debian or worst.
Then we declare the maintainer of the container. Before declaring an environment variable for the container named KALLISTO_VERSION
, which contains the version of the tool wrapped. This this bash variable will be declared for the user root within the container.
You should always declare a variable TOOLSNAME_VERSION
that contains the version number of commit number of the tools you wrap. In simple cases you just have to modify this line to create a new Dockerfile
for another version of the tool.
The following lines of the Dockerfile
are a succession of bash
commands executed as the root user within the container.
Each RUN
block is run sequentially by Docker
. If there is an error or modifications in a RUN
block, only this block and the following RUN
will be executed.
You can learn more about the building of Docker containers here.