Skip to content

Commit 5d65a94

Browse files
committed
Use shared test params for REGENIE runl1
1 parent 5048e82 commit 5d65a94

3 files changed

Lines changed: 221 additions & 21 deletions

File tree

modules/nf-core/regenie/runl1/tests/main.nf.test

Lines changed: 159 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
nextflow_process {
22

33
name "Test Process REGENIE_RUNL1"
4-
config "./nextflow.config"
54
script "../main.nf"
65
process "REGENIE_RUNL1"
6+
config "./nextflow.config"
77

88
tag "modules"
99
tag "modules_nfcore"
@@ -63,12 +63,7 @@ nextflow_process {
6363
.combine(REGENIE_SPLITL0.out.snplists)
6464
.flatMap { master_meta, master, snplist_meta, snplists ->
6565
(1..2).collect { job ->
66-
[
67-
master_meta,
68-
master,
69-
snplists.find { snplist -> snplist.getFileName().toString().contains('_job' + job + '.snplist') },
70-
job
71-
]
66+
[master_meta, master, snplists, job]
7267
}
7368
}
7469

@@ -98,13 +93,64 @@ nextflow_process {
9893
"""
9994
}
10095
}
96+
97+
run("REGENIE_SPLITL0", alias: "REGENIE_SPLITL0_PLINK2") {
98+
script "../../splitl0/main.nf"
99+
process {
100+
"""
101+
input[0] = [
102+
[ id:'plink_simulated_plink2' ],
103+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true),
104+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true),
105+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
106+
]
107+
108+
input[1] = [
109+
[ id:'plink_simulated_plink2' ],
110+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated_quantitative_phenoname.phe', checkIfExists: true)
111+
]
112+
113+
input[2] = [[:], []]
114+
input[3] = []
115+
input[4] = 2
116+
"""
117+
}
118+
}
119+
120+
run("REGENIE_RUNL0", alias: "REGENIE_RUNL0_PLINK2") {
121+
script "../../runl0/main.nf"
122+
process {
123+
"""
124+
input[0] = [
125+
[ id:'plink_simulated_plink2' ],
126+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true),
127+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true),
128+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
129+
]
130+
131+
input[1] = REGENIE_SPLITL0_PLINK2.out.master
132+
.combine(REGENIE_SPLITL0_PLINK2.out.snplists)
133+
.map { master_meta, master, snplist_meta, snplists ->
134+
[master_meta, master, snplists, 1]
135+
}
136+
137+
input[2] = [
138+
[ id:'plink_simulated_plink2' ],
139+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated_quantitative_phenoname.phe', checkIfExists: true)
140+
]
141+
142+
input[3] = [[:], []]
143+
input[4] = []
144+
"""
145+
}
146+
}
101147
}
102148

103149
test("homo_sapiens popgen - quantitative plink1 with covariates") {
104150

105151
when {
106152
params {
107-
module_args = '--phenoColList QuantitativeTrait'
153+
module_args = "--phenoColList QuantitativeTrait"
108154
}
109155
process {
110156
"""
@@ -147,6 +193,21 @@ nextflow_process {
147193
{ assert process.out.loco.get(0).get(0).id == 'plink_simulated' },
148194
{ assert process.out.log.get(0).get(0).id == 'plink_simulated' },
149195
{ assert path(process.out.log.get(0).get(1)).exists() },
196+
{
197+
def workDir = path(process.out.predictions.get(0).get(1)).parent
198+
def command = workDir.resolve('.command.sh').text
199+
def stagedNames = workDir.toFile().listFiles().collect { it.name }
200+
201+
assert command.contains('--run-l1 plink_simulated.master')
202+
assert command.contains('--bed plink_simulated')
203+
assert command.contains('--covarFile plink_simulated_covariates.txt')
204+
assert command.contains('--bsize 100')
205+
assert !command.contains('--pgen')
206+
assert stagedNames.contains('plink_simulated.bed')
207+
assert stagedNames.contains('plink_simulated.bim')
208+
assert stagedNames.contains('plink_simulated.fam')
209+
assert stagedNames.contains('plink_simulated.master')
210+
},
150211
{
151212
def predList = path(process.out.predictions.get(0).get(1))
152213
def locoFile = path(process.out.loco.get(0).get(1))
@@ -165,9 +226,99 @@ nextflow_process {
165226
def stableLoco = process.out.loco.collect { loco ->
166227
[loco[0], path(loco[1]).getFileName().toString()]
167228
}
229+
def stableLogs = process.out.log.collect { log ->
230+
[log[0], path(log[1]).getFileName().toString()]
231+
}
168232
assert snapshot(
169233
stablePredictions,
170234
stableLoco,
235+
stableLogs,
236+
process.out.findAll { key, val -> key.startsWith('versions') }
237+
).match()
238+
}
239+
)
240+
}
241+
242+
}
243+
244+
test("homo_sapiens popgen - quantitative plink2 without covariates") {
245+
246+
when {
247+
params {
248+
module_args = "--phenoColList QuantitativeTrait"
249+
module_prefix = "plink_simulated_plink2"
250+
}
251+
process {
252+
"""
253+
input[0] = [
254+
[ id:'plink_simulated_plink2' ],
255+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true),
256+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true),
257+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
258+
]
259+
260+
input[1] = REGENIE_SPLITL0_PLINK2.out.master
261+
.combine(REGENIE_SPLITL0_PLINK2.out.snplists)
262+
.combine(REGENIE_RUNL0_PLINK2.out.l0_predictions.map { it[1] }.collect())
263+
.map { values ->
264+
[ values[0], values[1], values[3], values.drop(4).flatten() ]
265+
}
266+
267+
input[2] = [
268+
[ id:'plink_simulated' ],
269+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated_quantitative_phenoname.phe', checkIfExists: true)
270+
]
271+
272+
input[3] = [
273+
[ id:'plink_simulated' ],
274+
[]
275+
]
276+
277+
input[4] = []
278+
"""
279+
}
280+
}
281+
282+
then {
283+
assertAll(
284+
{ assert process.success },
285+
{ assert process.out.predictions.size() == 1 },
286+
{ assert process.out.loco.size() == 1 },
287+
{ assert process.out.log.size() == 1 },
288+
{ assert process.out.predictions.get(0).get(0).id == 'plink_simulated_plink2' },
289+
{ assert process.out.loco.get(0).get(0).id == 'plink_simulated_plink2' },
290+
{ assert process.out.log.get(0).get(0).id == 'plink_simulated_plink2' },
291+
{
292+
def workDir = path(process.out.predictions.get(0).get(1)).parent
293+
def command = workDir.resolve('.command.sh').text
294+
def stagedNames = workDir.toFile().listFiles().collect { it.name }
295+
296+
assert command.contains('--run-l1 plink_simulated_plink2.master')
297+
assert command.contains('--pgen plink_simulated')
298+
assert command.contains('--bsize 1000')
299+
assert command.contains('--out plink_simulated_plink2')
300+
assert !command.contains('--bed')
301+
assert !command.contains('--covarFile')
302+
assert command.contains('--phenoColList QuantitativeTrait')
303+
assert stagedNames.contains('plink_simulated.pgen')
304+
assert stagedNames.contains('plink_simulated.psam')
305+
assert stagedNames.contains('plink_simulated.pvar')
306+
assert stagedNames.contains('plink_simulated_plink2.master')
307+
},
308+
{
309+
def stablePredictions = process.out.predictions.collect { prediction ->
310+
[prediction[0], path(prediction[1]).getFileName().toString()]
311+
}
312+
def stableLoco = process.out.loco.collect { loco ->
313+
[loco[0], path(loco[1]).getFileName().toString()]
314+
}
315+
def stableLogs = process.out.log.collect { log ->
316+
[log[0], path(log[1]).getFileName().toString()]
317+
}
318+
assert snapshot(
319+
stablePredictions,
320+
stableLoco,
321+
stableLogs,
171322
process.out.findAll { key, val -> key.startsWith('versions') }
172323
).match()
173324
}
@@ -181,9 +332,6 @@ nextflow_process {
181332
options "-stub"
182333

183334
when {
184-
params {
185-
module_args = '--phenoColList QuantitativeTrait'
186-
}
187335
process {
188336
"""
189337
input[0] = [

modules/nf-core/regenie/runl1/tests/main.nf.test.snap

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"plink_simulated_1.loco.gz"
1818
]
1919
],
20+
[
21+
[
22+
{
23+
"id": "plink_simulated"
24+
},
25+
"plink_simulated.log"
26+
]
27+
],
2028
{
2129
"versions_regenie": [
2230
[
@@ -31,7 +39,7 @@
3139
"nf-test": "0.9.3",
3240
"nextflow": "25.10.4"
3341
},
34-
"timestamp": "2026-05-21T22:36:12.351327082"
42+
"timestamp": "2026-05-27T19:57:18.939854903"
3543
},
3644
"homo_sapiens popgen - plink1 - stub": {
3745
"content": [
@@ -73,6 +81,48 @@
7381
"nf-test": "0.9.3",
7482
"nextflow": "25.10.4"
7583
},
76-
"timestamp": "2026-05-21T22:37:19.177658994"
84+
"timestamp": "2026-05-27T18:59:13.646476959"
85+
},
86+
"homo_sapiens popgen - quantitative plink2 without covariates": {
87+
"content": [
88+
[
89+
[
90+
{
91+
"id": "plink_simulated_plink2"
92+
},
93+
"plink_simulated_plink2_pred.list"
94+
]
95+
],
96+
[
97+
[
98+
{
99+
"id": "plink_simulated_plink2"
100+
},
101+
"plink_simulated_plink2_1.loco.gz"
102+
]
103+
],
104+
[
105+
[
106+
{
107+
"id": "plink_simulated_plink2"
108+
},
109+
"plink_simulated_plink2.log"
110+
]
111+
],
112+
{
113+
"versions_regenie": [
114+
[
115+
"REGENIE_RUNL1",
116+
"regenie",
117+
"4.1.2"
118+
]
119+
]
120+
}
121+
],
122+
"meta": {
123+
"nf-test": "0.9.3",
124+
"nextflow": "25.10.4"
125+
},
126+
"timestamp": "2026-05-27T19:57:40.719017173"
77127
}
78-
}
128+
}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
params {
2+
module_args = ""
3+
module_prefix = null
4+
}
5+
16
process {
2-
withName: REGENIE_SPLITL0 {
3-
ext.args = params.module_args
4-
}
5-
withName: REGENIE_RUNL0 {
6-
ext.args = params.module_args
7+
withName: "REGENIE_SPLITL0|REGENIE_RUNL0|REGENIE_RUNL1|REGENIE_SPLITL0_PLINK2|REGENIE_RUNL0_PLINK2" {
8+
ext.args = { params.module_args ?: "" }
79
}
8-
withName: REGENIE_RUNL1 {
9-
ext.args = params.module_args
10+
withName: "REGENIE_SPLITL0_PLINK2|REGENIE_RUNL0_PLINK2|REGENIE_RUNL1" {
11+
ext.prefix = { params.module_prefix }
1012
}
1113
}

0 commit comments

Comments
 (0)