From c3f5308254ac0777acfd7d081ef04fae92f53ebf Mon Sep 17 00:00:00 2001 From: Pablo Riesgo Ferreiro Date: Mon, 8 Nov 2021 21:40:52 +0100 Subject: [PATCH] define conda dependencies at process level --- Dockerfile | 13 ------------- environment.yml | 11 ----------- modules/bwa_aln.nf | 9 +++++++++ modules/bwa_mem.nf | 5 +++++ modules/fastp.nf | 6 ++++++ nextflow.config | 5 +++-- 6 files changed, 23 insertions(+), 26 deletions(-) delete mode 100644 Dockerfile delete mode 100644 environment.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e14b36c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM nfcore/base:1.9 -LABEL authors="Pablo Riesgo Ferreiro" \ - description="Docker image containing all software requirements for the TRON-bioinformatics/tron-bwa pipeline" - -# Install the conda environment -COPY environment.yml / -RUN conda env create -f /environment.yml && conda clean -a - -# Add conda installation dir to PATH (instead of doing 'conda activate') -ENV PATH /opt/conda/envs/tronflow-bwa-1.1.0/bin:$PATH - -# Dump the details of the installed packages to a file for posterity -RUN conda env export --name tronflow-bwa-1.1.0 > tronflow-bwa-1.1.0.yml \ No newline at end of file diff --git a/environment.yml b/environment.yml deleted file mode 100644 index ef625c8..0000000 --- a/environment.yml +++ /dev/null @@ -1,11 +0,0 @@ -# You can use this file to create a conda environment for this pipeline: -# conda env create -f environment.yml -name: tronflow-bwa-1.5.0 -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - bioconda::bwa=0.7.17 - - bioconda::samtools=1.12 - - bioconda::fastp=0.20.1 \ No newline at end of file diff --git a/modules/bwa_aln.nf b/modules/bwa_aln.nf index 4779262..3ed7a27 100644 --- a/modules/bwa_aln.nf +++ b/modules/bwa_aln.nf @@ -1,6 +1,7 @@ params.cpus = 8 params.memory = "8g" params.reference = false +params.enable_conda = false process BWA_ALN { @@ -8,6 +9,8 @@ process BWA_ALN { memory "${params.memory}" tag "${name}" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: tuple val(name), file(fastq) @@ -25,6 +28,8 @@ process BWA_SAMPE { tag "${name}" publishDir params.output, mode: "move" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: // joins both channels by key using the first element in the tuple, the name tuple val(name), file(fastq1), file(sai1), file(fastq2), file(sai2) @@ -43,6 +48,8 @@ process BWA_SAMSE { tag "${name}" publishDir params.output, mode: "move" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: // joins both channels by key using the first element in the tuple, the name tuple val(name), file(fastq), file(sai) @@ -61,6 +68,8 @@ process BWA_ALN_INCEPTION { tag "${name}" publishDir params.output, mode: "move" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: // joins both channels by key using the first element in the tuple, the name tuple val(name), file(fastq1), file(fastq2) diff --git a/modules/bwa_mem.nf b/modules/bwa_mem.nf index 2989410..d20c165 100644 --- a/modules/bwa_mem.nf +++ b/modules/bwa_mem.nf @@ -1,6 +1,7 @@ params.cpus = 8 params.memory = "8g" params.reference = false +params.enable_conda = false process BWA_MEM { @@ -9,6 +10,8 @@ process BWA_MEM { tag "${name}" publishDir params.output, mode: "move" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: // joins both channels by key using the first element in the tuple, the name tuple val(name), file(fastq1), file(fastq2) @@ -27,6 +30,8 @@ process BWA_MEM_SE { tag "${name}" publishDir params.output, mode: "move" + conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.12" : null) + input: // joins both channels by key using the first element in the tuple, the name tuple val(name), file(fastq) diff --git a/modules/fastp.nf b/modules/fastp.nf index aff12e8..49e05ec 100644 --- a/modules/fastp.nf +++ b/modules/fastp.nf @@ -1,6 +1,8 @@ params.memory = "3g" params.cpus = 1 params.output = "." +params.enable_conda = false +params.enable_docker = true process FASTP_PAIRED { @@ -8,6 +10,8 @@ process FASTP_PAIRED { memory params.memory publishDir "${params.output}", mode: "copy", pattern: "*fastp_stats*" + conda (params.enable_conda ? "bioconda::fastp=0.20.1" : null) + input: tuple val(name), file(fastq1), file(fastq2) @@ -34,6 +38,8 @@ process FASTP_SINGLE { memory params.memory publishDir "${params.output}", mode: "copy", pattern: "*fastp_stats*" + conda (params.enable_conda ? "bioconda::fastp=0.20.1" : null) + input: tuple val(name), file(fastq1) diff --git a/nextflow.config b/nextflow.config index b6ac921..1fc94a7 100644 --- a/nextflow.config +++ b/nextflow.config @@ -4,9 +4,10 @@ * ------------------------------------------------- */ - profiles { - conda { process.conda = "$baseDir/environment.yml" } + conda { + params.enable_conda = true + } debug { process.beforeScript = 'echo $HOSTNAME' } test { params.input_files = "test_data/test_input_paired.txt"