mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Explicitly name the output files to avoid the gzi index being flown through the output
channel (#2136)
This commit is contained in:
parent
ebc466caac
commit
31c0b49f65
1 changed files with 7 additions and 6 deletions
|
@ -11,8 +11,8 @@ process TABIX_BGZIP {
|
|||
tuple val(meta), path(input)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${prefix}*"), emit: output
|
||||
tuple val(meta), path("*gzi") , emit: gzi, optional: true
|
||||
tuple val(meta), path("${output}") , emit: output
|
||||
tuple val(meta), path("${output}.gzi"), emit: gzi, optional: true
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
when:
|
||||
|
@ -21,12 +21,13 @@ process TABIX_BGZIP {
|
|||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
in_bgzip = input.toString().endsWith(".gz")
|
||||
in_bgzip = ["gz", "bgz", "bgzf"].contains(input.getExtension())
|
||||
output = in_bgzip ? input.getBaseName() : "${prefix}.${input.getExtension()}.gz"
|
||||
command1 = in_bgzip ? '-d' : '-c'
|
||||
command2 = in_bgzip ? '' : " > ${prefix}.${input.getExtension()}.gz"
|
||||
command2 = in_bgzip ? '' : " > ${output}"
|
||||
// Name the index according to $prefix, unless a name has been requested
|
||||
if ((args.matches("(^| )-i\\b") || args.matches("(^| )--index(\$| )")) && !args.matches("(^| )-I\\b") && !args.matches("(^| )--index-name\\b")) {
|
||||
args = args + " -I ${prefix}.${input.getExtension()}.gz.gzi"
|
||||
args = args + " -I ${output}.gzi"
|
||||
}
|
||||
"""
|
||||
bgzip $command1 $args -@${task.cpus} $input $command2
|
||||
|
|
Loading…
Reference in a new issue