@@ -40,6 +40,20 @@ nextflow_process {
4040 }
4141 }
4242
43+ run("GAWK", alias: "GAWK_BINARY_PHENOTYPE") {
44+ script "../../../gawk/main.nf"
45+ process {
46+ """
47+ input[0] = [
48+ [ id:'BinaryTrait' ],
49+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated_binary_phenoname.phe', checkIfExists: true)
50+ ]
51+ input[1] = Channel.of('FNR == 1 { next } { print \$1, \$2, \$3 + 1 }').collectFile(name:'binary_phenotypes.awk')
52+ input[2] = false
53+ """
54+ }
55+ }
56+
4357 run("GAWK", alias: "GAWK_QUANTITATIVE_COVARIATES") {
4458 script "../../../gawk/main.nf"
4559 process {
@@ -68,14 +82,16 @@ nextflow_process {
6882 }
6983 }
7084
71- run("GCTA_MAKEGRMPART", alias: "GCTA_MAKEGRM_LDMS1 ") {
85+ run("GCTA_MAKEGRMPART", alias: "GCTA_MAKEGRMPART_LDMS1 ") {
7286 script "../../makegrmpart/main.nf"
7387 process {
7488 """
7589 file('plink_simulated.mbfile').text = 'plink_simulated\\n'
7690
7791 input[0] = [
78- [ id:'plink_simulated_ldms1', part_gcta_job:1, nparts_gcta:1 ],
92+ [ id:'plink_simulated_ldms1' ],
93+ 1,
94+ 1,
7995 file('plink_simulated.mbfile'),
8096 [
8197 file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true)
@@ -98,17 +114,16 @@ nextflow_process {
98114 when {
99115 process {
100116 """
101- input[0] = GAWK_MULTI_PHENOTYPES.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitMpheno2' ], pheno] }
117+ input[0] = GAWK_MULTI_PHENOTYPES.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitMpheno2' ], pheno, 2, [] ] }
102118 input[1] = Channel
103119 .of('plink_simulated_ldms1.part_1_1')
104120 .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
105- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
106- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
107- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
121+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
122+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
123+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
108124 }
109125 input[2] = GAWK_QUANTITATIVE_COVARIATES.out.output
110126 input[3] = GAWK_CATEGORICAL_COVARIATES.out.output
111- input[4] = 2
112127 """
113128 }
114129 }
@@ -133,17 +148,16 @@ nextflow_process {
133148 when {
134149 process {
135150 """
136- input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output
151+ input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output.map { meta, pheno -> [meta, pheno, 1, []] }
137152 input[1] = Channel
138153 .of('plink_simulated_ldms1.part_1_1')
139154 .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
140- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
141- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
142- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
155+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
156+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
157+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
143158 }
144159 input[2] = GAWK_QUANTITATIVE_COVARIATES.out.output
145160 input[3] = GAWK_CATEGORICAL_COVARIATES.out.output
146- input[4] = 1
147161 """
148162 }
149163 }
@@ -168,17 +182,16 @@ nextflow_process {
168182 when {
169183 process {
170184 """
171- input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output
185+ input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output.map { meta, pheno -> [meta, pheno, 1, null] }
172186 input[1] = Channel
173187 .of('plink_simulated_ldms1.part_1_1')
174188 .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
175- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
176- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
177- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
189+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
190+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
191+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
178192 }
179193 input[2] = [[ id:'covariates_quant' ], []]
180194 input[3] = [[ id:'covariates_cat' ], []]
181- input[4] = 1
182195 """
183196 }
184197 }
@@ -198,22 +211,55 @@ nextflow_process {
198211 }
199212 }
200213
214+ test("homo_sapiens gsmr - binary phenotype with ldms mgrm and prevalence") {
215+ config "./nextflow.config"
216+ when {
217+ process {
218+ """
219+ input[0] = GAWK_BINARY_PHENOTYPE.out.output.map { meta, pheno -> [[ id:'BinaryTraitPrevalence' ], pheno, 1, 0.1] }
220+ input[1] = Channel
221+ .of('plink_simulated_ldms1.part_1_1')
222+ .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
223+ .combine(GCTA_MAKEGRMPART_LDMS1.out.grm_files)
224+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
225+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files]
226+ }
227+ input[2] = [[ id:'covariates_quant' ], []]
228+ input[3] = [[ id:'covariates_cat' ], []]
229+ """
230+ }
231+ }
232+
233+ then {
234+ assertAll(
235+ { assert process.success },
236+ { assert process.out.reml_results.size() == 1 },
237+ { assert process.out.reml_results.get(0).get(0).id == "BinaryTraitPrevalence" },
238+ {
239+ assert snapshot(
240+ process.out.reml_results,
241+ process.out.findAll { key, val -> key.startsWith('versions') }
242+ ).match()
243+ }
244+ )
245+ }
246+ }
247+
201248 test("homo_sapiens gsmr - ldms mgrm mpheno defaults to first phenotype when empty") {
202249 config "./nextflow.config"
203250 when {
204251 process {
205252 """
206- input[0] = GAWK_MULTI_PHENOTYPES.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitMphenoDefault' ], pheno] }
253+ input[0] = GAWK_MULTI_PHENOTYPES.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitMphenoDefault' ], pheno, [], [] ] }
207254 input[1] = Channel
208255 .of('plink_simulated_ldms1.part_1_1')
209256 .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
210- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
211- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
212- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
257+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
258+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
259+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
213260 }
214261 input[2] = GAWK_QUANTITATIVE_COVARIATES.out.output
215262 input[3] = GAWK_CATEGORICAL_COVARIATES.out.output
216- input[4] = []
217263 """
218264 }
219265 }
@@ -238,17 +284,16 @@ nextflow_process {
238284 when {
239285 process {
240286 """
241- input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitInvalidLdms' ], pheno] }
287+ input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output.map { meta, pheno -> [[ id:'QuantitativeTraitInvalidLdms' ], pheno, 1, [] ] }
242288 input[1] = Channel
243289 .of('plink_simulated_ldms_missing.part_1_1')
244290 .collectFile(name:'plink_simulated_ldms_broken.mgrm', newLine: true)
245- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
246- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
247- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
291+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
292+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
293+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
248294 }
249295 input[2] = GAWK_QUANTITATIVE_COVARIATES.out.output
250296 input[3] = GAWK_CATEGORICAL_COVARIATES.out.output
251- input[4] = 1
252297 """
253298 }
254299 }
@@ -268,17 +313,16 @@ nextflow_process {
268313 when {
269314 process {
270315 """
271- input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output
316+ input[0] = GAWK_QUANTITATIVE_PHENOTYPE.out.output.map { meta, pheno -> [meta, pheno, 1, []] }
272317 input[1] = Channel
273318 .of('plink_simulated_ldms1.part_1_1')
274319 .collectFile(name:'plink_simulated_ldms.mgrm', newLine: true)
275- .combine(GCTA_MAKEGRM_LDMS1 .out.grm_files)
276- .map { mgrm_file, meta, grm_id, grm_bin, grm_n_bin ->
277- [[ id:'plink_simulated_ldms' ], mgrm_file, [grm_id, grm_bin, grm_n_bin] ]
320+ .combine(GCTA_MAKEGRMPART_LDMS1 .out.grm_files)
321+ .map { mgrm_file, meta, grm_files, nparts_gcta, part_gcta_job ->
322+ [[ id:'plink_simulated_ldms' ], mgrm_file, grm_files ]
278323 }
279324 input[2] = [[ id:'covariates_quant' ], []]
280325 input[3] = [[ id:'covariates_cat' ], []]
281- input[4] = 1
282326 """
283327 }
284328 }
0 commit comments