From 0a7b366f6f3fead1de89698ffa68a841a102352e Mon Sep 17 00:00:00 2001 From: lgrochowalski Date: Mon, 18 Mar 2024 16:29:29 +0100 Subject: [PATCH] port htseq count pytest to nf-test (#5194) * port htseq count pytest to nf-test * rename yml file * add extra line * fix tag.yml * fix meta.yml * fix meta.yml --------- Co-authored-by: zxBIB Grochowalski,Lukasz (GCBDS) EXTERNAL Co-authored-by: Mauro Saporita <64437596+mauro-saporita@users.noreply.github.com> --- modules/nf-core/htseq/count/meta.yml | 2 +- .../nf-core/htseq/count/tests/main.nf.test | 72 +++++++++++++++++++ .../htseq/count/tests/main.nf.test.snap | 72 +++++++++++++++++++ modules/nf-core/htseq/count/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - 5 files changed, 147 insertions(+), 4 deletions(-) create mode 100644 modules/nf-core/htseq/count/tests/main.nf.test create mode 100644 modules/nf-core/htseq/count/tests/main.nf.test.snap create mode 100644 modules/nf-core/htseq/count/tests/tags.yml diff --git a/modules/nf-core/htseq/count/meta.yml b/modules/nf-core/htseq/count/meta.yml index 1a036ffa3c0..9373e680e02 100644 --- a/modules/nf-core/htseq/count/meta.yml +++ b/modules/nf-core/htseq/count/meta.yml @@ -12,7 +12,7 @@ tools: homepage: "https://htseq.readthedocs.io/en/latest/" documentation: "https://htseq.readthedocs.io/en/latest/index.html" doi: "10.1093/bioinformatics/btu638" - licence: "['GPL v3']" + licence: ["GPL v3"] input: - meta: type: map diff --git a/modules/nf-core/htseq/count/tests/main.nf.test b/modules/nf-core/htseq/count/tests/main.nf.test new file mode 100644 index 00000000000..511c8d67f0d --- /dev/null +++ b/modules/nf-core/htseq/count/tests/main.nf.test @@ -0,0 +1,72 @@ +nextflow_process { + + name "Test Process HTSEQ_COUNT" + script "../main.nf" + process "HTSEQ_COUNT" + tag "modules" + tag "modules_nfcore" + tag "htseq" + tag "htseq/count" + + test("bam input") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) + + ] + input[1] = [ + [ id:'test2'], // meta map + file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert process.out.txt.get(0).get(1) ==~ ".*.txt" }, + { assert snapshot(process.out).match() } + ) + + } + + } + + test("cram input") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) + + ] + input[1] = [ + [ id:'test2'], // meta map + file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert process.out.txt.get(0).get(1) ==~ ".*.txt" }, + { assert snapshot(process.out).match() } + ) + + } + + } + + +} diff --git a/modules/nf-core/htseq/count/tests/main.nf.test.snap b/modules/nf-core/htseq/count/tests/main.nf.test.snap new file mode 100644 index 00000000000..e561310de7e --- /dev/null +++ b/modules/nf-core/htseq/count/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "bam input": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,5e37b2292f1d21945acb532afa5eb615" + ] + ], + "1": [ + "versions.yml:md5,4aad47e2b62180da87cd22e49b2cb1d6" + ], + "txt": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,5e37b2292f1d21945acb532afa5eb615" + ] + ], + "versions": [ + "versions.yml:md5,4aad47e2b62180da87cd22e49b2cb1d6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T15:02:21.074352" + }, + "cram input": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,53f9b007bd72115e8b72a40f859bc896" + ] + ], + "1": [ + "versions.yml:md5,4aad47e2b62180da87cd22e49b2cb1d6" + ], + "txt": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,53f9b007bd72115e8b72a40f859bc896" + ] + ], + "versions": [ + "versions.yml:md5,4aad47e2b62180da87cd22e49b2cb1d6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T15:02:30.977775" + } +} \ No newline at end of file diff --git a/modules/nf-core/htseq/count/tests/tags.yml b/modules/nf-core/htseq/count/tests/tags.yml new file mode 100644 index 00000000000..232a7e55162 --- /dev/null +++ b/modules/nf-core/htseq/count/tests/tags.yml @@ -0,0 +1,2 @@ +htseq/count: + - "modules/nf-core/htseq/count/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4794bf6a27c..6ddc580ab6f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1046,9 +1046,6 @@ homer/pos2bed: hpsuissero: - modules/nf-core/hpsuissero/** - tests/modules/nf-core/hpsuissero/** -htseq/count: - - modules/nf-core/htseq/count/** - - tests/modules/nf-core/htseq/count/** hypo: - modules/nf-core/hypo/** - tests/modules/nf-core/hypo/**