Nextflow and Seqera Containers
You can provision containers that include conda packages through Seqera Containers and use them directly in your Nextflow pipelines.
Prerequisites
- You have either Docker Desktop or Podman installed locally.
- You have Nextflow 23.10.x or newer installed locally.
- Use Singularity 4.x or newer to run the Singularity containers.
In this guide, you'll request a containerized Conda package from Seqera Containers.
Request a conda package as a Seqera Container
- Open Seqera Containers in a browser.
- In the search box, enter
samtools
. - In the search results, select Add in the
bioconda::samtools
result, and then Get Container to initiate the container build. - From the Fetching container modal, copy the the durable container image URI that Seqera Containers provides.
- Optional: Select View build details to watch Seqera Containers build the requested container in real time.
Create a Nextflow pipeline that uses the container
Nextflow can use the container that Seqera Containers built in the previous section. Use the container URI from Seqera Containers in the container
directive.
-
In a terminal window, create a new directory for the Nextflow pipeline.
-
Create a
nextflow.config
file with the following contents:docker {
enabled = true
} -
Create a
main.nf
file with the following contents:process SAMTOOLS {
container '<container_uri>'
debug true
"""
samtools --version-only
"""
}
workflow {
SAMTOOLS()
}Substitute
<container_uri>
for the container URI that you received from Seqera Containers in the previous section. e.g.community.wave.seqera.io/library/samtools:1.20--b5dfbd93de237464
for linux/amd64.community.wave.seqera.io/library/samtools:1.20--497854c5df637867
for linux/arm64.
Run the Nextflow pipeline
To confirm that the samtools
command is available from your pipeline, run the following command:
nextflow run main.nf
The output from a successful execution is displayed in the following example:
N E X T F L O W ~ version 24.04.4
Launching `samtools.nf` [furious_carlsson] DSL2 - revision: 04817f962f
executor > local (1)
[2f/d2ccc7] process > SAMTOOLS [100%] 1 of 1 ✔
1.20+htslib-1.20