From 71de5c89655b07835805284bb35a81a069693c19 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 15:44:56 +1200 Subject: [PATCH 1/2] Added nf-test for atlas/pmd --- modules/nf-core/atlas/pmd/meta.yml | 2 +- modules/nf-core/atlas/pmd/tests/main.nf.test | 46 +++++++++++++++++++ .../nf-core/atlas/pmd/tests/main.nf.test.snap | 18 ++++++++ tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/atlas/pmd/main.nf | 19 -------- .../modules/nf-core/atlas/pmd/nextflow.config | 5 -- tests/modules/nf-core/atlas/pmd/test.yml | 14 ------ 7 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 modules/nf-core/atlas/pmd/tests/main.nf.test create mode 100644 modules/nf-core/atlas/pmd/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/atlas/pmd/main.nf delete mode 100644 tests/modules/nf-core/atlas/pmd/nextflow.config delete mode 100644 tests/modules/nf-core/atlas/pmd/test.yml diff --git a/modules/nf-core/atlas/pmd/meta.yml b/modules/nf-core/atlas/pmd/meta.yml index 7b11d718e48..ed2ec3691ba 100644 --- a/modules/nf-core/atlas/pmd/meta.yml +++ b/modules/nf-core/atlas/pmd/meta.yml @@ -11,7 +11,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 diff --git a/modules/nf-core/atlas/pmd/tests/main.nf.test b/modules/nf-core/atlas/pmd/tests/main.nf.test new file mode 100644 index 00000000000..a49b799a50a --- /dev/null +++ b/modules/nf-core/atlas/pmd/tests/main.nf.test @@ -0,0 +1,46 @@ + +nextflow_process { + + name "Test Process ATLAS_PMD" + script "../main.nf" + process "ATLAS_PMD" + + tag "modules" + tag "modules_nfcore" + tag "atlas" + tag "atlas/pmd" + + test("test-atlas-pmd") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + 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), + [] + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.empiric[0][1]).readLines()[0], + file(process.out.exponential[0][1]).readLines()[0], + file(process.out.counts[0][1]).readLines()[0], + file(process.out.table[0][1]).readLines()[0], + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/atlas/pmd/tests/main.nf.test.snap b/modules/nf-core/atlas/pmd/tests/main.nf.test.snap new file mode 100644 index 00000000000..2206c762b32 --- /dev/null +++ b/modules/nf-core/atlas/pmd/tests/main.nf.test.snap @@ -0,0 +1,18 @@ +{ + "test-atlas-pmd": { + "content": [ + "1\tCT\tEmpiric[0.000831,0.000000,0.001339,0.001350,0.001437,0.000000,0.002210,0.001314,0.001466,0.000000,0.001395,0.001403,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.001362,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000794,0.000000,0.000000,0.000000,0.001297,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000]", + "1\tExponential[0.001389,0.085030,-0.000167]\tExponential[-0.000000,-0.258362,0.000090]", + "1\tforward\tA->A\t2050\t2033\t2081\t2078\t2138\t2119\t2038\t2007\t2035\t2113\t2049\t2048\t1974\t2012\t2066\t2093\t2110\t1971\t1976\t1906\t1968\t1951\t1917\t1912\t1955\t1956\t1933\t1872\t1922\t1933\t1974\t1840\t1963\t1897\t1870\t1823\t1923\t1908\t1902\t1883\t1973\t1899\t1908\t1912\t1972\t1913\t1922\t1959\t1995\t2039", + "1\tforward\tA->A\t0.998539\t0.997547\t0.997603\t1\t0.998133\t0.998586\t0.99902\t0.998507\t0.998038\t0.999527\t0.997566\t0.997565\t0.998988\t0.998016\t0.99855\t0.999522\t0.996223\t0.99848\t0.999494\t0.998952\t0.999492\t0.997444\t0.998958\t0.997912\t0.997958\t0.997959\t0.997935\t0.998933\t0.996888\t0.999483\t0.998988\t0.999457\t0.998474\t0.998947\t0.998398\t0.998357\t0.997924\t0.999476\t0.999475\t1\t0.998987\t0.998423\t0.999476\t1\t1\t0.998956\t0.998442\t0.997454\t0.9975\t0.99951", + [ + "versions.yml:md5,abec49256c52cb677fa0dad3473ed5a6" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T15:44:18.518049" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4aea9c2af1e..7e77b32cec4 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -28,9 +28,6 @@ ataqv/mkarv: atlas/call: - modules/nf-core/atlas/call/** - tests/modules/nf-core/atlas/call/** -atlas/pmd: - - modules/nf-core/atlas/pmd/** - - tests/modules/nf-core/atlas/pmd/** atlas/recal: - modules/nf-core/atlas/recal/** - tests/modules/nf-core/atlas/recal/** diff --git a/tests/modules/nf-core/atlas/pmd/main.nf b/tests/modules/nf-core/atlas/pmd/main.nf deleted file mode 100644 index bcba7dc3f4f..00000000000 --- a/tests/modules/nf-core/atlas/pmd/main.nf +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { ATLAS_PMD } from '../../../../../modules/nf-core/atlas/pmd/main.nf' - -workflow test_atlas_pmd { - - input = [ - [ 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), - [] - ] - fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) - - ATLAS_PMD ( input, fasta, fai ) -} diff --git a/tests/modules/nf-core/atlas/pmd/nextflow.config b/tests/modules/nf-core/atlas/pmd/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/atlas/pmd/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/atlas/pmd/test.yml b/tests/modules/nf-core/atlas/pmd/test.yml deleted file mode 100644 index bb2c3f973ac..00000000000 --- a/tests/modules/nf-core/atlas/pmd/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: atlas pmd test_atlas_pmd - command: nextflow run ./tests/modules/nf-core/atlas/pmd -entry test_atlas_pmd -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/atlas/pmd/nextflow.config - tags: - - atlas/pmd - - atlas - files: - - path: output/atlas/test.paired_end.sorted_PMD_Table.txt - md5sum: b28a9f4784f30a711046708eb7d94642 - - path: output/atlas/test.paired_end.sorted_PMD_Table_counts.txt - md5sum: 1aabfb83cfff6e0413f52d016c943e3e - - path: output/atlas/test.paired_end.sorted_PMD_input_Empiric.txt - md5sum: 8ff876f50ce05dc9aac0646a31682df0 - - path: output/atlas/test.paired_end.sorted_PMD_input_Exponential.txt - md5sum: 2421450ef643316f4eacf5cb811e4df7 From b0e6f077ae55bb4c1489af397746cbfcf67da051 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 16:01:46 +1200 Subject: [PATCH 2/2] Fixed power assertion --- modules/nf-core/atlas/pmd/tests/main.nf.test | 2 +- modules/nf-core/atlas/pmd/tests/main.nf.test.snap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/atlas/pmd/tests/main.nf.test b/modules/nf-core/atlas/pmd/tests/main.nf.test index a49b799a50a..fc804e7b170 100644 --- a/modules/nf-core/atlas/pmd/tests/main.nf.test +++ b/modules/nf-core/atlas/pmd/tests/main.nf.test @@ -33,7 +33,7 @@ nextflow_process { { assert process.success }, { assert snapshot( file(process.out.empiric[0][1]).readLines()[0], - file(process.out.exponential[0][1]).readLines()[0], + file(process.out.exponential[0][1]).readLines()[0][0..13], file(process.out.counts[0][1]).readLines()[0], file(process.out.table[0][1]).readLines()[0], process.out.versions diff --git a/modules/nf-core/atlas/pmd/tests/main.nf.test.snap b/modules/nf-core/atlas/pmd/tests/main.nf.test.snap index 2206c762b32..59f90a820f7 100644 --- a/modules/nf-core/atlas/pmd/tests/main.nf.test.snap +++ b/modules/nf-core/atlas/pmd/tests/main.nf.test.snap @@ -2,7 +2,7 @@ "test-atlas-pmd": { "content": [ "1\tCT\tEmpiric[0.000831,0.000000,0.001339,0.001350,0.001437,0.000000,0.002210,0.001314,0.001466,0.000000,0.001395,0.001403,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.001362,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000794,0.000000,0.000000,0.000000,0.001297,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000]", - "1\tExponential[0.001389,0.085030,-0.000167]\tExponential[-0.000000,-0.258362,0.000090]", + "1\tExponential[", "1\tforward\tA->A\t2050\t2033\t2081\t2078\t2138\t2119\t2038\t2007\t2035\t2113\t2049\t2048\t1974\t2012\t2066\t2093\t2110\t1971\t1976\t1906\t1968\t1951\t1917\t1912\t1955\t1956\t1933\t1872\t1922\t1933\t1974\t1840\t1963\t1897\t1870\t1823\t1923\t1908\t1902\t1883\t1973\t1899\t1908\t1912\t1972\t1913\t1922\t1959\t1995\t2039", "1\tforward\tA->A\t0.998539\t0.997547\t0.997603\t1\t0.998133\t0.998586\t0.99902\t0.998507\t0.998038\t0.999527\t0.997566\t0.997565\t0.998988\t0.998016\t0.99855\t0.999522\t0.996223\t0.99848\t0.999494\t0.998952\t0.999492\t0.997444\t0.998958\t0.997912\t0.997958\t0.997959\t0.997935\t0.998933\t0.996888\t0.999483\t0.998988\t0.999457\t0.998474\t0.998947\t0.998398\t0.998357\t0.997924\t0.999476\t0.999475\t1\t0.998987\t0.998423\t0.999476\t1\t1\t0.998956\t0.998442\t0.997454\t0.9975\t0.99951", [ @@ -13,6 +13,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.4" }, - "timestamp": "2024-08-26T15:44:18.518049" + "timestamp": "2024-08-26T16:01:09.837624" } } \ No newline at end of file