@@ -9,57 +9,37 @@ nextflow_process {
99 tag "gcta"
1010 tag "gcta/addgrms"
1111 tag "gcta/makegrmpart"
12- tag "gawk"
1312
1413 setup {
15- run("GAWK", alias: "GAWK_VARIANTS_LDMS1") {
16- script "../../../gawk/main.nf"
17- process {
18- """
19- input[0] = [
20- [ id:'plink_simulated_ldms1_variants' ],
21- file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
22- ]
23- input[1] = Channel.of('NR <= 110 { print \$2 }').collectFile(name:'ldms1_variants.awk')
24- input[2] = false
25- """
26- }
27- }
28-
29- run("GAWK", alias: "GAWK_VARIANTS_LDMS2") {
30- script "../../../gawk/main.nf"
31- process {
32- """
33- input[0] = [
34- [ id:'plink_simulated_ldms2_variants' ],
35- file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
36- ]
37- input[1] = Channel.of('NR > 110 { print \$2 }').collectFile(name:'ldms2_variants.awk')
38- input[2] = false
39- """
40- }
41- }
42-
4314 run("GCTA_MAKEGRMPART", alias: "GCTA_MAKEGRMPART_LDMS1") {
4415 script "../../makegrmpart/main.nf"
4516 process {
4617 """
47- file('plink_simulated.mbfile').text = 'plink_simulated\\n'
18+ file('plink_simulated_ldms1.mbfile').text = 'plink_simulated\\n'
19+
20+ def bimFile = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
21+ def extractSnps = bimFile.readLines()
22+ .take(10)
23+ .collect { row -> row.trim().split(/\\s+/)[1] }
24+ .join('\\n') + '\\n'
25+ file('plink_simulated_ldms1.snps.txt').text = extractSnps
4826
4927 input[0] = [
50- [ id:'plink_simulated_ldms1', part_gcta_job:1, nparts_gcta:1 ],
51- file('plink_simulated.mbfile'),
28+ [ id:'plink_simulated_ldms1' ],
29+ 1,
30+ 1,
31+ file('plink_simulated_ldms1.mbfile'),
5232 [
5333 file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true)
5434 ],
5535 [
56- file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
36+ bimFile
5737 ],
5838 [
5939 file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
6040 ]
6141 ]
62- input[1] = GAWK_VARIANTS_LDMS1.out.output
42+ input[1] = [[ id:'plink_simulated_ldms1' ], file('plink_simulated_ldms1.snps.txt')]
6343 """
6444 }
6545 }
@@ -68,22 +48,32 @@ nextflow_process {
6848 script "../../makegrmpart/main.nf"
6949 process {
7050 """
71- file('plink_simulated.mbfile').text = 'plink_simulated\\n'
51+ file('plink_simulated_ldms2.mbfile').text = 'plink_simulated\\n'
52+
53+ def bimFile = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
54+ def extractSnps = bimFile.readLines()
55+ .drop(10)
56+ .take(10)
57+ .collect { row -> row.trim().split(/\\s+/)[1] }
58+ .join('\\n') + '\\n'
59+ file('plink_simulated_ldms2.snps.txt').text = extractSnps
7260
7361 input[0] = [
74- [ id:'plink_simulated_ldms2', part_gcta_job:1, nparts_gcta:1 ],
75- file('plink_simulated.mbfile'),
62+ [ id:'plink_simulated_ldms2' ],
63+ 1,
64+ 1,
65+ file('plink_simulated_ldms2.mbfile'),
7666 [
7767 file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true)
7868 ],
7969 [
80- file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
70+ bimFile
8171 ],
8272 [
8373 file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
8474 ]
8575 ]
86- input[1] = GAWK_VARIANTS_LDMS2.out.output
76+ input[1] = [[ id:'plink_simulated_ldms2' ], file('plink_simulated_ldms2.snps.txt')]
8777 """
8878 }
8979 }
@@ -101,9 +91,9 @@ nextflow_process {
10191
10292 grm_files = GCTA_MAKEGRMPART_LDMS1.out.grm_files
10393 .mix(GCTA_MAKEGRMPART_LDMS2.out.grm_files)
104- .map { meta, grm_id, grm_bin, grm_n_bin -> [grm_id, grm_bin, grm_n_bin] }
94+ .map { meta, grm_files, nparts_gcta, part_gcta_job -> grm_files }
10595 .collect()
106- .map { rows -> rows. sort { left, right -> left[0] .name <=> right[0].name }.flatten() }
96+ .map { bundles -> bundles.flatten(). sort { it .name } }
10797
10898 input[0] = mgrm_file
10999 .combine(grm_files)
@@ -117,7 +107,13 @@ nextflow_process {
117107 { assert process.success },
118108 { assert process.out.combined_grm.size() == 1 },
119109 { assert process.out.combined_grm.get(0).get(0).id == "plink_simulated_ldms" },
120- { assert file(process.out.combined_grm.get(0).get(1)).name == "plink_simulated_ldms.grm.id" },
110+ {
111+ assert process.out.combined_grm.get(0).get(1).collect { file(it).name }.toSet() == [
112+ 'plink_simulated_ldms.grm.id',
113+ 'plink_simulated_ldms.grm.bin',
114+ 'plink_simulated_ldms.grm.N.bin'
115+ ] as Set
116+ },
121117 {
122118 assert snapshot(
123119 process.out.combined_grm,
@@ -141,9 +137,9 @@ nextflow_process {
141137
142138 grm_files = GCTA_MAKEGRMPART_LDMS1.out.grm_files
143139 .mix(GCTA_MAKEGRMPART_LDMS2.out.grm_files)
144- .map { meta, grm_id, grm_bin, grm_n_bin -> [grm_id, grm_bin, grm_n_bin] }
140+ .map { meta, grm_files, nparts_gcta, part_gcta_job -> grm_files }
145141 .collect()
146- .map { rows -> rows. sort { left, right -> left[0] .name <=> right[0].name }.flatten() }
142+ .map { bundles -> bundles.flatten(). sort { it .name } }
147143
148144 input[0] = mgrm_file
149145 .combine(grm_files)
0 commit comments