Skip to content

Commit

Permalink
add nf-test to samtools/faidx - nf-core#3936 (nf-core#5177)
Browse files Browse the repository at this point in the history
* add nf-test to samtools/faidx

* delete old test files

* Update tags.yml

* change nextflow config to get good test inputs

---------

Co-authored-by: LE BARS Victor <[email protected]>
Co-authored-by: Louis LE NEZET <[email protected]>
  • Loading branch information
3 people authored Mar 18, 2024
1 parent 0a7b366 commit aeb02a3
Show file tree
Hide file tree
Showing 11 changed files with 394 additions and 112 deletions.
4 changes: 3 additions & 1 deletion modules/nf-core/samtools/faidx/environment.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions modules/nf-core/samtools/faidx/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
123 changes: 123 additions & 0 deletions modules/nf-core/samtools/faidx/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}
}

}
249 changes: 249 additions & 0 deletions modules/nf-core/samtools/faidx/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aeb02a3

Please sign in to comment.