mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-23 11:38:17 +00:00
d473a247d2
* Replace remaining task.ext.suffix with task.ext.prefix
40 lines
1.3 KiB
Text
40 lines
1.3 KiB
Text
process CSVTK_CONCAT {
|
|
tag "$meta.id"
|
|
label 'process_low'
|
|
|
|
conda (params.enable_conda ? "bioconda::csvtk=0.23.0" : null)
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
'https://depot.galaxyproject.org/singularity/csvtk:0.23.0--h9ee0642_0' :
|
|
'quay.io/biocontainers/csvtk:0.23.0--h9ee0642_0' }"
|
|
|
|
input:
|
|
tuple val(meta), path(csv)
|
|
val in_format
|
|
val out_format
|
|
|
|
output:
|
|
tuple val(meta), path("${prefix}.${out_extension}"), emit: csv
|
|
path "versions.yml" , emit: versions
|
|
|
|
script:
|
|
def args = task.ext.args ?: ''
|
|
prefix = task.ext.prefix ?: "${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 \\
|
|
$args \\
|
|
--num-cpus $task.cpus \\
|
|
--delimiter "${delimiter}" \\
|
|
--out-delimiter "${out_delimiter}" \\
|
|
--out-file ${prefix}.${out_extension} \\
|
|
$csv
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
"${task.process}":
|
|
csvtk: \$(echo \$( csvtk version | sed -e "s/csvtk v//g" ))
|
|
END_VERSIONS
|
|
"""
|
|
}
|