From c7dca3f00aa814e438432af196f24b1769778be3 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 24 Mar 2025 12:46:28 +0100 Subject: [PATCH 1/7] Migrate to nf-test --- modules/nf-core/bamtools/convert/main.nf | 15 + .../bamtools/convert/tests/main.nf.test | 241 +++++++++++++++ .../bamtools/convert/tests/main.nf.test.snap | 289 ++++++++++++++++++ .../bamtools/convert/tests/nextflow.config | 5 + tests/config/pytest_modules.yml | 3 - .../modules/nf-core/bamtools/convert/main.nf | 104 ------- .../nf-core/bamtools/convert/nextflow.config | 41 --- .../modules/nf-core/bamtools/convert/test.yml | 83 ----- 8 files changed, 550 insertions(+), 231 deletions(-) create mode 100644 modules/nf-core/bamtools/convert/tests/main.nf.test create mode 100644 modules/nf-core/bamtools/convert/tests/main.nf.test.snap create mode 100644 modules/nf-core/bamtools/convert/tests/nextflow.config delete mode 100644 tests/modules/nf-core/bamtools/convert/main.nf delete mode 100644 tests/modules/nf-core/bamtools/convert/nextflow.config delete mode 100644 tests/modules/nf-core/bamtools/convert/test.yml diff --git a/modules/nf-core/bamtools/convert/main.nf b/modules/nf-core/bamtools/convert/main.nf index 71c3774e611e..54325126f1da 100644 --- a/modules/nf-core/bamtools/convert/main.nf +++ b/modules/nf-core/bamtools/convert/main.nf @@ -37,4 +37,19 @@ process BAMTOOLS_CONVERT { bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' ) END_VERSIONS """ + + stub : + prefix = task.ext.prefix ?: "${meta.id}" + def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ + if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" + m = args =~ /-format ([a-z]+)/ + ext = m[0][1] + + """ + touch ${prefix}.${ext} + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test b/modules/nf-core/bamtools/convert/tests/main.nf.test new file mode 100644 index 000000000000..00e95948efeb --- /dev/null +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test @@ -0,0 +1,241 @@ +nextflow_process { + + name "Test Process BAMTOOLS_CONVERT" + config "./nextflow.config" + script "../main.nf" + process "BAMTOOLS_CONVERT" + + tag "modules" + tag "modules_nfcore" + tag "bamtools" + tag "bamtools/convert" + + test("test_bamtools_convert_ext_error") { + when { + params { + module_args = "-format vcf" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.failed }, + { assert process.errorReport.contains("-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml") } + ) + } + } + test("test_bamtools_convert_noext_error") { + + + when { + params { + module_args = "" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.failed }, + { assert process.errorReport.contains("-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml") } + ) + } + } + test("test_bamtools_convert_bed") { + + + when { + params { + module_args = "-format bed" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_fasta") { + + + when { + params { + module_args = "-format fasta" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_fastq") { + + + when { + params { + module_args = "-format fastq" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_json") { + + + when { + params { + module_args = "-format json" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_pileup") { + + + when { + params { + module_args = "-format pileup" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_sam") { + + + when { + params { + module_args = "-format sam" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_bamtools_convert_yaml") { + when { + params { + module_args = "-format yaml" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_bamtools_convert_yaml - stub") { + when { + params { + module_args = "-format yaml" + } + process { + """ + input[0] = [ + [id:'test',single_end:false],// meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out, + process.out.versions.collect{path(it).yaml} + ).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test.snap b/modules/nf-core/bamtools/convert/tests/main.nf.test.snap new file mode 100644 index 000000000000..ca5c8faff37c --- /dev/null +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test.snap @@ -0,0 +1,289 @@ +{ + "test_bamtools_convert_bed": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,4e34cc15bf31e700f5f3a9f8fffb6c81" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,4e34cc15bf31e700f5f3a9f8fffb6c81" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:00.672576332" + }, + "test_bamtools_convert_pileup": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.pileup:md5,e5a3cb4a3e1bf980a575fafce6a2826f" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.pileup:md5,e5a3cb4a3e1bf980a575fafce6a2826f" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:21.526726426" + }, + "test_bamtools_convert_yaml": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.yaml:md5,68b56f198da036fef33e150eb773dc3b" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.yaml:md5,68b56f198da036fef33e150eb773dc3b" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:33.243682958" + }, + "test_bamtools_convert_yaml - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.yaml:md5,68b56f198da036fef33e150eb773dc3b" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.yaml:md5,68b56f198da036fef33e150eb773dc3b" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + }, + [ + { + "BAMTOOLS_CONVERT": { + "bamtools": "2.5.2" + } + } + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:39.561190634" + }, + "test_bamtools_convert_fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,52aeacf78571862b7e97c7d44ac8f827" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,52aeacf78571862b7e97c7d44ac8f827" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:05.544849198" + }, + "test_bamtools_convert_fastq": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastq:md5,e591c48daad2c56638e5d6f21f1f71c5" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastq:md5,e591c48daad2c56638e5d6f21f1f71c5" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:10.780695099" + }, + "test_bamtools_convert_json": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,9c44279e6da864f30b52a79a14dcb2bd" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,9c44279e6da864f30b52a79a14dcb2bd" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:16.017593286" + }, + "test_bamtools_convert_sam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sam:md5,6f559e53e1ea7ff3dc919c8c4695de96" + ] + ], + "1": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ], + "data": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sam:md5,6f559e53e1ea7ff3dc919c8c4695de96" + ] + ], + "versions": [ + "versions.yml:md5,a746e0233ed047ab5aed9529e370e88d" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-24T12:32:27.78175989" + } +} \ No newline at end of file diff --git a/modules/nf-core/bamtools/convert/tests/nextflow.config b/modules/nf-core/bamtools/convert/tests/nextflow.config new file mode 100644 index 000000000000..aff333e96ba3 --- /dev/null +++ b/modules/nf-core/bamtools/convert/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: "BAMTOOLS_CONVERT" { + ext.args = params.module_args + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0f88dcac49fb..7df421582ad6 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1,6 +1,3 @@ -bamtools/convert: - - modules/nf-core/bamtools/convert/** - - tests/modules/nf-core/bamtools/convert/** biohansel: - modules/nf-core/biohansel/** - tests/modules/nf-core/biohansel/** diff --git a/tests/modules/nf-core/bamtools/convert/main.nf b/tests/modules/nf-core/bamtools/convert/main.nf deleted file mode 100644 index e4bbfb61b8b1..000000000000 --- a/tests/modules/nf-core/bamtools/convert/main.nf +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_EXT_ERROR } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_NOEXT_ERROR } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_BED } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTA } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTQ } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_JSON } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_PILEUP } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_SAM } from '../../../../../modules/nf-core/bamtools/convert/main.nf' -include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_YAML } from '../../../../../modules/nf-core/bamtools/convert/main.nf' - -workflow test_bamtools_convert_ext_error { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_EXT_ERROR ( input ) -} - -workflow test_bamtools_convert_noext_error { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_NOEXT_ERROR ( input ) -} - -workflow test_bamtools_convert_bed { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_BED ( input ) -} - -workflow test_bamtools_convert_fasta { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_FASTA ( input ) -} - -workflow test_bamtools_convert_fastq { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_FASTQ ( input ) -} - -workflow test_bamtools_convert_json { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_JSON ( input ) -} - -workflow test_bamtools_convert_pileup { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_PILEUP ( input ) -} - -workflow test_bamtools_convert_sam { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_SAM ( input ) -} - -workflow test_bamtools_convert_yaml { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BAMTOOLS_CONVERT_YAML ( input ) -} - diff --git a/tests/modules/nf-core/bamtools/convert/nextflow.config b/tests/modules/nf-core/bamtools/convert/nextflow.config deleted file mode 100644 index ae8fe3458613..000000000000 --- a/tests/modules/nf-core/bamtools/convert/nextflow.config +++ /dev/null @@ -1,41 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: BAMTOOLS_CONVERT_EXT_ERROR { - ext.args = "-format vcf" - } - - withName: BAMTOOLS_CONVERT_NOEXT_ERROR { - ext.args = "" - } - - withName: BAMTOOLS_CONVERT_BED { - ext.args = "-format bed" - } - - withName: BAMTOOLS_CONVERT_FASTA { - ext.args = "-format fasta" - } - - withName: BAMTOOLS_CONVERT_FASTQ { - ext.args = "-format fastq" - } - - withName: BAMTOOLS_CONVERT_JSON { - ext.args = "-format json" - } - - withName: BAMTOOLS_CONVERT_PILEUP { - ext.args = "-format pileup" - } - - withName: BAMTOOLS_CONVERT_SAM { - ext.args = "-format sam" - } - - withName: BAMTOOLS_CONVERT_YAML { - ext.args = "-format yaml" - } - -} diff --git a/tests/modules/nf-core/bamtools/convert/test.yml b/tests/modules/nf-core/bamtools/convert/test.yml deleted file mode 100644 index 66c6bcb1e7d0..000000000000 --- a/tests/modules/nf-core/bamtools/convert/test.yml +++ /dev/null @@ -1,83 +0,0 @@ -- name: bamtools convert test_bamtools_convert_ext_error - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_ext_error -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - exit_code: 1 - -- name: bamtools convert test_bamtools_convert_noext_error - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_noext_error -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - exit_code: 1 - -- name: bamtools convert test_bamtools_convert_bed - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_bed -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.bed - md5sum: 4e34cc15bf31e700f5f3a9f8fffb6c81 - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_fasta - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_fasta -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.fasta - md5sum: 52aeacf78571862b7e97c7d44ac8f827 - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_fastq - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_fastq -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.fastq - md5sum: e591c48daad2c56638e5d6f21f1f71c5 - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_json - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_json -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.json - md5sum: 9c44279e6da864f30b52a79a14dcb2bd - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_pileup - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_pileup -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.pileup - md5sum: e5a3cb4a3e1bf980a575fafce6a2826f - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_sam - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_sam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.sam - md5sum: 6f559e53e1ea7ff3dc919c8c4695de96 - - path: output/bamtools/versions.yml - -- name: bamtools convert test_bamtools_convert_yaml - command: nextflow run ./tests/modules/nf-core/bamtools/convert -entry test_bamtools_convert_yaml -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bamtools/convert/nextflow.config - tags: - - bamtools - - bamtools/convert - files: - - path: output/bamtools/test.yaml - md5sum: 68b56f198da036fef33e150eb773dc3b - - path: output/bamtools/versions.yml From f70e649ed4e87d392009f7938aa9d5a789909429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:10:41 +0100 Subject: [PATCH 2/7] Update modules/nf-core/bamtools/convert/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/bamtools/convert/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/bamtools/convert/main.nf b/modules/nf-core/bamtools/convert/main.nf index 54325126f1da..137957291893 100644 --- a/modules/nf-core/bamtools/convert/main.nf +++ b/modules/nf-core/bamtools/convert/main.nf @@ -38,7 +38,7 @@ process BAMTOOLS_CONVERT { END_VERSIONS """ - stub : + stub: prefix = task.ext.prefix ?: "${meta.id}" def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" From 0fb958734e05b247e7956f3d4c15004ad8ead2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:10:52 +0100 Subject: [PATCH 3/7] Update modules/nf-core/bamtools/convert/tests/main.nf.test Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/bamtools/convert/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test b/modules/nf-core/bamtools/convert/tests/main.nf.test index 00e95948efeb..153401c7f4ba 100644 --- a/modules/nf-core/bamtools/convert/tests/main.nf.test +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test @@ -19,7 +19,7 @@ nextflow_process { """ input[0] = [ [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } From cce74155bbd1f2ece11975417cb173ca69c7a358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:11:02 +0100 Subject: [PATCH 4/7] Update modules/nf-core/bamtools/convert/tests/main.nf.test Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/bamtools/convert/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test b/modules/nf-core/bamtools/convert/tests/main.nf.test index 153401c7f4ba..da92e874b456 100644 --- a/modules/nf-core/bamtools/convert/tests/main.nf.test +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test @@ -18,7 +18,7 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map + [id:'test',single_end:false], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ From f2c04fa56c2cc31215fc4ab61a857fd4db57bb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:11:12 +0100 Subject: [PATCH 5/7] Update modules/nf-core/bamtools/convert/tests/main.nf.test Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/bamtools/convert/tests/main.nf.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test b/modules/nf-core/bamtools/convert/tests/main.nf.test index da92e874b456..0fe2fa194330 100644 --- a/modules/nf-core/bamtools/convert/tests/main.nf.test +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test @@ -41,8 +41,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } From 7bd9459ea69a21d897151562a335e01d2b979718 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 24 Mar 2025 13:17:11 +0100 Subject: [PATCH 6/7] Update variable names --- modules/nf-core/bamtools/convert/main.nf | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/nf-core/bamtools/convert/main.nf b/modules/nf-core/bamtools/convert/main.nf index 137957291893..e66730bb732c 100644 --- a/modules/nf-core/bamtools/convert/main.nf +++ b/modules/nf-core/bamtools/convert/main.nf @@ -18,19 +18,19 @@ process BAMTOOLS_CONVERT { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ - if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" - m = args =~ /-format ([a-z]+)/ - ext = m[0][1] + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + format_cmd = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ + matched_format = args =~ /-format ([a-z]+)/ + extension = matched_format[0][1] + if ( format_cmd == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" """ bamtools \\ convert \\ $args \\ -in $bam \\ - -out ${prefix}.${ext} + -out ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -39,14 +39,14 @@ process BAMTOOLS_CONVERT { """ stub: - prefix = task.ext.prefix ?: "${meta.id}" - def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ - if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" - m = args =~ /-format ([a-z]+)/ - ext = m[0][1] + def prefix = task.ext.prefix ?: "${meta.id}" + format_cmd = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ + matched_format = args =~ /-format ([a-z]+)/ + extension = matched_format[0][1] + if ( format_cmd == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" """ - touch ${prefix}.${ext} + touch ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml "${task.process}": bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' ) From 019ea1e04801fe667501959139ec1361cef994d6 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 24 Mar 2025 13:27:39 +0100 Subject: [PATCH 7/7] Fix spacing --- .../bamtools/convert/tests/main.nf.test | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/modules/nf-core/bamtools/convert/tests/main.nf.test b/modules/nf-core/bamtools/convert/tests/main.nf.test index 0fe2fa194330..d0ac7f16c91b 100644 --- a/modules/nf-core/bamtools/convert/tests/main.nf.test +++ b/modules/nf-core/bamtools/convert/tests/main.nf.test @@ -18,7 +18,7 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false], // meta map + [id:'test', single_end:false], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ @@ -32,8 +32,6 @@ nextflow_process { } } test("test_bamtools_convert_noext_error") { - - when { params { module_args = "" @@ -41,7 +39,7 @@ nextflow_process { process { """ input[0] = [ - [id:'test', single_end:false], // meta map + [id:'test', single_end:false], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ @@ -55,8 +53,6 @@ nextflow_process { } } test("test_bamtools_convert_bed") { - - when { params { module_args = "-format bed" @@ -64,8 +60,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -78,8 +74,6 @@ nextflow_process { } } test("test_bamtools_convert_fasta") { - - when { params { module_args = "-format fasta" @@ -87,8 +81,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -101,8 +95,6 @@ nextflow_process { } } test("test_bamtools_convert_fastq") { - - when { params { module_args = "-format fastq" @@ -110,8 +102,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -133,8 +125,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -156,8 +148,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -179,8 +171,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -200,8 +192,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ } @@ -222,8 +214,8 @@ nextflow_process { process { """ input[0] = [ - [id:'test',single_end:false],// meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam',checkIfExists:true) + [id:'test', single_end:false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists:true) ] """ }