Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bcftools_conensus stub section and tests #6219

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/nf-core/bcftools/consensus/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process BCFTOOLS_CONSENSUS {
'biocontainers/bcftools:1.20--h8b25389_0' }"

input:
tuple val(meta), path(vcf), path(tbi), path(fasta)
tuple val(meta), path(vcf), path(tbi), path(fasta), path(mask)

output:
tuple val(meta), path('*.fa'), emit: fasta
Expand All @@ -20,6 +20,7 @@ process BCFTOOLS_CONSENSUS {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def masking = mask ? "-m $mask" : ""
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
"""
cat $fasta \\
| bcftools \\
Expand Down
4 changes: 4 additions & 0 deletions modules/nf-core/bcftools/consensus/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ input:
type: file
description: FASTA reference file
pattern: "*.{fasta,fa}"
- mask:
type: file
description: BED file used for masking
pattern: "*.{bed}"
output:
- meta:
type: map
Expand Down
90 changes: 90 additions & 0 deletions modules/nf-core/bcftools/consensus/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
nextflow_process {

name "Test Process BCFTOOLS_CONSENSUS"
script "../main.nf"
process "BCFTOOLS_CONSENSUS"

tag "modules"
tag "modules_nfcore"
tag "bcftools"
tag "bcftools/consensus"

test("bcftools - test") {

tag "bcftools_consensus"

when {
process{
"""
input[0] = [
[ id:'test'],
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)
]
"""
}
}

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

test("bcftools - test - no mask") {

tag "bcftools_consensus"

when {
process{
"""
input[0] = [
[ id:'test'],
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
[]
]
"""
}
}

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

test("bcftools - stub - test") {

tag "stub"
options '-stub'

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match()}
)
}
}
}
101 changes: 101 additions & 0 deletions modules/nf-core/bcftools/consensus/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"bcftools - stub - test": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"1": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
],
"fasta": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"versions": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-08-20T13:44:15.19417273"
},
"bcftools - test": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"1": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
],
"fasta": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"versions": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-08-20T13:44:00.226704222"
},
"bcftools - test - no mask": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"1": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
],
"fasta": [
[
{
"id": "test"
},
"test.fa:md5,e57d3e4d113f989bc069c5fd61627091"
]
],
"versions": [
"versions.yml:md5,b5e1ca5013c29fa37855fe929fb21a65"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-08-20T13:44:07.834757647"
}
}
Loading