Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-core/dragmap/align/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
channels:
- conda-forge
- bioconda

dependencies:
# WARN: Do not update this file to use 1.3.0 cf https://github.com/Illumina/DRAGMAP/issues/47
- dragmap=1.3.0
- pigz=2.8
- samtools=1.18
62 changes: 34 additions & 28 deletions modules/nf-core/dragmap/align/main.nf
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
process DRAGMAP_ALIGN {
tag "$meta.id"
tag "${meta.id}"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0':
'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0' }"
// WARN: Do not update this file to use 1.3.0 cf https://github.com/Illumina/DRAGMAP/issues/47
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0'
: 'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0'}"

input:
tuple val(meta) , path(reads)
tuple val(meta), path(reads)
tuple val(meta2), path(hashmap)
tuple val(meta3), path(fasta)
val sort_bam
val sort_bam

output:
tuple val(meta), path("*.sam") , emit: sam , optional: true
tuple val(meta), path("*.bam") , emit: bam , optional: true
tuple val(meta), path("*.cram") , emit: cram , optional: true
tuple val(meta), path("*.crai") , emit: crai , optional: true
tuple val(meta), path("*.csi") , emit: csi , optional: true
tuple val(meta), path('*.log') , emit: log
path "versions.yml" , emit: versions
tuple val(meta), path("*.sam"), emit: sam, optional: true
tuple val(meta), path("*.bam"), emit: bam, optional: true
tuple val(meta), path("*.cram"), emit: cram, optional: true
tuple val(meta), path("*.crai"), emit: crai, optional: true
tuple val(meta), path("*.csi"), emit: csi, optional: true
tuple val(meta), path('*.log'), emit: log
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -29,22 +30,24 @@ process DRAGMAP_ALIGN {
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def reads_command = meta.single_end ? "-1 $reads" : "-1 ${reads[0]} -2 ${reads[1]}"
def samtools_command = sort_bam ? 'sort' : 'view'
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
def extension_matcher = (args2 =~ extension_pattern)
def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam"
def reference = fasta && extension=="cram" ? "--reference ${fasta}" : ""
if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output"
def reads_command = meta.single_end ? "-1 ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}"
def samtools_command = sort_bam ? 'sort' : 'view'
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
def extension_matcher = (args2 =~ extension_pattern)
def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam"
def reference = fasta && extension == "cram" ? "--reference ${fasta}" : ""
if (!fasta && extension == "cram") {
error("Fasta reference is required for CRAM output")
}

"""
dragen-os \\
-r $hashmap \\
$args \\
--num-threads $task.cpus \\
$reads_command \\
-r ${hashmap} \\
${args} \\
--num-threads ${task.cpus} \\
${reads_command} \\
2> >(tee ${prefix}.dragmap.log >&2) \\
| samtools $samtools_command $args2 --threads $task.cpus ${reference} -o ${prefix}.${extension} -
| samtools ${samtools_command} ${args2} --threads ${task.cpus} ${reference} -o ${prefix}.${extension} -

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -58,14 +61,17 @@ process DRAGMAP_ALIGN {
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
def extension_matcher = (args2 =~ extension_pattern)
def extension_matcher = (args2 =~ extension_pattern)
def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam"
if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output"
if (!fasta && extension == "cram") {
error("Fasta reference is required for CRAM output")
}

def create_index = ""
if (extension == "cram") {
create_index = "touch ${prefix}.crai"
} else if (extension == "bam") {
}
else if (extension == "bam") {
create_index = "touch ${prefix}.csi"
}

Expand Down
32 changes: 16 additions & 16 deletions modules/nf-core/dragmap/align/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") },
file(process.out.versions[0]).name
path(process.out.versions[0]).yaml
).match() }
)
}
Expand Down Expand Up @@ -83,12 +83,13 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") },
file(process.out.versions[0]).name
path(process.out.versions[0]).yaml

).match() }
)
}
Expand Down Expand Up @@ -129,12 +130,13 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") },
file(process.out.versions[0]).name
path(process.out.versions[0]).yaml

).match() }
)
}
Expand Down Expand Up @@ -175,12 +177,13 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") },
file(process.out.versions[0]).name
path(process.out.versions[0]).yaml

).match() }
)
}
Expand Down Expand Up @@ -221,12 +224,12 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") },
file(process.out.versions[0]).name
path(process.out.versions[0]).yaml
).match() }
)
}
Expand Down Expand Up @@ -268,16 +271,13 @@ nextflow_process {
}

then {
assert { process.success }
assertAll (
{ assert process.success },
{ assert snapshot(
file(process.out.bam[0][1]).name,
file(process.out.log[0][1]).name,
file(process.out.versions[0]).name
process.out,
path(process.out.versions[0]).yaml
).match() }
)
}

}

}
Loading
Loading