From e98394f6c8588c28c2f2f08940ebfd997b31ad3c Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Tue, 27 Aug 2024 07:53:02 +1200 Subject: [PATCH] Added nf-test for picard/fastqtosam (#6295) --- .../picard/fastqtosam/tests/main.nf.test | 100 ++++++++++++++++++ .../picard/fastqtosam/tests/main.nf.test.snap | 41 +++++++ .../picard/fastqtosam/tests/nextflow.config | 5 + tests/config/pytest_modules.yml | 3 - .../modules/nf-core/picard/fastqtosam/main.nf | 43 -------- .../nf-core/picard/fastqtosam/nextflow.config | 7 -- .../nf-core/picard/fastqtosam/test.yml | 26 ----- 7 files changed, 146 insertions(+), 79 deletions(-) create mode 100644 modules/nf-core/picard/fastqtosam/tests/main.nf.test create mode 100644 modules/nf-core/picard/fastqtosam/tests/main.nf.test.snap create mode 100644 modules/nf-core/picard/fastqtosam/tests/nextflow.config delete mode 100644 tests/modules/nf-core/picard/fastqtosam/main.nf delete mode 100644 tests/modules/nf-core/picard/fastqtosam/nextflow.config delete mode 100644 tests/modules/nf-core/picard/fastqtosam/test.yml diff --git a/modules/nf-core/picard/fastqtosam/tests/main.nf.test b/modules/nf-core/picard/fastqtosam/tests/main.nf.test new file mode 100644 index 000000000000..ad3d52374a05 --- /dev/null +++ b/modules/nf-core/picard/fastqtosam/tests/main.nf.test @@ -0,0 +1,100 @@ + +nextflow_process { + + name "Test Process PICARD_FASTQTOSAM" + script "../main.nf" + process "PICARD_FASTQTOSAM" + + tag "modules" + tag "modules_nfcore" + tag "picard" + tag "picard/fastqtosam" + + test("test-picard-fastqtosam-single") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } + ) + } + } + + test("test-picard-fastqtosam-paired") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } + ) + } + } + + test("test-picard-fastqtosam-paired-custom-samplename") { + config "./nextflow.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/picard/fastqtosam/tests/main.nf.test.snap b/modules/nf-core/picard/fastqtosam/tests/main.nf.test.snap new file mode 100644 index 000000000000..2f999dcc9c9c --- /dev/null +++ b/modules/nf-core/picard/fastqtosam/tests/main.nf.test.snap @@ -0,0 +1,41 @@ +{ + "test-picard-fastqtosam-paired-custom-samplename": { + "content": [ + "e3cfa46b13cc4fc425cccae944f43b10", + [ + "versions.yml:md5,24527dfda806cbcfd1609c4734f973f1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T09:50:01.762254" + }, + "test-picard-fastqtosam-single": { + "content": [ + "e6a4aa204d980e177a0458596f0a70ac", + [ + "versions.yml:md5,24527dfda806cbcfd1609c4734f973f1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T09:49:32.460549" + }, + "test-picard-fastqtosam-paired": { + "content": [ + "e3cfa46b13cc4fc425cccae944f43b10", + [ + "versions.yml:md5,24527dfda806cbcfd1609c4734f973f1" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T09:49:47.018269" + } +} \ No newline at end of file diff --git a/modules/nf-core/picard/fastqtosam/tests/nextflow.config b/modules/nf-core/picard/fastqtosam/tests/nextflow.config new file mode 100644 index 000000000000..22294c05eb3e --- /dev/null +++ b/modules/nf-core/picard/fastqtosam/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'PICARD_FASTQTOSAM' { + ext.args = "--SAMPLE_NAME CustomSample" + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index c4f245e1ffd0..889c3b917df7 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -935,9 +935,6 @@ picard/collectinsertsizemetrics: picard/collectrnaseqmetrics: - modules/nf-core/picard/collectrnaseqmetrics/** - tests/modules/nf-core/picard/collectrnaseqmetrics/** -picard/fastqtosam: - - modules/nf-core/picard/fastqtosam/** - - tests/modules/nf-core/picard/fastqtosam/** picard/filtersamreads: - modules/nf-core/picard/filtersamreads/** - tests/modules/nf-core/picard/filtersamreads/** diff --git a/tests/modules/nf-core/picard/fastqtosam/main.nf b/tests/modules/nf-core/picard/fastqtosam/main.nf deleted file mode 100644 index 5b1af7ea9fca..000000000000 --- a/tests/modules/nf-core/picard/fastqtosam/main.nf +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PICARD_FASTQTOSAM } from '../../../../../modules/nf-core/picard/fastqtosam/main.nf' - -workflow test_picard_fastqtosam_single { - - input = [ - [ id:'test', single_end:true ], // meta map - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) - ] - ] - - PICARD_FASTQTOSAM ( input ) -} - -workflow test_picard_fastqtosam_paired { - - input = [ - [ id:'test', single_end:false ], // meta map - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ] - ] - - PICARD_FASTQTOSAM ( input ) -} - -workflow test_picard_fastqtosam_paired_custom_samplename { - - input = [ - [ id:'test', single_end:false ], // meta map - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ] - ] - - PICARD_FASTQTOSAM ( input ) -} diff --git a/tests/modules/nf-core/picard/fastqtosam/nextflow.config b/tests/modules/nf-core/picard/fastqtosam/nextflow.config deleted file mode 100644 index 25c849c9e857..000000000000 --- a/tests/modules/nf-core/picard/fastqtosam/nextflow.config +++ /dev/null @@ -1,7 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: "test_picard_fastqtosam_paired_custom_samplename:PICARD_FASTQTOSAM" { - ext.args = "--SAMPLE_NAME CustomSample" - } -} diff --git a/tests/modules/nf-core/picard/fastqtosam/test.yml b/tests/modules/nf-core/picard/fastqtosam/test.yml deleted file mode 100644 index 348337c46b9c..000000000000 --- a/tests/modules/nf-core/picard/fastqtosam/test.yml +++ /dev/null @@ -1,26 +0,0 @@ -- name: picard fastqtosam test_picard_fastqtosam_single - command: nextflow run ./tests/modules/nf-core/picard/fastqtosam -entry test_picard_fastqtosam_single -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/picard/fastqtosam/nextflow.config - tags: - - picard - - picard/fastqtosam - files: - - path: output/picard/test.bam - md5sum: fe2882efe8f13a8da20fcc63469ed0aa - -- name: picard fastqtosam test_picard_fastqtosam_paired - command: nextflow run ./tests/modules/nf-core/picard/fastqtosam -entry test_picard_fastqtosam_paired -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/picard/fastqtosam/nextflow.config - tags: - - picard - - picard/fastqtosam - files: - - path: output/picard/test.bam - md5sum: 90e4f59f9d942f96c3f3c41160f3fd5d - -- name: picard fastqtosam test_picard_fastqtosam_paired_custom_samplename - command: nextflow run ./tests/modules/nf-core/picard/fastqtosam -entry test_picard_fastqtosam_paired_custom_samplename -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/picard/fastqtosam/nextflow.config - tags: - - picard - - picard/fastqtosam - files: - - path: output/picard/test.bam - md5sum: 69d35ee2b5dc263d022eaf59a9e383d3