2021-10-12 12:43:08 +00:00
|
|
|
// Import generic module functions
|
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
|
|
|
|
|
|
|
params.options = [:]
|
|
|
|
options = initOptions(params.options)
|
|
|
|
|
|
|
|
process BAMTOOLS_SPLIT {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_low'
|
|
|
|
publishDir "${params.outdir}",
|
|
|
|
mode: params.publish_dir_mode,
|
|
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null)
|
|
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
|
|
container "https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9"
|
|
|
|
} else {
|
|
|
|
container "quay.io/biocontainers/bamtools:2.5.1--h9a82719_9"
|
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam)
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam"), emit: bam
|
|
|
|
path "versions.yml" , emit: versions
|
|
|
|
|
|
|
|
script:
|
|
|
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
|
|
|
"""
|
|
|
|
bamtools \\
|
|
|
|
split \\
|
|
|
|
-in $bam \\
|
|
|
|
$options.args
|
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
${getProcessName(task.process)}:
|
2021-10-23 18:39:27 +00:00
|
|
|
${getSoftwareName(task.process)}: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' )
|
2021-10-12 12:43:08 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|