From b47e98406387c035789f5dfc4f318f354304123f Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 09:24:23 +1200 Subject: [PATCH] Added nf-test for picard/sortsam --- .../nf-core/picard/sortsam/tests/main.nf.test | 40 +++++++++++++++++++ .../picard/sortsam/tests/main.nf.test.snap | 15 +++++++ .../picard/sortsam/tests/nextflow.config | 5 +++ tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/picard/sortsam/main.nf | 14 ------- .../nf-core/picard/sortsam/nextflow.config | 9 ----- tests/modules/nf-core/picard/sortsam/test.yml | 9 ----- 7 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 modules/nf-core/picard/sortsam/tests/main.nf.test create mode 100644 modules/nf-core/picard/sortsam/tests/main.nf.test.snap create mode 100644 modules/nf-core/picard/sortsam/tests/nextflow.config delete mode 100644 tests/modules/nf-core/picard/sortsam/main.nf delete mode 100644 tests/modules/nf-core/picard/sortsam/nextflow.config delete mode 100644 tests/modules/nf-core/picard/sortsam/test.yml diff --git a/modules/nf-core/picard/sortsam/tests/main.nf.test b/modules/nf-core/picard/sortsam/tests/main.nf.test new file mode 100644 index 00000000000..9d9af09ea77 --- /dev/null +++ b/modules/nf-core/picard/sortsam/tests/main.nf.test @@ -0,0 +1,40 @@ + +nextflow_process { + + name "Test Process PICARD_SORTSAM" + script "../main.nf" + process "PICARD_SORTSAM" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "picard" + tag "picard/sortsam" + + test("test-picard-sortsam") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.bam', checkIfExists: true) + ] + input[1] = "queryname" + + """ + } + } + + 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/sortsam/tests/main.nf.test.snap b/modules/nf-core/picard/sortsam/tests/main.nf.test.snap new file mode 100644 index 00000000000..bf447b8d135 --- /dev/null +++ b/modules/nf-core/picard/sortsam/tests/main.nf.test.snap @@ -0,0 +1,15 @@ +{ + "test-picard-sortsam": { + "content": [ + "b9847fed94d2b7286e18caaa099658ce", + [ + "versions.yml:md5,f53876b7c58b5aa1564606f3c9c34108" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T09:23:48.485054" + } +} \ No newline at end of file diff --git a/modules/nf-core/picard/sortsam/tests/nextflow.config b/modules/nf-core/picard/sortsam/tests/nextflow.config new file mode 100644 index 00000000000..8512101e96f --- /dev/null +++ b/modules/nf-core/picard/sortsam/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: PICARD_SORTSAM { + ext.prefix = { "${meta.id}.sorted" } + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4aea9c2af1e..0358161bd39 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1073,9 +1073,6 @@ picard/renamesampleinvcf: picard/scatterintervalsbyns: - modules/nf-core/picard/scatterintervalsbyns/** - tests/modules/nf-core/picard/scatterintervalsbyns/** -picard/sortsam: - - modules/nf-core/picard/sortsam/** - - tests/modules/nf-core/picard/sortsam/** picard/sortvcf: - modules/nf-core/picard/sortvcf/** - tests/modules/nf-core/picard/sortvcf/** diff --git a/tests/modules/nf-core/picard/sortsam/main.nf b/tests/modules/nf-core/picard/sortsam/main.nf deleted file mode 100644 index 4b4e801355a..00000000000 --- a/tests/modules/nf-core/picard/sortsam/main.nf +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PICARD_SORTSAM } from '../../../../../modules/nf-core/picard/sortsam/main.nf' - -workflow test_picard_sortsam { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) ] - sort_order = "queryname" - - PICARD_SORTSAM ( input, sort_order ) -} diff --git a/tests/modules/nf-core/picard/sortsam/nextflow.config b/tests/modules/nf-core/picard/sortsam/nextflow.config deleted file mode 100644 index ca572c2f41c..00000000000 --- a/tests/modules/nf-core/picard/sortsam/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: PICARD_SORTSAM { - ext.prefix = { "${meta.id}.sorted" } - } - -} diff --git a/tests/modules/nf-core/picard/sortsam/test.yml b/tests/modules/nf-core/picard/sortsam/test.yml deleted file mode 100644 index 9322ed77b5b..00000000000 --- a/tests/modules/nf-core/picard/sortsam/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: picard sortsam test_picard_sortsam - command: nextflow run ./tests/modules/nf-core/picard/sortsam -entry test_picard_sortsam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/picard/sortsam/nextflow.config - tags: - - picard - - picard/sortsam - files: - - path: output/picard/test.sorted.bam - md5sum: b44a6ca04811a9470c7813c3c9465fd5 - - path: output/picard/versions.yml