2022-05-06 12:10:44 +00:00
|
|
|
process SNAPALIGNER_ALIGN {
|
2022-06-30 09:15:15 +00:00
|
|
|
tag "$meta.id"
|
2022-04-12 09:02:10 +00:00
|
|
|
label 'process_high'
|
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::snap-aligner=2.0.1" : null)
|
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/snap-aligner:2.0.1--hd03093a_1':
|
|
|
|
'quay.io/biocontainers/snap-aligner:2.0.1--hd03093a_1' }"
|
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(reads)
|
|
|
|
path index
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam"), emit: bam
|
2022-06-29 10:37:38 +00:00
|
|
|
tuple val(meta), path("*.bai"), optional: true, emit: bai
|
2022-04-12 09:02:10 +00:00
|
|
|
path "versions.yml" , emit: versions
|
|
|
|
|
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
|
|
|
script:
|
|
|
|
def args = task.ext.args ?: ''
|
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2022-05-06 12:10:44 +00:00
|
|
|
def subcmd = meta.single_end ? "single" : "paired"
|
2022-04-12 09:02:10 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
mkdir -p index
|
|
|
|
mv $index index/
|
|
|
|
|
2022-05-06 12:10:44 +00:00
|
|
|
snap-aligner ${subcmd} \\
|
2022-04-12 09:02:10 +00:00
|
|
|
index \\
|
|
|
|
${reads.join(" ")} \\
|
2022-05-06 12:10:44 +00:00
|
|
|
-o ${prefix}.bam \\
|
2022-04-12 09:02:10 +00:00
|
|
|
-t ${task.cpus} \\
|
|
|
|
$args
|
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
snapaligner: \$(snap-aligner 2>&1| head -n 1 | sed 's/^.*version //;s/.\$//')
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|