Skip to content

Commit

Permalink
Add nf-test for biscuit/bsconv (#4493)
Browse files Browse the repository at this point in the history
* Add nf-test for biscuit/bsconv

* Add stub and stub test

---------

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
  • Loading branch information
karthikram-takara and SPPearce committed May 7, 2024
1 parent 2a2b13f commit 606a549
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 58 deletions.
16 changes: 16 additions & 0 deletions modules/nf-core/biscuit/bsconv/main.nf
Expand Up @@ -37,4 +37,20 @@ process BISCUIT_BSCONV {
biscuit: \$( biscuit version |& sed '1!d; s/^.*BISCUIT Version: //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

"""
touch ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
biscuit: \$( biscuit version |& sed '1!d; s/^.*BISCUIT Version: //' )
END_VERSIONS
"""


}
2 changes: 1 addition & 1 deletion modules/nf-core/biscuit/bsconv/meta.yml
Expand Up @@ -29,7 +29,7 @@ input:
type: file
description: BAM file index
- index:
type: dir
type: directory
description: Biscuit genome index directory (generated with 'biscuit index')
pattern: "BiscuitIndex"
output:
Expand Down
75 changes: 75 additions & 0 deletions modules/nf-core/biscuit/bsconv/tests/main.nf.test
@@ -0,0 +1,75 @@
nextflow_process {

name "Test Process BISCUIT_BSCONV"
script "../main.nf"
process "BISCUIT_BSCONV"
tag "modules"
tag "modules_nfcore"
tag "biscuit"
tag "biscuit/bsconv"
tag "biscuit/index"


setup {
run("BISCUIT_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
"""
}
}
}

test("sarscov2-pe - bam") {

when {
process {
"""
input[0] = [ [id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam_bai'], checkIfExists: true)
]
input[1] = BISCUIT_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.bsconv_bam).match("bsconv_bam") },
{ assert snapshot(process.out.versions).match("versions") }
)
}

}

test("sarscov2-pe - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam_bai'], checkIfExists: true)
]
input[1] = BISCUIT_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
67 changes: 67 additions & 0 deletions modules/nf-core/biscuit/bsconv/tests/main.nf.test.snap
@@ -0,0 +1,67 @@
{
"versions": {
"content": [
[
"versions.yml:md5,45455cc9522a3235fa482ad065a242b3"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-07T15:28:04.601734997"
},
"sarscov2-pe - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,45455cc9522a3235fa482ad065a242b3"
],
"bsconv_bam": [
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,45455cc9522a3235fa482ad065a242b3"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-07T15:28:14.729945289"
},
"bsconv_bam": {
"content": [
[
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,0d425851bd18963ebf1b6d727a7d02c7"
]
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-07T15:28:04.580771449"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/biscuit/bsconv/tests/tags.yml
@@ -0,0 +1,2 @@
biscuit/bsconv:
- "modules/nf-core/biscuit/bsconv/**"
4 changes: 0 additions & 4 deletions tests/config/pytest_modules.yml
Expand Up @@ -195,10 +195,6 @@ biscuit/biscuitblaster:
- modules/nf-core/biscuit/index/**
- modules/nf-core/biscuit/biscuitblaster/**
- tests/modules/nf-core/biscuit/biscuitblaster/**
biscuit/bsconv:
- modules/nf-core/biscuit/index/**
- modules/nf-core/biscuit/bsconv/**
- tests/modules/nf-core/biscuit/bsconv/**
biscuit/epiread:
- modules/nf-core/biscuit/index/**
- modules/nf-core/biscuit/epiread/**
Expand Down
19 changes: 0 additions & 19 deletions tests/modules/nf-core/biscuit/bsconv/main.nf

This file was deleted.

10 changes: 0 additions & 10 deletions tests/modules/nf-core/biscuit/bsconv/nextflow.config

This file was deleted.

24 changes: 0 additions & 24 deletions tests/modules/nf-core/biscuit/bsconv/test.yml

This file was deleted.

0 comments on commit 606a549

Please sign in to comment.