diff --git a/modules/nf-core/gnu/sort/environment.yml b/modules/nf-core/gnu/sort/environment.yml index 45d2335684f..5c4eb9d173b 100644 --- a/modules/nf-core/gnu/sort/environment.yml +++ b/modules/nf-core/gnu/sort/environment.yml @@ -1,4 +1,4 @@ -name: GNU_SORT +name: gnu_sort channels: - conda-forge - bioconda diff --git a/modules/nf-core/gnu/sort/main.nf b/modules/nf-core/gnu/sort/main.nf index 108a70a8c1e..d0560ee2ede 100644 --- a/modules/nf-core/gnu/sort/main.nf +++ b/modules/nf-core/gnu/sort/main.nf @@ -34,7 +34,6 @@ process GNU_SORT { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" suffix = task.ext.suffix ?: "${input.extension}" output_file = "${prefix}.${suffix}" @@ -42,7 +41,7 @@ process GNU_SORT { if ("$input" == "$output_file") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" """ - sort ${args} ${input} > ${output_file} + touch ${output_file} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/gnu/sort/meta.yml b/modules/nf-core/gnu/sort/meta.yml index 014bcd524b8..9d961750c64 100644 --- a/modules/nf-core/gnu/sort/meta.yml +++ b/modules/nf-core/gnu/sort/meta.yml @@ -1,4 +1,4 @@ -name: "GNU_SORT" +name: "gnu_sort" description: | Writes a sorted concatenation of file/s keywords: diff --git a/modules/nf-core/gnu/sort/tests/main.nf.test b/modules/nf-core/gnu/sort/tests/main.nf.test new file mode 100644 index 00000000000..e40301871b5 --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/main.nf.test @@ -0,0 +1,120 @@ +nextflow_process { + + name "Test Process GNU_SORT" + script "modules/nf-core/gnu/sort/main.nf" + process "GNU_SORT" + + tag "modules" + tag "modules_nfcore" + tag "gnu" + tag "gnu/sort" + + test("unsorted_genome_sort") { + config "./sort_simple_bed.config" + + when { + process { + """ + input[0] = [ + [id:'genome_test'], + file(params.test_data['generic']['unsorted_data']['unsorted_text']['genome_file'], + checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot( + file(process.out.sorted[0][1]).name + ).match("genome_sort") + } + ) + } + + } + + test("unsorted_intervals_sort") { + config "./sort_simple_bed.config" + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.test_data['generic']['unsorted_data']['unsorted_text']['intervals'], + checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot( + file(process.out.sorted[0][1]).name + ).match("interval_sort") + } + ) + } + + } + + test("unsorted_csv_sort") { + config "./sort_complex.config" + + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.test_data['generic']['unsorted_data']['unsorted_text']['numbers_csv'], + checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot( + file(process.out.sorted[0][1]).name + ).match("csv_sort") + } + ) + } + + } + + test("unsorted_csv_sort_stub") { + config "./sort_complex.config" + options "-stub" + + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.test_data['generic']['unsorted_data']['unsorted_text']['numbers_csv'], + checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} diff --git a/modules/nf-core/gnu/sort/tests/main.nf.test.snap b/modules/nf-core/gnu/sort/tests/main.nf.test.snap new file mode 100644 index 00000000000..fc20d872486 --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/main.nf.test.snap @@ -0,0 +1,136 @@ +{ + "unsorted_csv_sort": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.csv.sorted:md5,0b52d1b4c4a0c6e972c6f94aafd75a1d" + ] + ], + "1": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ], + "sorted": [ + [ + { + "id": "test" + }, + "test.csv.sorted:md5,0b52d1b4c4a0c6e972c6f94aafd75a1d" + ] + ], + "versions": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ] + } + ], + "timestamp": "2024-02-22T13:57:33.598003" + }, + "interval_sort": { + "content": [ + "test.bed.sorted" + ], + "timestamp": "2024-02-22T13:57:25.5442" + }, + "unsorted_csv_sort_stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.csv.sorted:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ], + "sorted": [ + [ + { + "id": "test" + }, + "test.csv.sorted:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ] + } + ], + "timestamp": "2024-02-22T13:57:41.490986" + }, + "csv_sort": { + "content": [ + "test.csv.sorted" + ], + "timestamp": "2024-02-22T13:57:33.62444" + }, + "unsorted_genome_sort": { + "content": [ + { + "0": [ + [ + { + "id": "genome_test" + }, + "genome_test.bed.sorted:md5,fd97f7efafdbbfa71d9b560f10b4b048" + ] + ], + "1": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ], + "sorted": [ + [ + { + "id": "genome_test" + }, + "genome_test.bed.sorted:md5,fd97f7efafdbbfa71d9b560f10b4b048" + ] + ], + "versions": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ] + } + ], + "timestamp": "2024-02-22T13:57:17.281092" + }, + "genome_sort": { + "content": [ + "genome_test.bed.sorted" + ], + "timestamp": "2024-02-22T13:57:17.340463" + }, + "unsorted_intervals_sort": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bed.sorted:md5,abbce903ef263d38b2f71856387799ab" + ] + ], + "1": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ], + "sorted": [ + [ + { + "id": "test" + }, + "test.bed.sorted:md5,abbce903ef263d38b2f71856387799ab" + ] + ], + "versions": [ + "versions.yml:md5,8ebec31a85721157399cb4faab6e0d26" + ] + } + ], + "timestamp": "2024-02-22T13:57:25.514206" + } +} \ No newline at end of file diff --git a/modules/nf-core/gnu/sort/tests/sort_complex.config b/modules/nf-core/gnu/sort/tests/sort_complex.config new file mode 100644 index 00000000000..103eaaf6f33 --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/sort_complex.config @@ -0,0 +1,6 @@ +process { + withName: GNU_SORT { + ext.args = { "-t ';' -g -k 1,1 -k 2,2" } + ext.suffix = { "csv.sorted" } + } +} \ No newline at end of file diff --git a/modules/nf-core/gnu/sort/tests/sort_simple_bed.config b/modules/nf-core/gnu/sort/tests/sort_simple_bed.config new file mode 100644 index 00000000000..d7d52e0f285 --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/sort_simple_bed.config @@ -0,0 +1,6 @@ +process { + withName: GNU_SORT { + ext.args = { "-k1,1 -k2,2n" } + ext.suffix = { "bed.sorted" } + } +} \ No newline at end of file diff --git a/modules/nf-core/gnu/sort/tests/sort_simple_genome.config b/modules/nf-core/gnu/sort/tests/sort_simple_genome.config new file mode 100644 index 00000000000..4dcec385514 --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/sort_simple_genome.config @@ -0,0 +1,6 @@ +process { + withName: GNU_SORT { + ext.args = { "-k1,1 -k2,2n" } + ext.suffix = { "genome.sorted" } + } +} \ No newline at end of file diff --git a/modules/nf-core/gnu/sort/tests/tags.yml b/modules/nf-core/gnu/sort/tests/tags.yml new file mode 100644 index 00000000000..ac40e376d2f --- /dev/null +++ b/modules/nf-core/gnu/sort/tests/tags.yml @@ -0,0 +1,2 @@ +gnu/sort: + - "modules/nf-core/gnu/sort/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 81cbcd62e60..55559da7204 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -936,9 +936,6 @@ glimpse2/splitreference: glnexus: - modules/nf-core/glnexus/** - tests/modules/nf-core/glnexus/** -gnu/sort: - - modules/nf-core/gnu/sort/** - - tests/modules/nf-core/gnu/sort/** goat/taxonsearch: - modules/nf-core/goat/taxonsearch/** - tests/modules/nf-core/goat/taxonsearch/** diff --git a/tests/modules/nf-core/gnu/sort/main.nf b/tests/modules/nf-core/gnu/sort/main.nf deleted file mode 100644 index a1e99556d91..00000000000 --- a/tests/modules/nf-core/gnu/sort/main.nf +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 -include { GNU_SORT as GNU_SORT_A } from '../../../../../modules/nf-core/gnu/sort/main.nf' -include { GNU_SORT as GNU_SORT_B } from '../../../../../modules/nf-core/gnu/sort/main.nf' -include { GNU_SORT as GNU_SORT_C } from '../../../../../modules/nf-core/gnu/sort/main.nf' - -workflow test_gnu_sort { - - input_a = [ - [id:'test'], - file(params.test_data['generic']['unsorted_data']['unsorted_text']['genome_file'], - checkIfExists: true) - ] - - GNU_SORT_A ( input_a ) - - input_b = [ - [id:'test'], - file(params.test_data['generic']['unsorted_data']['unsorted_text']['intervals'], - checkIfExists: true) - ] - - GNU_SORT_B ( input_b ) - - input_c = [ - [id:'test'], - file(params.test_data['generic']['unsorted_data']['unsorted_text']['numbers_csv'], - checkIfExists: true) - ] - - GNU_SORT_C ( input_c ) - -} diff --git a/tests/modules/nf-core/gnu/sort/nextflow.config b/tests/modules/nf-core/gnu/sort/nextflow.config deleted file mode 100644 index fadb305c7cc..00000000000 --- a/tests/modules/nf-core/gnu/sort/nextflow.config +++ /dev/null @@ -1,19 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: GNU_SORT_A { - ext.args = { "-k1,1 -k2,2n" } - ext.suffix = { "genome.sorted" } - } - - withName: GNU_SORT_B { - ext.args = { "-k1,1 -k2,2n" } - ext.suffix = { "bed.sorted" } - } - - withName: GNU_SORT_C { - ext.args = { "-t ';' -g -k 1,1 -k 2,2" } - ext.suffix = { "csv.sorted" } - } -} \ No newline at end of file diff --git a/tests/modules/nf-core/gnu/sort/test.yml b/tests/modules/nf-core/gnu/sort/test.yml deleted file mode 100644 index d23496ae682..00000000000 --- a/tests/modules/nf-core/gnu/sort/test.yml +++ /dev/null @@ -1,13 +0,0 @@ -- name: gnu sort test_gnu_sort - command: nextflow run ./tests/modules/nf-core/gnu/sort -entry test_gnu_sort -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gnu/sort/nextflow.config - tags: - - gnu - - gnu/sort - files: - - path: output/gnu/test.bed.sorted - md5sum: abbce903ef263d38b2f71856387799ab - - path: output/gnu/test.csv.sorted - md5sum: 0b52d1b4c4a0c6e972c6f94aafd75a1d - - path: output/gnu/test.genome.sorted - md5sum: fd97f7efafdbbfa71d9b560f10b4b048 - - path: output/gnu/versions.yml