diff --git a/modules/nf-core/samtools/faidx/environment.yml b/modules/nf-core/samtools/faidx/environment.yml index 3e95dd718a7..9c24eb0ab3c 100644 --- a/modules/nf-core/samtools/faidx/environment.yml +++ b/modules/nf-core/samtools/faidx/environment.yml @@ -1,8 +1,10 @@ name: samtools_faidx + channels: - conda-forge - bioconda - defaults + dependencies: - - bioconda::samtools=1.19.2 - bioconda::htslib=1.19.1 + - bioconda::samtools=1.19.2 diff --git a/modules/nf-core/samtools/faidx/meta.yml b/modules/nf-core/samtools/faidx/meta.yml index e189af28fd0..f3c25de20f4 100644 --- a/modules/nf-core/samtools/faidx/meta.yml +++ b/modules/nf-core/samtools/faidx/meta.yml @@ -39,6 +39,10 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - fa: + type: file + description: FASTA file + pattern: "*.{fa}" - fai: type: file description: FASTA index file diff --git a/modules/nf-core/samtools/faidx/tests/main.nf.test b/modules/nf-core/samtools/faidx/tests/main.nf.test new file mode 100644 index 00000000000..136b2126797 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/main.nf.test @@ -0,0 +1,123 @@ +nextflow_process { + + name "Test Process SAMTOOLS_FAIDX" + script "../main.nf" + process "SAMTOOLS_FAIDX" + + tag "modules" + tag "modules_nfcore" + tag "samtools" + tag "samtools/faidx" + + test("test_samtools_faidx") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_bgzip") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta_gz'], checkIfExists: true) ] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_fasta") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + + input[1] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_stub_fasta") { + + config "./nextflow2.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + + input[1] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_stub_fai") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} \ No newline at end of file diff --git a/modules/nf-core/samtools/faidx/tests/main.nf.test.snap b/modules/nf-core/samtools/faidx/tests/main.nf.test.snap new file mode 100644 index 00000000000..3e651ef680d --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/main.nf.test.snap @@ -0,0 +1,249 @@ +{ + "test_samtools_faidx": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:22:39.412601" + }, + "test_samtools_faidx_bgzip": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.gzi:md5,7dea362b3fac8e00956a4952a3d4f474" + ] + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.gzi:md5,7dea362b3fac8e00956a4952a3d4f474" + ] + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:23:22.427966" + }, + "test_samtools_faidx_fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,6a0774a0ad937ba0bfd2ac7457d90f36" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,6a0774a0ad937ba0bfd2ac7457d90f36" + ] + ], + "fai": [ + + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:24:04.107537" + }, + "test_samtools_faidx_stub_fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "fai": [ + + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:24:45.868463" + }, + "test_samtools_faidx_stub_fai": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:25:27.550554" + } +} \ No newline at end of file diff --git a/modules/nf-core/samtools/faidx/tests/nextflow.config b/modules/nf-core/samtools/faidx/tests/nextflow.config new file mode 100644 index 00000000000..f76a3ba09b1 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: SAMTOOLS_FAIDX { + ext.args = 'MT192765.1 -o extract.fa' + } + +} diff --git a/modules/nf-core/samtools/faidx/tests/nextflow2.config b/modules/nf-core/samtools/faidx/tests/nextflow2.config new file mode 100644 index 00000000000..33ebbd5df7f --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/nextflow2.config @@ -0,0 +1,6 @@ +process { + + withName: SAMTOOLS_FAIDX { + ext.args = '-o extract.fa' + } +} diff --git a/modules/nf-core/samtools/faidx/tests/tags.yml b/modules/nf-core/samtools/faidx/tests/tags.yml new file mode 100644 index 00000000000..e4a839481d2 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/tags.yml @@ -0,0 +1,2 @@ +samtools/faidx: + - modules/nf-core/samtools/faidx/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 379cc2b4057..6d006c915e1 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1844,9 +1844,6 @@ samtools/depth: samtools/dict: - modules/nf-core/samtools/dict/** - tests/modules/nf-core/samtools/dict/** -samtools/faidx: - - modules/nf-core/samtools/faidx/** - - tests/modules/nf-core/samtools/faidx/** samtools/fasta: - modules/nf-core/samtools/fasta/** - tests/modules/nf-core/samtools/fasta/** diff --git a/tests/modules/nf-core/samtools/faidx/main.nf b/tests/modules/nf-core/samtools/faidx/main.nf deleted file mode 100644 index 8fa3bc6fa85..00000000000 --- a/tests/modules/nf-core/samtools/faidx/main.nf +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SAMTOOLS_FAIDX } from '../../../../../modules/nf-core/samtools/faidx/main.nf' - -workflow test_samtools_faidx { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - - SAMTOOLS_FAIDX ( input, [[],[]] ) -} - -workflow test_samtools_faidx_bgzip { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta_gz'], checkIfExists: true) ] - - SAMTOOLS_FAIDX ( input, [[],[]] ) -} - -workflow test_samtools_faidx_fasta { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - fai = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] - - SAMTOOLS_FAIDX ( input, fai ) -} - -workflow test_samtools_faidx_stub_fasta { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - fai = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] - - SAMTOOLS_FAIDX ( input, fai ) -} - -workflow test_samtools_faidx_stub_fai { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - - SAMTOOLS_FAIDX ( input, [[],[]] ) -} diff --git a/tests/modules/nf-core/samtools/faidx/nextflow.config b/tests/modules/nf-core/samtools/faidx/nextflow.config deleted file mode 100644 index cb1472e052e..00000000000 --- a/tests/modules/nf-core/samtools/faidx/nextflow.config +++ /dev/null @@ -1,11 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: 'test_samtools_faidx_fasta:SAMTOOLS_FAIDX' { - ext.args = 'MT192765.1 -o extract.fa' - } - withName: 'test_samtools_faidx_stub_fasta:SAMTOOLS_FAIDX' { - ext.args = '-o extract.fa' - } -} diff --git a/tests/modules/nf-core/samtools/faidx/test.yml b/tests/modules/nf-core/samtools/faidx/test.yml deleted file mode 100644 index cc161244cc8..00000000000 --- a/tests/modules/nf-core/samtools/faidx/test.yml +++ /dev/null @@ -1,48 +0,0 @@ -- name: samtools faidx test_samtools_faidx - command: nextflow run ./tests/modules/nf-core/samtools/faidx -entry test_samtools_faidx -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/samtools/faidx/nextflow.config - tags: - - samtools/faidx - - samtools - files: - - path: output/samtools/genome.fasta.fai - md5sum: 9da2a56e2853dc8c0b86a9e7229c9fe5 - - path: output/samtools/versions.yml - -- name: samtools faidx test_samtools_faidx_bgzip - command: nextflow run ./tests/modules/nf-core/samtools/faidx -entry test_samtools_faidx_bgzip -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/samtools/faidx/nextflow.config - tags: - - samtools/faidx - - samtools - files: - - path: output/samtools/genome.fasta.gz.fai - md5sum: 9da2a56e2853dc8c0b86a9e7229c9fe5 - - path: output/samtools/genome.fasta.gz.gzi - md5sum: 7dea362b3fac8e00956a4952a3d4f474 - - path: output/samtools/versions.yml - -- name: samtools faidx test_samtools_faidx_fasta - command: nextflow run ./tests/modules/nf-core/samtools/faidx -entry test_samtools_faidx_fasta -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/samtools/faidx/nextflow.config - tags: - - samtools/faidx - - samtools - files: - - path: output/samtools/extract.fa - - path: output/samtools/versions.yml - -- name: samtools faidx test_samtools_faidx_stub_fasta - command: nextflow run ./tests/modules/nf-core/samtools/faidx -entry test_samtools_faidx_stub_fasta -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/samtools/faidx/nextflow.config -stub - tags: - - samtools/faidx - - samtools - files: - - path: output/samtools/extract.fa - - path: output/samtools/versions.yml - -- name: samtools faidx test_samtools_faidx_stub_fai - command: nextflow run ./tests/modules/nf-core/samtools/faidx -entry test_samtools_faidx_stub_fai -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/samtools/faidx/nextflow.config -stub - tags: - - samtools/faidx - - samtools - files: - - path: output/samtools/genome.fasta.fai - - path: output/samtools/versions.yml