11nextflow_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] = [
0 commit comments