mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-14 05:43:08 +00:00
Fix number of cpus for modules with piped tools (#499)
* Split CPUs for piped commands * Fix tests, bams no md5 check
This commit is contained in:
parent
95e02f913f
commit
0bbd7acfc4
7 changed files with 19 additions and 18 deletions
|
@ -29,6 +29,7 @@ process BOWTIE_ALIGN {
|
||||||
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
|
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
def split_cpus = Math.floor(task.cpus/2)
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped.fastq" : ''
|
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//'`
|
INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'`
|
||||||
bowtie \\
|
bowtie \\
|
||||||
--threads $task.cpus \\
|
--threads ${split_cpus} \\
|
||||||
--sam \\
|
--sam \\
|
||||||
-x \$INDEX \\
|
-x \$INDEX \\
|
||||||
-q \\
|
-q \\
|
||||||
|
@ -44,7 +45,7 @@ process BOWTIE_ALIGN {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$endedness \\
|
$endedness \\
|
||||||
2> ${prefix}.out \\
|
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
|
if [ -f ${prefix}.unmapped.fastq ]; then
|
||||||
gzip ${prefix}.unmapped.fastq
|
gzip ${prefix}.unmapped.fastq
|
||||||
|
|
|
@ -29,6 +29,7 @@ process BOWTIE2_ALIGN {
|
||||||
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
|
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
def split_cpus = Math.floor(task.cpus/2)
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
if (meta.single_end) {
|
if (meta.single_end) {
|
||||||
|
@ -38,11 +39,11 @@ process BOWTIE2_ALIGN {
|
||||||
bowtie2 \\
|
bowtie2 \\
|
||||||
-x \$INDEX \\
|
-x \$INDEX \\
|
||||||
-U $reads \\
|
-U $reads \\
|
||||||
--threads $task.cpus \\
|
--threads ${split_cpus} \\
|
||||||
$unaligned \\
|
$unaligned \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
2> ${prefix}.bowtie2.log \\
|
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
|
echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//' > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
|
@ -54,11 +55,11 @@ process BOWTIE2_ALIGN {
|
||||||
-x \$INDEX \\
|
-x \$INDEX \\
|
||||||
-1 ${reads[0]} \\
|
-1 ${reads[0]} \\
|
||||||
-2 ${reads[1]} \\
|
-2 ${reads[1]} \\
|
||||||
--threads $task.cpus \\
|
--threads ${split_cpus} \\
|
||||||
$unaligned \\
|
$unaligned \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
2> ${prefix}.bowtie2.log \\
|
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
|
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
|
||||||
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
|
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
|
||||||
|
|
|
@ -27,6 +27,7 @@ process BWA_MEM {
|
||||||
path "*.version.txt" , emit: version
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
def split_cpus = Math.floor(task.cpus/2)
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
||||||
|
@ -36,10 +37,10 @@ process BWA_MEM {
|
||||||
bwa mem \\
|
bwa mem \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$read_group \\
|
$read_group \\
|
||||||
-t $task.cpus \\
|
-t ${split_cpus} \\
|
||||||
\$INDEX \\
|
\$INDEX \\
|
||||||
$reads \\
|
$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
|
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,6 +27,7 @@ process BWAMEM2_MEM {
|
||||||
path "*.version.txt" , emit: version
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
def split_cpus = Math.floor(task.cpus/2)
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
||||||
|
@ -36,10 +37,10 @@ process BWAMEM2_MEM {
|
||||||
bwa-mem2 mem \\
|
bwa-mem2 mem \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$read_group \\
|
$read_group \\
|
||||||
-t $task.cpus \\
|
-t ${split_cpus} \\
|
||||||
\$INDEX \\
|
\$INDEX \\
|
||||||
$reads \\
|
$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
|
echo \$(bwa-mem2 version 2>&1) > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,6 +27,7 @@ process BWAMETH_ALIGN {
|
||||||
path "*.version.txt" , emit: version
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
def split_cpus = Math.floor(task.cpus/2)
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
|
||||||
|
@ -36,10 +37,10 @@ process BWAMETH_ALIGN {
|
||||||
bwameth.py \\
|
bwameth.py \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$read_group \\
|
$read_group \\
|
||||||
-t $task.cpus \\
|
-t ${split_cpus} \\
|
||||||
--reference \$INDEX \\
|
--reference \$INDEX \\
|
||||||
$reads \\
|
$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
|
echo \$(bwameth.py --version 2>&1) | cut -f2 -d" " > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
- bwa/mem
|
- bwa/mem
|
||||||
files:
|
files:
|
||||||
- path: ./output/bwa/test.bam
|
- path: ./output/bwa/test.bam
|
||||||
md5sum: 9165508bf914baee0e6347711aa7b23a
|
|
||||||
- path: ./output/index/bwa/genome.bwt
|
- path: ./output/index/bwa/genome.bwt
|
||||||
md5sum: 0469c30a1e239dd08f68afe66fde99da
|
md5sum: 0469c30a1e239dd08f68afe66fde99da
|
||||||
- path: ./output/index/bwa/genome.amb
|
- path: ./output/index/bwa/genome.amb
|
||||||
|
@ -24,7 +23,6 @@
|
||||||
- bwa/mem
|
- bwa/mem
|
||||||
files:
|
files:
|
||||||
- path: ./output/bwa/test.bam
|
- path: ./output/bwa/test.bam
|
||||||
md5sum: 670a53bddee62d6bd14ed7adaf103e7c
|
|
||||||
- path: ./output/index/bwa/genome.bwt
|
- path: ./output/index/bwa/genome.bwt
|
||||||
md5sum: 0469c30a1e239dd08f68afe66fde99da
|
md5sum: 0469c30a1e239dd08f68afe66fde99da
|
||||||
- path: ./output/index/bwa/genome.amb
|
- path: ./output/index/bwa/genome.amb
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
- bwamem2/mem
|
- bwamem2/mem
|
||||||
files:
|
files:
|
||||||
- path: ./output/bwamem2/test.bam
|
- path: ./output/bwamem2/test.bam
|
||||||
md5sum: 2133c011119ea11f06f0a9b1621ba05b
|
|
||||||
- path: ./output/index/bwamem2/genome.fasta.amb
|
- path: ./output/index/bwamem2/genome.fasta.amb
|
||||||
md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e
|
md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e
|
||||||
- path: ./output/index/bwamem2/genome.fasta.pac
|
- path: ./output/index/bwamem2/genome.fasta.pac
|
||||||
|
@ -24,7 +23,6 @@
|
||||||
- bwamem2/mem
|
- bwamem2/mem
|
||||||
files:
|
files:
|
||||||
- path: ./output/bwamem2/test.bam
|
- path: ./output/bwamem2/test.bam
|
||||||
md5sum: d8fadab5cef04faff1851a8162fc30b5
|
|
||||||
- path: ./output/index/bwamem2/genome.fasta.amb
|
- path: ./output/index/bwamem2/genome.fasta.amb
|
||||||
md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e
|
md5sum: 3a68b8b2287e07dd3f5f95f4344ba76e
|
||||||
- path: ./output/index/bwamem2/genome.fasta.pac
|
- path: ./output/index/bwamem2/genome.fasta.pac
|
||||||
|
|
Loading…
Reference in a new issue