Skip to content

Commit

Permalink
feat: remove hacky INDEX
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Jan 20, 2022
1 parent 37c5cb4 commit f524d06
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions modules/bwa/index/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?: ''
Expand Down
6 changes: 2 additions & 4 deletions modules/bwa/mem/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 -
Expand Down
7 changes: 4 additions & 3 deletions modules/bwamem2/index/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?: ''
Expand All @@ -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}":
Expand Down
6 changes: 2 additions & 4 deletions modules/bwamem2/mem/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 -
Expand Down

0 comments on commit f524d06

Please sign in to comment.