2021-12-06 08:56:41 +00:00
|
|
|
process DRAGMAP_ALIGN {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_high'
|
|
|
|
|
2022-04-11 12:26:28 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::dragmap=1.2.1 bioconda::samtools=1.15.1 conda-forge::pigz=2.3.4" : null)
|
2021-12-06 08:56:41 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-04-11 12:26:28 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:5ebebbc128cd624282eaa37d2c7fe01505a91a69-0':
|
|
|
|
'quay.io/biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:5ebebbc128cd624282eaa37d2c7fe01505a91a69-0' }"
|
2021-12-06 08:56:41 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(reads)
|
|
|
|
path hashmap
|
2021-12-08 22:19:37 +00:00
|
|
|
val sort_bam
|
2021-12-06 08:56:41 +00:00
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam"), emit: bam
|
|
|
|
tuple val(meta), path('*.log'), emit: log
|
|
|
|
path "versions.yml" , emit: versions
|
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-12-06 08:56:41 +00:00
|
|
|
script:
|
|
|
|
def args = task.ext.args ?: ''
|
|
|
|
def args2 = task.ext.args2 ?: ''
|
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2022-03-25 10:26:47 +00:00
|
|
|
def read_group = meta.read_group ? "--RGSM ${meta.read_group}" : ""
|
2021-12-08 22:19:37 +00:00
|
|
|
def samtools_command = sort_bam ? 'sort' : 'view'
|
2021-12-06 08:56:41 +00:00
|
|
|
if (meta.single_end) {
|
|
|
|
"""
|
|
|
|
dragen-os \\
|
|
|
|
-r $hashmap \\
|
|
|
|
$args \\
|
2022-03-25 10:26:47 +00:00
|
|
|
$read_group \\
|
|
|
|
--num-threads $task.cpus \\
|
|
|
|
-1 $reads \\
|
2021-12-06 08:56:41 +00:00
|
|
|
2> ${prefix}.dragmap.log \\
|
2022-03-25 10:26:47 +00:00
|
|
|
| samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam -
|
2021-12-06 08:56:41 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
dragmap: \$(echo \$(dragen-os --version 2>&1))
|
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
} else {
|
|
|
|
"""
|
|
|
|
dragen-os \\
|
|
|
|
-r $hashmap \\
|
2022-03-25 10:26:47 +00:00
|
|
|
$args \\
|
|
|
|
$read_group \\
|
|
|
|
--num-threads $task.cpus \\
|
2021-12-06 08:56:41 +00:00
|
|
|
-1 ${reads[0]} \\
|
|
|
|
-2 ${reads[1]} \\
|
|
|
|
2> ${prefix}.dragmap.log \\
|
2022-03-25 10:26:47 +00:00
|
|
|
| samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam -
|
2021-12-06 08:56:41 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
dragmap: \$(echo \$(dragen-os --version 2>&1))
|
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|