From f5884eac4a95dd5af3edb6a8b0efea7ece28f945 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 19:47:53 +1200 Subject: [PATCH] Added nf-test for atlas/splitmerge (#6344) Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- modules/nf-core/atlas/splitmerge/main.nf | 3 +- modules/nf-core/atlas/splitmerge/meta.yml | 6 +-- .../atlas/splitmerge/tests/main.nf.test | 43 +++++++++++++++++++ .../atlas/splitmerge/tests/main.nf.test.snap | 22 ++++++++++ tests/config/pytest_modules.yml | 3 -- .../modules/nf-core/atlas/splitmerge/main.nf | 15 ------- .../nf-core/atlas/splitmerge/nextflow.config | 5 --- .../modules/nf-core/atlas/splitmerge/test.yml | 11 ----- 8 files changed, 70 insertions(+), 38 deletions(-) create mode 100644 modules/nf-core/atlas/splitmerge/tests/main.nf.test create mode 100644 modules/nf-core/atlas/splitmerge/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/atlas/splitmerge/main.nf delete mode 100644 tests/modules/nf-core/atlas/splitmerge/nextflow.config delete mode 100644 tests/modules/nf-core/atlas/splitmerge/test.yml diff --git a/modules/nf-core/atlas/splitmerge/main.nf b/modules/nf-core/atlas/splitmerge/main.nf index 1a4725cf1ec..222b55af7eb 100644 --- a/modules/nf-core/atlas/splitmerge/main.nf +++ b/modules/nf-core/atlas/splitmerge/main.nf @@ -11,7 +11,8 @@ process ATLAS_SPLITMERGE { tuple val(meta), path(bam), path(bai), path(read_group_settings), path(blacklist) output: - tuple val(meta), path("*_mergedReads.bam"), path("*.txt.gz"), emit: data + tuple val(meta), path("*_mergedReads.bam") , emit: bam + tuple val(meta), path("*.txt.gz") , emit: txt path "versions.yml", emit: versions when: diff --git a/modules/nf-core/atlas/splitmerge/meta.yml b/modules/nf-core/atlas/splitmerge/meta.yml index fc6289c78da..24621b1901b 100644 --- a/modules/nf-core/atlas/splitmerge/meta.yml +++ b/modules/nf-core/atlas/splitmerge/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://bitbucket.org/wegmannlab/atlas/wiki/Home" tool_dev_url: "https://bitbucket.org/wegmannlab/atlas" doi: "10.1101/105346" - licence: "['GPL v3']" + licence: ["GPL v3"] input: - meta: type: map @@ -27,7 +27,7 @@ input: type: file description: The BAI file for the input BAM file pattern: "*.bai" - - read_group_setting: + - read_group_settings: type: file description: | TXT file containing the split and merge settings for @@ -55,7 +55,7 @@ output: type: file description: A BAM file with suffix_mergedReads.bam pattern: "*_mergedReads.bam" - - filelist: + - txt: type: file description: A file listing all reads that were filtered out in the merging process with suffix_ignoredReads.txt.gz pattern: "*.txt.gz" diff --git a/modules/nf-core/atlas/splitmerge/tests/main.nf.test b/modules/nf-core/atlas/splitmerge/tests/main.nf.test new file mode 100644 index 00000000000..9d7d1884b97 --- /dev/null +++ b/modules/nf-core/atlas/splitmerge/tests/main.nf.test @@ -0,0 +1,43 @@ + +nextflow_process { + + name "Test Process ATLAS_SPLITMERGE" + script "../main.nf" + process "ATLAS_SPLITMERGE" + + tag "modules" + tag "modules_nfcore" + tag "atlas" + tag "atlas/splitmerge" + + test("test-atlas-splitmerge") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/read_group_settings.txt', checkIfExists: true), + [] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.txt[0][1]).linesGzip[3..7], + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/atlas/splitmerge/tests/main.nf.test.snap b/modules/nf-core/atlas/splitmerge/tests/main.nf.test.snap new file mode 100644 index 00000000000..dfb38da0af1 --- /dev/null +++ b/modules/nf-core/atlas/splitmerge/tests/main.nf.test.snap @@ -0,0 +1,22 @@ +{ + "test-atlas-splitmerge": { + "content": [ + [ + "Read testN:1, rev : not a proper pair (orphan)", + "Read testN:99, rev : longer than insert size (TLEN)", + "Read testN:99, rev : not a proper pair (orphan)", + "Read testN:830, rev : longer than insert size (TLEN)", + "Read testN:830, fwd : longer than insert size (TLEN)" + ], + "66f5f17da47cc4dced99bd17d739b536", + [ + "versions.yml:md5,208f6ef7923cec00ddbcd5825f84a4fa" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T15:33:41.150912" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 1afc1307bf1..243916b0dfc 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -25,9 +25,6 @@ ataqv/ataqv: ataqv/mkarv: - modules/nf-core/ataqv/mkarv/** - tests/modules/nf-core/ataqv/mkarv/** -atlas/splitmerge: - - modules/nf-core/atlas/splitmerge/** - - tests/modules/nf-core/atlas/splitmerge/** authentict/deam2cont: - modules/nf-core/authentict/deam2cont/** - tests/modules/nf-core/authentict/deam2cont/** diff --git a/tests/modules/nf-core/atlas/splitmerge/main.nf b/tests/modules/nf-core/atlas/splitmerge/main.nf deleted file mode 100644 index bde3c197329..00000000000 --- a/tests/modules/nf-core/atlas/splitmerge/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { ATLAS_SPLITMERGE } from '../../../../../modules/nf-core/atlas/splitmerge/main.nf' - -//MAIN -workflow test_atlas_splitmerge { - meta = [ id:'test', single_end:false ] - bam = file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) - bai = file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - settings = file(params.test_data['homo_sapiens']['illumina']['read_group_settings_txt'], checkIfExists: true) - - ATLAS_SPLITMERGE ( [meta, bam, bai, settings, []] ) -} diff --git a/tests/modules/nf-core/atlas/splitmerge/nextflow.config b/tests/modules/nf-core/atlas/splitmerge/nextflow.config deleted file mode 100644 index ff5bc70147a..00000000000 --- a/tests/modules/nf-core/atlas/splitmerge/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - withName: ATLAS_SPLITMERGE { - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - } -} \ No newline at end of file diff --git a/tests/modules/nf-core/atlas/splitmerge/test.yml b/tests/modules/nf-core/atlas/splitmerge/test.yml deleted file mode 100644 index c41c8e06a69..00000000000 --- a/tests/modules/nf-core/atlas/splitmerge/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: atlas splitmerge test_atlas_splitmerge - command: nextflow run ./tests/modules/nf-core/atlas/splitmerge -entry test_atlas_splitmerge -c ./tests/config/nextflow.config - tags: - - atlas - - atlas/splitmerge - files: - - path: output/atlas/test.paired_end.sorted_ignoredReads.txt.gz - md5sum: 9b64c47313d2de89c26790f713707ee6 - - path: output/atlas/test.paired_end.sorted_mergedReads.bam - - path: output/atlas/versions.yml - md5sum: 11735bec9c2f4b395b987fd00d4e4294