diff --git a/modules/nf-core/trimgalore/main.nf b/modules/nf-core/trimgalore/main.nf index fcd09efa7ab..cd5fb97fd4d 100644 --- a/modules/nf-core/trimgalore/main.nf +++ b/modules/nf-core/trimgalore/main.nf @@ -1,22 +1,22 @@ process TRIMGALORE { - tag "$meta.id" + tag "${meta.id}" label 'process_high' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/9b/9becad054093ad4083a961d12733f2a742e11728fe9aa815d678b882b3ede520/data' : - 'community.wave.seqera.io/library/cutadapt_trim-galore_pigz:a98edd405b34582d' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/9b/9becad054093ad4083a961d12733f2a742e11728fe9aa815d678b882b3ede520/data' + : 'community.wave.seqera.io/library/cutadapt_trim-galore_pigz:a98edd405b34582d'}" input: tuple val(meta), path(reads) output: tuple val(meta), path("*{3prime,5prime,trimmed,val}*.fq.gz"), emit: reads - tuple val(meta), path("*report.txt") , emit: log , optional: true - tuple val(meta), path("*unpaired*.fq.gz") , emit: unpaired, optional: true - tuple val(meta), path("*.html") , emit: html , optional: true - tuple val(meta), path("*.zip") , emit: zip , optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*report.txt"), emit: log, optional: true + tuple val(meta), path("*unpaired*.fq.gz"), emit: unpaired, optional: true + tuple val(meta), path("*.html"), emit: html, optional: true + tuple val(meta), path("*.zip"), emit: zip, optional: true + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when @@ -29,9 +29,15 @@ process TRIMGALORE { def cores = 1 if (task.cpus) { cores = (task.cpus as int) - 4 - if (meta.single_end) cores = (task.cpus as int) - 3 - if (cores < 1) cores = 1 - if (cores > 8) cores = 8 + if (meta.single_end) { + cores = (task.cpus as int) - 3 + } + if (cores < 1) { + cores = 1 + } + if (cores > 8) { + cores = 8 + } } // Added soft-links to original fastqs for consistent naming in MultiQC @@ -40,10 +46,10 @@ process TRIMGALORE { def args_list = args.split("\\s(?=--)").toList() args_list.removeAll { it.toLowerCase().contains('_r2 ') } """ - [ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz + [ ! -f ${prefix}.fastq.gz ] && ln -s ${reads} ${prefix}.fastq.gz trim_galore \\ ${args_list.join(' ')} \\ - --cores $cores \\ + --cores ${cores} \\ --gzip \\ ${prefix}.fastq.gz @@ -53,13 +59,14 @@ process TRIMGALORE { cutadapt: \$(cutadapt --version) END_VERSIONS """ - } else { + } + else { """ [ ! -f ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz [ ! -f ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz trim_galore \\ - $args \\ - --cores $cores \\ + ${args} \\ + --cores ${cores} \\ --paired \\ --gzip \\ ${prefix}_1.fastq.gz \\ @@ -78,7 +85,8 @@ process TRIMGALORE { if (meta.single_end) { output_command = "echo '' | gzip > ${prefix}_trimmed.fq.gz ;" output_command += "touch ${prefix}.fastq.gz_trimming_report.txt" - } else { + } + else { output_command = "echo '' | gzip > ${prefix}_1_trimmed.fq.gz ;" output_command += "touch ${prefix}_1.fastq.gz_trimming_report.txt ;" output_command += "echo '' | gzip > ${prefix}_2_trimmed.fq.gz ;"