add decompress possibilities to bgzip (#1540)

* add decompress possibilities to bgzip

* spacing
This commit is contained in:
Maxime U. Garcia 2022-04-20 16:26:56 +02:00 committed by GitHub
parent 6c45773c0b
commit 37bf3936f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 15 deletions

View file

@ -11,7 +11,7 @@ process TABIX_BGZIP {
tuple val(meta), path(input)
output:
tuple val(meta), path("*.gz"), emit: gz
tuple val(meta), path("${prefix}*"), emit: output
path "versions.yml" , emit: versions
when:
@ -19,9 +19,12 @@ process TABIX_BGZIP {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"
in_bgzip = input.toString().endsWith(".gz")
command1 = in_bgzip ? '-d' : '-c'
command2 = in_bgzip ? '' : " > ${prefix}.${input.getExtension()}.gz"
"""
bgzip -c $args $input > ${prefix}.${input.getExtension()}.gz
bgzip $command1 $args -@${task.cpus} $input $command2
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -1,13 +1,14 @@
name: tabix_bgzip
description: Compresses files
description: Compresses/decompresses files
keywords:
- compress
- decompress
- bgzip
- tabix
tools:
- bgzip:
description: |
Bgzip compresses files in a similar manner to, and compatible with, gzip.
Bgzip compresses or decompresses files in a similar manner to, and compatible with, gzip.
homepage: https://www.htslib.org/doc/tabix.html
documentation: http://www.htslib.org/doc/bgzip.html
doi: 10.1093/bioinformatics/btp352
@ -18,19 +19,19 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- file:
- input:
type: file
description: text file
description: file to compress or to decompress
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- file:
- output:
type: file
description: Output compressed file
pattern: "*.{gz}"
description: Output compressed/decompressed file
pattern: "*."
- versions:
type: file
description: File containing software versions

View file

@ -4,10 +4,18 @@ nextflow.enable.dsl = 2
include { TABIX_BGZIP } from '../../../../modules/tabix/bgzip/main.nf'
workflow test_tabix_bgzip {
workflow test_tabix_bgzip_compress {
input = [ [ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) ]
]
TABIX_BGZIP ( input )
}
workflow test_tabix_bgzip_decompress {
input = [ [ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['genome']['test_bed_gz'], checkIfExists: true) ]
]
TABIX_BGZIP ( input )
}

View file

@ -1,8 +1,16 @@
- name: tabix bgzip
command: nextflow run ./tests/modules/tabix/bgzip -entry test_tabix_bgzip -c ./tests/config/nextflow.config -c ./tests/modules/tabix/bgzip/nextflow.config
- name: tabix bgzip compress
command: nextflow run ./tests/modules/tabix/bgzip -entry test_tabix_bgzip_compress -c ./tests/config/nextflow.config -c ./tests/modules/tabix/bgzip/nextflow.config
tags:
- tabix
- tabix/bgzip
files:
- path: ./output/tabix/test.vcf.gz
md5sum: fc178eb342a91dc0d1d568601ad8f8e2
- name: tabix bgzip decompress
command: nextflow run ./tests/modules/tabix/bgzip -entry test_tabix_bgzip_decompress -c ./tests/config/nextflow.config -c ./tests/modules/tabix/bgzip/nextflow.config
tags:
- tabix
- tabix/bgzip
files:
- path: ./output/tabix/test.bed
md5sum: fe4053cf4de3aebbdfc3be2efb125a74