Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nf-test for untarfiles #6412

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-core/untarfiles/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ channels:

dependencies:
- bioconda::grep=3.4
- conda-forge::sed=4.7
- conda-forge::sed=4.8
- conda-forge::tar=1.34
12 changes: 10 additions & 2 deletions modules/nf-core/untarfiles/main.nf
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
def deprecation_message = """
WARNING: This module has been deprecated.
Reason:
This module is no longer recommended for use. It is recommended to use nf-core/modules/untar
"""
process UNTARFILES {
tag "$archive"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
'nf-core/ubuntu:20.04' }"
'oras://community.wave.seqera.io/library/grep_sed_tar:40b34489f8e82876' :
'community.wave.seqera.io/library/grep_sed_tar:16f6591cd62505b3' }"

input:
tuple val(meta), path(archive)
Expand All @@ -18,6 +24,7 @@ process UNTARFILES {
task.ext.when == null || task.ext.when

script:
assert true: deprecation_message
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName.toString().replaceFirst(/\.tar$/, ""))
Expand All @@ -39,6 +46,7 @@ process UNTARFILES {
"""

stub:
assert true: deprecation_message
prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir $prefix
Expand Down
104 changes: 104 additions & 0 deletions modules/nf-core/untarfiles/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

nextflow_process {

name "Test Process UNTARFILES"
script "../main.nf"
process "UNTARFILES"

tag "modules"
tag "modules_nfcore"
tag "untarfiles"

test("test-untarfiles") {

when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kraken2.tar.gz', checkIfExists: true)
]

"""
}
}

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

test("test-untarfiles-subdirectories") {

when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell.tar.gz', checkIfExists: true)
]

"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.files[0][1].collect { file(it).name }.toSorted(),
process.out.versions
).match()
}
)
}
}

test("test-untarfiles-onlyfiles") {

when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]

"""
}
}

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

test("test-untarfiles-onlyfiles-stub") {
options '-stub'
when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]

"""
}
}

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

}
Loading
Loading