Skip to content

How to use Singularity

Alessia edited this page Jan 10, 2018 · 7 revisions

Using YAMP with Singularity is very simple, and since Singularity v2.3, it is possible to create a Singularity container from a Docker image, as explained below. However, with YAMP and Nextflow is even simpler and you will not need any Singularity container at all!

Please note that this tutorial refers to the Example we used in the How to run YAMP tutorial and that you need to have Singularity installed.

Run YAMP with Singularity

YAMP can use a Docker image with Singularity by adding the --with-singularity option followed by the image path (--with-singularity docker://alesssia/yampdocker), that is, the following command:

nextflow run YAMP.nf --reads1 R1 --reads2 R2 --prefix mysample --outdir outputdir --mode MODE --with-singularity docker://alesssia/yampdocker

where R1 and R2 represent the path to the raw data (two compressed FASTQ file), mysample is a prefix that will be used to label all the resulting files, outputdir is the directory where the results will be stored, and MODE is any of the following: < QC, characterisation, complete >.

So, to run YAMP with Singularity on the example presented in the How to run YAMP tutorial, one should run:

nextflow run YAMP.nf --reads1 ./data/ERR011089_1.fastq.gz --reads2 ./data/ERR011089_1.fastq.gz --prefix Meta_HIT_ERR011089 --outdir ./data --mode complete --with-singularity docker://alesssia/yampdocker 

Alternatively, you can set the following parameters into the nextflow.config file:

singularity.enabled = true
process.container = docker://alesssia/yampdocker

Simple, isn't it?

Pull the image

If you want to pull the Singularity image for YAMP, you can use the following command:

singularity pull docker://alesssia/yampdocker

Please note that this is not necessary when running YAMP!

A word of caution

Nextflow is not included in the Docker/Singularity image and should be installed independently as explained here.

In fact, Nextflow orchestrates, in a transparent fashion, the flow of the pipeline by wrapping and executing each step using the Singularity run command. Thus, Nextflow lies outside the container, that is responsible for instantiating.

You can find more information about Singularity containers and Nextflow here.