fix optional output detection

This commit is contained in:
Matthias De Smet 2022-05-17 08:20:33 +02:00
parent d0db186e84
commit 6be91ce82d
2 changed files with 13 additions and 5 deletions

View file

@ -11,9 +11,9 @@ process BIOBAMBAM_BAMMERGE {
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
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
@ -23,8 +23,8 @@ process BIOBAMBAM_BAMMERGE {
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]+)/ : ""
indexfilename = args.contains("indexfilename=") ? (args =~ /indexfilename=([^\s]+)/)[0][1] : ""
md5filename = args.contains("md5filename=") ? (args =~ /md5filename=([^\s]+)/)[0][1] : ""
def input_string = bam.join(" I=")
"""

View file

@ -6,6 +6,10 @@
files:
- path: output/biobambam/test.bam
md5sum: bc3d32ab6a54d1894ca7cc79387dec57
- path: output/biobambam/test.bam.bai
md5sum: b8ae542a37a73d79de1c15c765207c53
- path: output/biobambam/test.md5
md5sum: 31c59857990ceb392242136429e30243
- name: biobambam bammerge test_biobambam_bammerge_single
command: nextflow run ./tests/modules/biobambam/bammerge -entry test_biobambam_bammerge_single -c ./tests/config/nextflow.config -c ./tests/modules/biobambam/bammerge/nextflow.config
@ -15,3 +19,7 @@
files:
- path: output/biobambam/test.bam
md5sum: 86185d3d6895a7722d3b3a09c6f91bfc
- path: output/biobambam/test.bam.bai
md5sum: 973680feb6bc73cd1051ea83c7219418
- path: output/biobambam/test.md5
md5sum: 244a9d1cbc6d74724285c80220e5e427