From 285cff6358eff66a1ebc89fe2ef985224a1761ce Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 23 Aug 2024 11:18:09 +1200 Subject: [PATCH] Added nf-test for pairtools/parse --- .../pairtools/parse/tests/main.nf.test | 40 +++++++++++++++++++ .../pairtools/parse/tests/main.nf.test.snap | 30 ++++++++++++++ .../pairtools/parse/tests/nextflow.config | 5 +++ tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/pairtools/parse/main.nf | 14 ------- .../nf-core/pairtools/parse/nextflow.config | 9 ----- .../modules/nf-core/pairtools/parse/test.yml | 17 -------- 7 files changed, 75 insertions(+), 43 deletions(-) create mode 100644 modules/nf-core/pairtools/parse/tests/main.nf.test create mode 100644 modules/nf-core/pairtools/parse/tests/main.nf.test.snap create mode 100644 modules/nf-core/pairtools/parse/tests/nextflow.config delete mode 100644 tests/modules/nf-core/pairtools/parse/main.nf delete mode 100644 tests/modules/nf-core/pairtools/parse/nextflow.config delete mode 100644 tests/modules/nf-core/pairtools/parse/test.yml diff --git a/modules/nf-core/pairtools/parse/tests/main.nf.test b/modules/nf-core/pairtools/parse/tests/main.nf.test new file mode 100644 index 00000000000..27f9bc32599 --- /dev/null +++ b/modules/nf-core/pairtools/parse/tests/main.nf.test @@ -0,0 +1,40 @@ + +nextflow_process { + + name "Test Process PAIRTOOLS_PARSE" + script "../main.nf" + process "PAIRTOOLS_PARSE" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "pairtools" + tag "pairtools/parse" + + test("test-pairtools-parse") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pairtools/mock.sam', checkIfExists: true) ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pairtools/mock.chrom.sizes', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.pairsam[0][1]).linesGzip[3..7], + process.out.stat, + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/pairtools/parse/tests/main.nf.test.snap b/modules/nf-core/pairtools/parse/tests/main.nf.test.snap new file mode 100644 index 00000000000..c06e572cd5f --- /dev/null +++ b/modules/nf-core/pairtools/parse/tests/main.nf.test.snap @@ -0,0 +1,30 @@ +{ + "test-pairtools-parse": { + "content": [ + [ + "#chromsize: chr1 1000", + "#chromsize: chr2 1000", + "#samheader: @SQ\tSN:chr1\tLN:1000", + "#samheader: @SQ\tSN:chr2\tLN:1000", + "#samheader: @PG\tID:mock\tPN:mock\tVN:0.0.0\tCL:mock" + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.raw.pairsam.stat:md5,054bf78ee4f0a4c447ad3eeb81f1f4ae" + ] + ], + [ + "versions.yml:md5,2c8cb00722749f8e3831464a5057c519" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-23T11:17:35.185642" + } +} \ No newline at end of file diff --git a/modules/nf-core/pairtools/parse/tests/nextflow.config b/modules/nf-core/pairtools/parse/tests/nextflow.config new file mode 100644 index 00000000000..d662e86bf6d --- /dev/null +++ b/modules/nf-core/pairtools/parse/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: PAIRTOOLS_PARSE { + ext.prefix = { "${meta.id}.raw" } + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b698856bbae..c4918463df0 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1010,9 +1010,6 @@ pairtools/flip: pairtools/merge: - modules/nf-core/pairtools/merge/** - tests/modules/nf-core/pairtools/merge/** -pairtools/parse: - - modules/nf-core/pairtools/parse/** - - tests/modules/nf-core/pairtools/parse/** pairtools/restrict: - modules/nf-core/pairtools/restrict/** - tests/modules/nf-core/pairtools/restrict/** diff --git a/tests/modules/nf-core/pairtools/parse/main.nf b/tests/modules/nf-core/pairtools/parse/main.nf deleted file mode 100644 index 684b6c8d8cf..00000000000 --- a/tests/modules/nf-core/pairtools/parse/main.nf +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PAIRTOOLS_PARSE } from '../../../../../modules/nf-core/pairtools/parse/main.nf' - -workflow test_pairtools_parse { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['generic']['pairtools']['mock_sam'], checkIfExists: true) ] - sizes = file(params.test_data['generic']['pairtools']['mock_chrom_sizes'], checkIfExists:true) - - PAIRTOOLS_PARSE ( input, sizes ) -} diff --git a/tests/modules/nf-core/pairtools/parse/nextflow.config b/tests/modules/nf-core/pairtools/parse/nextflow.config deleted file mode 100644 index a5d3ef9df2c..00000000000 --- a/tests/modules/nf-core/pairtools/parse/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: PAIRTOOLS_PARSE { - ext.prefix = { "${meta.id}.raw" } - } - -} diff --git a/tests/modules/nf-core/pairtools/parse/test.yml b/tests/modules/nf-core/pairtools/parse/test.yml deleted file mode 100644 index 257929c0db0..00000000000 --- a/tests/modules/nf-core/pairtools/parse/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: pairtools parse test_pairtools_parse - command: nextflow run ./tests/modules/nf-core/pairtools/parse -entry test_pairtools_parse -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/pairtools/parse/nextflow.config - tags: - - pairtools - - pairtools/parse - files: - - path: output/pairtools/test.raw.pairsam.gz # Not using MD5 checksum because the file includes the run paths, which are different under Conda - contains: - - "readid01\tchr1\t10\tchr1\t200\t+\t+\tUU\treadid01" - - path: output/pairtools/test.raw.pairsam.stat - contains: - - "total\t23" - - "total_unmapped\t10" - - "total_single_sided_mapped\t4" - - "total_mapped\t9" - - "total_dups\t0" - - "total_nodups\t9"