mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
ad0f4d2e24
* 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>
50 lines
1.8 KiB
Text
50 lines
1.8 KiB
Text
// Import generic module functions
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
|
|
|
params.options = [:]
|
|
options = initOptions(params.options)
|
|
|
|
process CSVTK_CONCAT {
|
|
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::csvtk=0.23.0" : null)
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
container "https://depot.galaxyproject.org/singularity/csvtk:0.23.0--h9ee0642_0"
|
|
} else {
|
|
container "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:
|
|
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 \\
|
|
$options.args \\
|
|
--num-cpus $task.cpus \\
|
|
--delimiter "${delimiter}" \\
|
|
--out-delimiter "${out_delimiter}" \\
|
|
--out-file ${prefix}.${out_extension} \\
|
|
$csv
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
${getProcessName(task.process)}:
|
|
csvtk: \$(echo \$( csvtk version | sed -e "s/csvtk v//g" ))
|
|
END_VERSIONS
|
|
"""
|
|
}
|