feat: update dragmap to follow new bwa/mem + bwamem2/mem logic (#1146)

This commit is contained in:
Maxime U. Garcia 2021-12-08 23:19:37 +01:00 committed by GitHub
parent 1765225042
commit ca3ae9ff4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 7 deletions

View file

@ -10,6 +10,7 @@ process DRAGMAP_ALIGN {
input:
tuple val(meta), path(reads)
path hashmap
val sort_bam
output:
tuple val(meta), path("*.bam"), emit: bam
@ -20,6 +21,7 @@ process DRAGMAP_ALIGN {
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def samtools_command = sort_bam ? 'sort' : 'view'
if (meta.single_end) {
"""
dragen-os \\
@ -28,7 +30,7 @@ process DRAGMAP_ALIGN {
--num-threads $task.cpus \\
$args \\
2> ${prefix}.dragmap.log \\
| samtools view -@ $task.cpus $args2 -bhS -o ${prefix}.bam -
| samtools $samtools_command -@ $task.cpus $args2 -o ${prefix}.bam -
cat <<-END_VERSIONS > versions.yml
"${task.process}":
@ -46,7 +48,7 @@ process DRAGMAP_ALIGN {
--num-threads $task.cpus \\
$args \\
2> ${prefix}.dragmap.log \\
| samtools view -@ $task.cpus $args2 -bhS -o ${prefix}.bam -
| samtools $samtools_command -@ $task.cpus $args2 -o ${prefix}.bam -
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -3,7 +3,7 @@
nextflow.enable.dsl = 2
include { DRAGMAP_HASHTABLE } from '../../../../modules/dragmap/hashtable/main.nf'
include { DRAGMAP_ALIGN } from '../../../../modules/dragmap/align/main.nf'
include { DRAGMAP_ALIGN } from '../../../../modules/dragmap/align/main.nf'
workflow test_dragmap_align_single_end {
input = [
@ -15,7 +15,20 @@ workflow test_dragmap_align_single_end {
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
DRAGMAP_HASHTABLE ( fasta )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap, false )
}
workflow test_dragmap_align_single_end_sort {
input = [
[ id:'test', single_end:true ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
DRAGMAP_HASHTABLE ( fasta )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap, true )
}
workflow test_dragmap_align_paired_end {
@ -29,5 +42,19 @@ workflow test_dragmap_align_paired_end {
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
DRAGMAP_HASHTABLE ( fasta )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap, false )
}
workflow test_dragmap_align_paired_end_sort {
input = [
[ id:'test', single_end:false ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)
]
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
DRAGMAP_HASHTABLE ( fasta )
DRAGMAP_ALIGN ( input, DRAGMAP_HASHTABLE.out.hashmap, true )
}

View file

@ -1,5 +1,9 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
withName: DRAGMAP_ALIGN {
ext.args2 = { sort_bam ? "" : "-bh" }
}
}

View file

@ -7,6 +7,15 @@
- path: output/dragmap/test.bam
- path: output/dragmap/test.dragmap.log
- name: dragmap align single-end_sort
command: nextflow run ./tests/modules/dragmap/align -entry test_dragmap_align_single_end_sort -c ./tests/config/nextflow.config -c ./tests/modules/dragmap/align/nextflow.config
tags:
- dragmap
- dragmap/align
files:
- path: output/dragmap/test.bam
- path: output/dragmap/test.dragmap.log
- name: dragmap align paired-end
command: nextflow run ./tests/modules/dragmap/align -entry test_dragmap_align_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/dragmap/align/nextflow.config
tags:
@ -15,3 +24,12 @@
files:
- path: output/dragmap/test.bam
- path: output/dragmap/test.dragmap.log
- name: dragmap align paired-end_sort
command: nextflow run ./tests/modules/dragmap/align -entry test_dragmap_align_paired_end_sort -c ./tests/config/nextflow.config -c ./tests/modules/dragmap/align/nextflow.config
tags:
- dragmap
- dragmap/align
files:
- path: output/dragmap/test.bam
- path: output/dragmap/test.dragmap.log