2021-09-20 09:27:34 +00:00
|
|
|
process BBMAP_ALIGN {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::bbmap=38.92 bioconda::samtools=1.13 pigz=2.6" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' :
|
|
|
|
'quay.io/biocontainers/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' }"
|
2021-09-20 09:27:34 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(fastq)
|
|
|
|
path ref
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam"), emit: bam
|
2021-11-10 10:27:52 +00:00
|
|
|
tuple val(meta), path("*.log"), emit: log
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-09-20 09:27:34 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-09-20 09:27:34 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
2021-12-02 12:39:55 +00:00
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2021-09-20 09:27:34 +00:00
|
|
|
|
|
|
|
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
|
|
|
|
|
|
|
|
// Set the db variable to reflect the three possible types of reference input: 1) directory
|
|
|
|
// named 'ref', 2) directory named something else (containg a 'ref' subdir) or 3) a sequence
|
|
|
|
// file in fasta format
|
|
|
|
if ( ref.isDirectory() ) {
|
|
|
|
if ( ref ==~ /(.\/)?ref\/?/ ) {
|
|
|
|
db = ''
|
|
|
|
} else {
|
|
|
|
db = "path=${ref}"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
db = "ref=${ref}"
|
|
|
|
}
|
|
|
|
|
|
|
|
"""
|
|
|
|
bbmap.sh \\
|
|
|
|
$db \\
|
|
|
|
$input \\
|
|
|
|
out=${prefix}.bam \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-09-20 09:27:34 +00:00
|
|
|
threads=$task.cpus \\
|
2021-11-10 10:27:52 +00:00
|
|
|
-Xmx${task.memory.toGiga()}g \\
|
|
|
|
&> ${prefix}.bbmap.log
|
2021-09-20 09:27:34 +00:00
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
bbmap: \$(bbversion.sh)
|
2021-09-28 13:37:47 +00:00
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
|
|
|
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-09-20 09:27:34 +00:00
|
|
|
"""
|
|
|
|
}
|