Skip to content

Commit

Permalink
Pigzip (nf-core#4156)
Browse files Browse the repository at this point in the history
* compress workflow

* add compress tests to pytest

* fix

* uncompress

* uncompress tests

* Revert "uncompress tests", will do nf-tests

This reverts commit 6e7a33e.

* Revert "add compress tests to pytest", will do nf-tests

This reverts commit 139e5c2.

* generating the nf-tests for the processes

* first test written, need actual run

* set stageInMode

* call -f to make pigz follow symlinks

* uncompress keeps input

* remove compress module

* written first iteration of nf-test for pigz/uncompress

* empty line in tag.yml

* adding missing tags in main.nf.test and fixed linting errors

* add old singularity container for pigz

* switch from pgzip to pigz singularity/biocontainers container, in anticipation of BioContainers/multi-package-containers#2793 being merged

---------

Co-authored-by: Leon Rauschning <[email protected]>
Co-authored-by: alessiovignoli <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2023
1 parent 3d20bff commit 4ef7bec
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
48 changes: 48 additions & 0 deletions modules/nf-core/pigz/uncompress/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process PIGZ_UNCOMPRESS {
label 'process_low'
//stageInMode 'copy' // this directive can be set in case the original input should be kept

conda "conda-forge::pigz"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pigz:2.8':
'biocontainers/pigz:2.8' }"

input:
path zip

output:
path "${uncompressed_filename}" , emit: file
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
uncompressed_filename = zip.toString() - '.gz'
// calling pigz -f to make it follow symlinks
"""
unpigz \\
-p $task.cpus \\
-fk \\
$args \\
${zip}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
uncompressed_filename = zip.toString() - '.gz'
"""
touch ${zip.dropRight(3)}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\w*//' ))
END_VERSIONS
"""
}
32 changes: 32 additions & 0 deletions modules/nf-core/pigz/uncompress/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
name: "pigz_uncompress"
description: write your description here
keywords:
- uncompress
- gzip
- parallelized
tools:
- "pigz":
description: "Parallel implementation of the gzip algorithm."
homepage: "https://zlib.net/pigz/"
documentation: "https://zlib.net/pigz/pigz.pdf"

input:
- zip:
type: file
description: Gzipped file
pattern: "*.{gzip}"

output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- file:
type: file
description: File to compress
pattern: "*"

authors:
- "@lrauschning"
33 changes: 33 additions & 0 deletions modules/nf-core/pigz/uncompress/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
nextflow_process {

name "Test Process PIGZ_UNCOMPRESS"
script "modules/nf-core/pigz/uncompress/main.nf"
process "PIGZ_UNCOMPRESS"
tag "modules"
tag "modules_nfcore"
tag "pigz"
tag "pigz/uncompress"

test("Should run without failures") {

when {
params {
outdir = "$outputDir"
}
process {
"""
input[0] = [
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
"""
}
}

then {
assert process.success
assert snapshot(process.out).match()
}

}

}
21 changes: 21 additions & 0 deletions modules/nf-core/pigz/uncompress/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/pigz/uncompress/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pigz/uncompress:
- modules/nf-core/pigz/uncompress/**

0 comments on commit 4ef7bec

Please sign in to comment.