From f524d06450ecc7f87b201329bf314de43d3d80f0 Mon Sep 17 00:00:00 2001 From: MaxUlysse Date: Thu, 20 Jan 2022 16:02:32 +0100 Subject: [PATCH 1/2] feat: remove hacky INDEX --- modules/bwa/index/main.nf | 4 ++-- modules/bwa/mem/main.nf | 6 ++---- modules/bwamem2/index/main.nf | 7 ++++--- modules/bwamem2/mem/main.nf | 6 ++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/modules/bwa/index/main.nf b/modules/bwa/index/main.nf index 89102737787..ea3ee699c66 100644 --- a/modules/bwa/index/main.nf +++ b/modules/bwa/index/main.nf @@ -11,8 +11,8 @@ process BWA_INDEX { path fasta output: - path "bwa" , emit: index - path "versions.yml", emit: versions + tuple val("bwa/${fasta.baseName}"), path ("bwa") , emit: index + path "versions.yml" , emit: versions script: def args = task.ext.args ?: '' diff --git a/modules/bwa/mem/main.nf b/modules/bwa/mem/main.nf index 9695bd2dca1..17cf890d0f9 100644 --- a/modules/bwa/mem/main.nf +++ b/modules/bwa/mem/main.nf @@ -9,7 +9,7 @@ process BWA_MEM { input: tuple val(meta), path(reads) - path index + tuple val(index_path), path(index) val sort_bam output: @@ -23,13 +23,11 @@ process BWA_MEM { def read_group = meta.read_group ? "-R ${meta.read_group}" : "" def samtools_command = sort_bam ? 'sort' : 'view' """ - INDEX=`find -L ./ -name "*.amb" | sed 's/.amb//'` - bwa mem \\ $args \\ $read_group \\ -t $task.cpus \\ - \$INDEX \\ + $index_path \\ $reads \\ | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam - diff --git a/modules/bwamem2/index/main.nf b/modules/bwamem2/index/main.nf index e00538c919f..ca85d45dc12 100644 --- a/modules/bwamem2/index/main.nf +++ b/modules/bwamem2/index/main.nf @@ -11,8 +11,8 @@ process BWAMEM2_INDEX { path fasta output: - path "bwamem2" , emit: index - path "versions.yml" , emit: versions + tuple val("bwamem2/${fasta}"), path("bwamem2"), emit: index + path "versions.yml" , emit: versions script: def args = task.ext.args ?: '' @@ -21,7 +21,8 @@ process BWAMEM2_INDEX { bwa-mem2 \\ index \\ $args \\ - $fasta -p bwamem2/${fasta} + -p bwamem2/${fasta} \\ + $fasta cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/bwamem2/mem/main.nf b/modules/bwamem2/mem/main.nf index 6d4d8028edc..86aae1f1bd6 100644 --- a/modules/bwamem2/mem/main.nf +++ b/modules/bwamem2/mem/main.nf @@ -9,7 +9,7 @@ process BWAMEM2_MEM { input: tuple val(meta), path(reads) - path index + tuple val(index_path), path(index) val sort_bam output: @@ -23,14 +23,12 @@ process BWAMEM2_MEM { def read_group = meta.read_group ? "-R ${meta.read_group}" : "" def samtools_command = sort_bam ? 'sort' : 'view' """ - INDEX=`find -L ./ -name "*.amb" | sed 's/.amb//'` - bwa-mem2 \\ mem \\ $args \\ $read_group \\ -t $task.cpus \\ - \$INDEX \\ + $index_path \\ $reads \\ | samtools $samtools_command $args2 -@ $task.cpus -o ${prefix}.bam - From 631635734e4777a452ad0306ff932c703f669269 Mon Sep 17 00:00:00 2001 From: MaxUlysse Date: Thu, 20 Jan 2022 16:14:29 +0100 Subject: [PATCH 2/2] feat: even better --- modules/bwa/index/main.nf | 4 ++-- modules/bwa/mem/main.nf | 4 ++-- modules/bwamem2/index/main.nf | 4 ++-- modules/bwamem2/mem/main.nf | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/bwa/index/main.nf b/modules/bwa/index/main.nf index ea3ee699c66..55d7b37f829 100644 --- a/modules/bwa/index/main.nf +++ b/modules/bwa/index/main.nf @@ -11,8 +11,8 @@ process BWA_INDEX { path fasta output: - tuple val("bwa/${fasta.baseName}"), path ("bwa") , emit: index - path "versions.yml" , emit: versions + path "bwa/*" , emit: index + path "versions.yml", emit: versions script: def args = task.ext.args ?: '' diff --git a/modules/bwa/mem/main.nf b/modules/bwa/mem/main.nf index 17cf890d0f9..0fed628c4cd 100644 --- a/modules/bwa/mem/main.nf +++ b/modules/bwa/mem/main.nf @@ -9,7 +9,7 @@ process BWA_MEM { input: tuple val(meta), path(reads) - tuple val(index_path), path(index) + path index val sort_bam output: @@ -27,7 +27,7 @@ process BWA_MEM { $args \\ $read_group \\ -t $task.cpus \\ - $index_path \\ + ${index[0].baseName} \\ $reads \\ | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam - diff --git a/modules/bwamem2/index/main.nf b/modules/bwamem2/index/main.nf index ca85d45dc12..39f8b28e1e6 100644 --- a/modules/bwamem2/index/main.nf +++ b/modules/bwamem2/index/main.nf @@ -11,8 +11,8 @@ process BWAMEM2_INDEX { path fasta output: - tuple val("bwamem2/${fasta}"), path("bwamem2"), emit: index - path "versions.yml" , emit: versions + path "bwamem2/*" , emit: index + path "versions.yml", emit: versions script: def args = task.ext.args ?: '' diff --git a/modules/bwamem2/mem/main.nf b/modules/bwamem2/mem/main.nf index 86aae1f1bd6..46722ae07c6 100644 --- a/modules/bwamem2/mem/main.nf +++ b/modules/bwamem2/mem/main.nf @@ -9,7 +9,7 @@ process BWAMEM2_MEM { input: tuple val(meta), path(reads) - tuple val(index_path), path(index) + path index val sort_bam output: @@ -28,7 +28,7 @@ process BWAMEM2_MEM { $args \\ $read_group \\ -t $task.cpus \\ - $index_path \\ + ${index[0].baseName} \\ $reads \\ | samtools $samtools_command $args2 -@ $task.cpus -o ${prefix}.bam -