diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 0a9285893f73..9cafbfd2a21b 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -29,6 +29,7 @@ process BOWTIE_ALIGN { tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq script: + def split_cpus = Math.floor(task.cpus/2) def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped.fastq" : '' @@ -36,7 +37,7 @@ process BOWTIE_ALIGN { """ INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'` bowtie \\ - --threads $task.cpus \\ + --threads ${split_cpus} \\ --sam \\ -x \$INDEX \\ -q \\ @@ -44,7 +45,7 @@ process BOWTIE_ALIGN { $options.args \\ $endedness \\ 2> ${prefix}.out \\ - | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - + | samtools view $options.args2 -@ ${split_cpus} -bS -o ${prefix}.bam - if [ -f ${prefix}.unmapped.fastq ]; then gzip ${prefix}.unmapped.fastq diff --git a/software/bowtie2/align/main.nf b/software/bowtie2/align/main.nf index 1ac8e973b4af..d43d479d065c 100644 --- a/software/bowtie2/align/main.nf +++ b/software/bowtie2/align/main.nf @@ -29,8 +29,9 @@ process BOWTIE2_ALIGN { tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + def split_cpus = Math.floor(task.cpus/2) + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" if (meta.single_end) { def unaligned = params.save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : '' """ @@ -38,11 +39,11 @@ process BOWTIE2_ALIGN { bowtie2 \\ -x \$INDEX \\ -U $reads \\ - --threads $task.cpus \\ + --threads ${split_cpus} \\ $unaligned \\ $options.args \\ 2> ${prefix}.bowtie2.log \\ - | samtools view -@ $task.cpus $options.args2 -bhS -o ${prefix}.bam - + | samtools view -@ ${split_cpus} $options.args2 -bhS -o ${prefix}.bam - echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//' > ${software}.version.txt """ @@ -54,11 +55,11 @@ process BOWTIE2_ALIGN { -x \$INDEX \\ -1 ${reads[0]} \\ -2 ${reads[1]} \\ - --threads $task.cpus \\ + --threads ${split_cpus} \\ $unaligned \\ $options.args \\ 2> ${prefix}.bowtie2.log \\ - | samtools view -@ $task.cpus $options.args2 -bhS -o ${prefix}.bam - + | samtools view -@ ${split_cpus} $options.args2 -bhS -o ${prefix}.bam - if [ -f ${prefix}.unmapped.fastq.1.gz ]; then mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz diff --git a/software/bwa/mem/main.nf b/software/bwa/mem/main.nf index c4e233bee631..5e139d5a008a 100644 --- a/software/bwa/mem/main.nf +++ b/software/bwa/mem/main.nf @@ -27,6 +27,7 @@ process BWA_MEM { path "*.version.txt" , emit: version script: + def split_cpus = Math.floor(task.cpus/2) def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def read_group = meta.read_group ? "-R ${meta.read_group}" : "" @@ -36,10 +37,10 @@ process BWA_MEM { bwa mem \\ $options.args \\ $read_group \\ - -t $task.cpus \\ + -t ${split_cpus} \\ \$INDEX \\ $reads \\ - | samtools view $options.args2 -@ $task.cpus -bhS -o ${prefix}.bam - + | samtools view $options.args2 -@ ${split_cpus} -bhS -o ${prefix}.bam - echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt """ diff --git a/software/bwamem2/mem/main.nf b/software/bwamem2/mem/main.nf index eab670120c1a..5d0ff6171bd4 100644 --- a/software/bwamem2/mem/main.nf +++ b/software/bwamem2/mem/main.nf @@ -27,6 +27,7 @@ process BWAMEM2_MEM { path "*.version.txt" , emit: version script: + def split_cpus = Math.floor(task.cpus/2) def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def read_group = meta.read_group ? "-R ${meta.read_group}" : "" @@ -36,10 +37,10 @@ process BWAMEM2_MEM { bwa-mem2 mem \\ $options.args \\ $read_group \\ - -t $task.cpus \\ + -t ${split_cpus} \\ \$INDEX \\ $reads \\ - | samtools view $options.args2 -@ $task.cpus -bhS -o ${prefix}.bam - + | samtools view $options.args2 -@ ${split_cpus} -bhS -o ${prefix}.bam - echo \$(bwa-mem2 version 2>&1) > ${software}.version.txt """ diff --git a/software/bwameth/align/main.nf b/software/bwameth/align/main.nf index bdf75dd518c9..0e8db58f1587 100644 --- a/software/bwameth/align/main.nf +++ b/software/bwameth/align/main.nf @@ -27,6 +27,7 @@ process BWAMETH_ALIGN { path "*.version.txt" , emit: version script: + def split_cpus = Math.floor(task.cpus/2) def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def read_group = meta.read_group ? "-R ${meta.read_group}" : "" @@ -36,10 +37,10 @@ process BWAMETH_ALIGN { bwameth.py \\ $options.args \\ $read_group \\ - -t $task.cpus \\ + -t ${split_cpus} \\ --reference \$INDEX \\ $reads \\ - | samtools view $options.args2 -@ $task.cpus -bhS -o ${prefix}.bam - + | samtools view $options.args2 -@ ${split_cpus} -bhS -o ${prefix}.bam - echo \$(bwameth.py --version 2>&1) | cut -f2 -d" " > ${software}.version.txt """ diff --git a/tests/software/bwa/mem/test.yml b/tests/software/bwa/mem/test.yml index 1b36eea7f5d3..5be352badd1f 100644 --- a/tests/software/bwa/mem/test.yml +++ b/tests/software/bwa/mem/test.yml @@ -5,7 +5,6 @@ - bwa/mem files: - path: ./output/bwa/test.bam - md5sum: 9165508bf914baee0e6347711aa7b23a - path: ./output/index/bwa/genome.bwt md5sum: 0469c30a1e239dd08f68afe66fde99da - path: ./output/index/bwa/genome.amb @@ -24,7 +23,6 @@ - bwa/mem files: - path: ./output/bwa/test.bam - md5sum: 670a53bddee62d6bd14ed7adaf103e7c - path: ./output/index/bwa/genome.bwt md5sum: 0469c30a1e239dd08f68afe66fde99da - path: ./output/index/bwa/genome.amb diff --git a/tests/software/bwamem2/mem/test.yml b/tests/software/bwamem2/mem/test.yml index 00cb98fdc5b4..d624ca0d4e8d 100644 --- a/tests/software/bwamem2/mem/test.yml +++ b/tests/software/bwamem2/mem/test.yml @@ -5,7 +5,6 @@ - bwamem2/mem files: - path: ./output/bwamem2/test.bam - md5sum: 2133c011119ea11f06f0a9b1621ba05b - path: ./output/index/bwamem2/genome.fasta.amb md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e - path: ./output/index/bwamem2/genome.fasta.pac @@ -24,7 +23,6 @@ - bwamem2/mem files: - path: ./output/bwamem2/test.bam - md5sum: d8fadab5cef04faff1851a8162fc30b5 - path: ./output/index/bwamem2/genome.fasta.amb md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e - path: ./output/index/bwamem2/genome.fasta.pac