Skip to content

Commit

Permalink
Add name safety, add compression to stub
Browse files Browse the repository at this point in the history
  • Loading branch information
itrujnara committed Jan 8, 2025
1 parent f91dc4b commit 10df560
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/nf-core/ripgrep/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ process RIPGREP {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def write_output = compress ? " | pigz -cp ${task.cpus} > ${prefix}.txt.gz" : "> ${prefix}.txt"
if (!compress && files.contains("${prefix}.txt") || compress && files.contains("${prefix}.txt.gz")) {
error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
}
"""
rg \\
$args \\
Expand All @@ -40,8 +43,9 @@ process RIPGREP {
stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def write_output = compress ? "touch ${prefix}.txt.gz" : "touch ${prefix}.txt"
"""
touch ${prefix}.txt
$write_output
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down

0 comments on commit 10df560

Please sign in to comment.