nf-core_modules/modules/biobambam/bammerge/main.nf
2022-05-16 20:51:39 +02:00

41 lines
1.3 KiB
Text

process BIOBAMBAM_BAMMERGE {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::biobambam=2.0.183" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/biobambam:2.0.183--h9f5acd7_1':
'quay.io/biocontainers/biobambam:2.0.183--h9f5acd7_1' }"
input:
tuple val(meta), path(bam)
output:
tuple val(meta), path("${prefix}.bam") ,emit: bam
tuple val(meta), path("${indexfilename}") ,optional:true, emit: bam_index
tuple val(meta), path("${md5filename}") ,optional:true, emit: checksum
path "versions.yml" ,emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
indexfilename = args.contains("indexfilename=") ? args =~ /indexfilename=([^\s]+)/ : ""
md5filename = args.contains("md5filename=") ? args =~ /md5filename=([^\s]+)/ : ""
def input_string = bam.join(" I=")
"""
bammerge \\
I=${input_string} \\
$args \\
> ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bammerge: \$( bammerge --version |& sed '1!d; s/.*version //; s/.\$//' )
END_VERSIONS
"""
}