patch output extension in csvtk/concat (#797)

* patch output extension

* Update main.nf

* Update main.nf

* Update main.nf

* whitespace

* Update main.nf

* Update main.nf

* Update modules/csvtk/concat/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
Robert A. Petit III 2021-10-05 15:15:08 -06:00 committed by GitHub
parent 0ba88fb869
commit ad0f4d2e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,13 +24,14 @@ process CSVTK_CONCAT {
val out_format
output:
tuple val(meta), path("*.${out_format}"), emit: csv
tuple val(meta), path("${prefix}.${out_extension}"), emit: csv
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def delimiter = in_format == "tsv" ? "\t" : (in_format == "csv" ? "," : in_format)
def out_delimiter = out_format == "tsv" ? "\t" : (out_format == "csv" ? "," : out_format)
out_extension = out_format == "tsv" ? 'tsv' : 'csv'
"""
csvtk \\
concat \\
@ -38,7 +39,7 @@ process CSVTK_CONCAT {
--num-cpus $task.cpus \\
--delimiter "${delimiter}" \\
--out-delimiter "${out_delimiter}" \\
--out-file ${prefix}.${out_format} \\
--out-file ${prefix}.${out_extension} \\
$csv
cat <<-END_VERSIONS > versions.yml