Commit 973cd027 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add exercise for containers

parent 45438142
# Exercise: Container usage
In this exercise you will extend the given nextflow workflow `main.nf` to use
containers within the tasks instead of using the preinstalled tools. Therefore
the actual workflow will not be changed. Instead each process will be
configured seperately inside the `nextflow.config` configuration file to use a
certain container.
## Identify suitable containers for fastqc and multiqc
Check the biocontainers homepage/git repo/quay.io repository for suitable
docker images for fastqc and multiqc.
## Add the containers to the configuration
A process can be configured inside the process configuration scope. You can
select a certain process with the withName selector. Configure both processes
to use the containers you identified in the previous section.
~~~~
process {
withName:<processname> {
container = '<containername>'
}
}
~~~~
## Configure to use docker
Activate docker by adding the following to your config.
~~~~
docker {
enabled = true
}
~~~~
Start the workflow. In the background the docker images will be downloaded. As
soon as they are there, the analysis will run inside docker containers.
## Configure to use singularity
Singularity is another container technology that is popular in the HPC
community as it has no problems with privilege escalation. It has an own image
format, but can also use docker images.
Deactivate docker. Either delete it or set the enabled option to false.
Add the following snippet to your config file for singularity support:
~~~~
singularity {
enabled = true
}
~~~~
Start the workflow. The images will be downloaded for singularity and the
analysis will be executed inside the singularity containers.
params.input = 'data/*.fastq.gz'
params.output = 'results'
Channel.fromPath('data/*.fastq.gz').set{ch_fastqs}
process fastqc {
publishDir results + '/fastqc', mode: 'copy'
input:
file f from ch_fastqs
output:
file '*.zip' into ch_fastqc_reports
script:
"""
fastqc $f
"""
}
process multiqc {
publishDir results + '/multiqc', mode: 'copy'
input:
file fastqc_zips from ch_fastqc_reports.collect()
output:
file '*.html' into ch_multiqc_reports
script:
"""
multiqc .
"""
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment