Skip to content

Commit d7ce2bd

Browse files
LouisLeNezetLouisLeNezetLouisLeNezet
authored
Migrate vcf_gather_bcftools to nf-test (#8524)
* Migrate to nf-test * Remove groupKey --------- Co-authored-by: LouisLeNezet <[email protected]> Co-authored-by: LouisLeNezet <[email protected]>
1 parent bfa183c commit d7ce2bd

File tree

7 files changed

+241
-113
lines changed

7 files changed

+241
-113
lines changed

subworkflows/nf-core/vcf_gather_bcftools/main.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ workflow VCF_GATHER_BCFTOOLS {
1515
ch_versions = Channel.empty()
1616

1717
ch_concat_input = ch_vcfs.join(ch_scatter_output)
18-
.map{ meta, vcf, tbi, bed, gather_count ->
18+
.map{ meta, vcf, tbi, _bed, gather_count ->
1919
meta = val_common_meta ? meta + [id:meta[val_common_meta]] : meta
2020
[ groupKey(meta, gather_count), vcf, tbi ]
2121
}.groupTuple()
22+
.map { meta, vcf, tbi -> [meta.target, vcf, tbi] }
2223

2324
BCFTOOLS_CONCAT ( ch_concat_input )
2425
ch_versions = ch_versions.mix(BCFTOOLS_CONCAT.out.versions)
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
nextflow_workflow {
2+
3+
name "Test Workflow VCF_GATHER_BCFTOOLS"
4+
script "../main.nf"
5+
workflow "VCF_GATHER_BCFTOOLS"
6+
7+
tag "subworkflows"
8+
tag "subworkflows_nfcore"
9+
tag "subworkflows/vcf_gather_bcftools"
10+
tag "vcf_gather_bcftools"
11+
12+
tag "bcftools/concat"
13+
tag "bcftools/sort"
14+
tag "bcftools"
15+
tag "tabix/tabix"
16+
tag "tabix"
17+
18+
test("homo_sapiens - [vcf, tbi] [vcf, tbi] - meta [] 2 - sample - true") {
19+
when {
20+
workflow {
21+
"""
22+
input[0] = Channel.of(
23+
[
24+
[id:'test_1',sample:'test'],
25+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz', checkIfExists:true),
26+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi', checkIfExists:true)
27+
],
28+
[
29+
[id:'test_2',sample:'test'],
30+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists:true),
31+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi', checkIfExists:true)
32+
]
33+
)
34+
input[1] = Channel.of(
35+
[ [id:'test_1',sample:'test'], [], 2 ],
36+
[ [id:'test_2',sample:'test'], [], 2 ]
37+
)
38+
input[2] = 'sample'
39+
input[3] = true
40+
"""
41+
}
42+
}
43+
then {
44+
assertAll(
45+
{ assert workflow.success },
46+
{ assert snapshot(
47+
workflow.out.vcf.collect{ path(it[1]).vcf.variantsMD5 },
48+
workflow.out.tbi.collect{ file(it[1]).name },
49+
workflow.out.versions
50+
).match() }
51+
)
52+
}
53+
}
54+
test("homo_sapiens no_meta - [vcf, tbi] [vcf, tbi] - meta equal [] 2 - [] - true") {
55+
when {
56+
workflow {
57+
"""
58+
input[0] = Channel.of(
59+
[
60+
[id:'test'],
61+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz',checkIfExists:true),
62+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi',checkIfExists:true)
63+
],
64+
[
65+
[id:'test'],
66+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz',checkIfExists:true),
67+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi',checkIfExists:true)
68+
]
69+
)
70+
input[1] = Channel.of(
71+
[ [id:'test'], [], 2 ],
72+
[ [id:'test'], [], 2 ]
73+
)
74+
input[2] = []
75+
input[3] = true
76+
"""
77+
}
78+
}
79+
then {
80+
assertAll(
81+
{ assert workflow.success },
82+
{ assert snapshot(
83+
workflow.out.vcf.collect{ path(it[1]).vcf.variantsMD5 },
84+
workflow.out.tbi.collect{ file(it[1]).name },
85+
workflow.out.versions
86+
).match() }
87+
)
88+
}
89+
}
90+
91+
test("homo_sapiens no_meta - [vcf, tbi] [vcf, tbi] - meta equal [] 2 - [] - true -- stub") {
92+
options "-stub"
93+
when {
94+
workflow {
95+
"""
96+
input[0] = Channel.of(
97+
[
98+
[id:'test'],
99+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz',checkIfExists:true),
100+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi',checkIfExists:true)
101+
],
102+
[
103+
[id:'test'],
104+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz',checkIfExists:true),
105+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi',checkIfExists:true)
106+
]
107+
)
108+
input[1] = Channel.of(
109+
[ [id:'test'], [], 2 ],
110+
[ [id:'test'], [], 2 ]
111+
)
112+
input[2] = []
113+
input[3] = true
114+
"""
115+
}
116+
}
117+
then {
118+
assertAll(
119+
{ assert workflow.success },
120+
{ assert snapshot(
121+
workflow.out,
122+
workflow.out.versions.collect{ path(it).yaml }
123+
).match() }
124+
)
125+
}
126+
}
127+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"homo_sapiens - [vcf, tbi] [vcf, tbi] - meta [] 2 - sample - true": {
3+
"content": [
4+
[
5+
"27f188f2e0aeb3af6723aa52beb11edc"
6+
],
7+
[
8+
"test.vcf.gz.tbi"
9+
],
10+
[
11+
"versions.yml:md5,185c543cc7cb5a077974b7f30fc4c668",
12+
"versions.yml:md5,a1f631d2e625bc6eeba98485d6f36f3b",
13+
"versions.yml:md5,e0acb75282e79017ab0cac41793b88b2"
14+
]
15+
],
16+
"meta": {
17+
"nf-test": "0.9.2",
18+
"nextflow": "24.10.4"
19+
},
20+
"timestamp": "2025-05-20T22:17:10.97599428"
21+
},
22+
"homo_sapiens no_meta - [vcf, tbi] [vcf, tbi] - meta equal [] 2 - [] - true": {
23+
"content": [
24+
[
25+
"27f188f2e0aeb3af6723aa52beb11edc"
26+
],
27+
[
28+
"test.vcf.gz.tbi"
29+
],
30+
[
31+
"versions.yml:md5,185c543cc7cb5a077974b7f30fc4c668",
32+
"versions.yml:md5,a1f631d2e625bc6eeba98485d6f36f3b",
33+
"versions.yml:md5,e0acb75282e79017ab0cac41793b88b2"
34+
]
35+
],
36+
"meta": {
37+
"nf-test": "0.9.2",
38+
"nextflow": "24.10.4"
39+
},
40+
"timestamp": "2025-05-20T22:18:35.639623638"
41+
},
42+
"homo_sapiens no_meta - [vcf, tbi] [vcf, tbi] - meta equal [] 2 - [] - true -- stub": {
43+
"content": [
44+
{
45+
"0": [
46+
[
47+
{
48+
"id": "test"
49+
},
50+
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
51+
]
52+
],
53+
"1": [
54+
[
55+
{
56+
"id": "test"
57+
},
58+
"test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
59+
]
60+
],
61+
"2": [
62+
"versions.yml:md5,185c543cc7cb5a077974b7f30fc4c668",
63+
"versions.yml:md5,a1f631d2e625bc6eeba98485d6f36f3b",
64+
"versions.yml:md5,e0acb75282e79017ab0cac41793b88b2"
65+
],
66+
"tbi": [
67+
[
68+
{
69+
"id": "test"
70+
},
71+
"test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
72+
]
73+
],
74+
"vcf": [
75+
[
76+
{
77+
"id": "test"
78+
},
79+
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
80+
]
81+
],
82+
"versions": [
83+
"versions.yml:md5,185c543cc7cb5a077974b7f30fc4c668",
84+
"versions.yml:md5,a1f631d2e625bc6eeba98485d6f36f3b",
85+
"versions.yml:md5,e0acb75282e79017ab0cac41793b88b2"
86+
]
87+
},
88+
[
89+
{
90+
"VCF_GATHER_BCFTOOLS:BCFTOOLS_CONCAT": {
91+
"bcftools": 1.21
92+
}
93+
},
94+
{
95+
"VCF_GATHER_BCFTOOLS:TABIX_TABIX": {
96+
"tabix": 1.21
97+
}
98+
},
99+
{
100+
"VCF_GATHER_BCFTOOLS:BCFTOOLS_SORT": {
101+
"bcftools": 1.21
102+
}
103+
}
104+
]
105+
],
106+
"meta": {
107+
"nf-test": "0.9.2",
108+
"nextflow": "24.10.5"
109+
},
110+
"timestamp": "2025-05-21T11:02:14.638491736"
111+
}
112+
}

tests/config/pytest_modules.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ subworkflows/bam_variant_calling_sort_freebayes_bcftools:
6868
subworkflows/fasta_index_dna:
6969
- subworkflows/nf-core/fasta_index_dna/**
7070
- tests/subworkflows/nf-core/fasta_index_dna/**
71-
subworkflows/vcf_gather_bcftools:
72-
- subworkflows/nf-core/vcf_gather_bcftools/**
73-
- tests/subworkflows/nf-core/vcf_gather_bcftools/**
7471
subworkflows/vcf_phase_shapeit5:
7572
- subworkflows/nf-core/vcf_phase_shapeit5/**
7673
- tests/subworkflows/nf-core/vcf_phase_shapeit5/**

tests/subworkflows/nf-core/vcf_gather_bcftools/main.nf

Lines changed: 0 additions & 71 deletions
This file was deleted.

tests/subworkflows/nf-core/vcf_gather_bcftools/nextflow.config

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/subworkflows/nf-core/vcf_gather_bcftools/test.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)