@@ -8,29 +8,45 @@ nextflow_process {
88 tag "modules_nfcore"
99 tag "gcta"
1010 tag "gcta/makebksparse"
11+ tag "tests/helpers/dense_grm"
12+
13+ setup {
14+ run("GCTA_TEST_DENSE_GRM", alias: "GCTA_TEST_DENSE_GRM_CONTRACT") {
15+ script "../tests/helpers/dense_grm/main.nf"
16+ process {
17+ """
18+ input[0] = [
19+ [ id:'contract_dense' ],
20+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true),
21+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true),
22+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
23+ ]
24+ """
25+ }
26+ }
27+
28+ run("GCTA_TEST_DENSE_GRM", alias: "GCTA_TEST_DENSE_GRM_STUB") {
29+ script "../tests/helpers/dense_grm/main.nf"
30+ process {
31+ """
32+ input[0] = [
33+ [ id:'stub_dense' ],
34+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true),
35+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true),
36+ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
37+ ]
38+ """
39+ }
40+ }
41+ }
1142
1243 test("homo_sapiens popgen - create sparse GRM") {
1344 config "./nextflow.config"
1445
1546 when {
1647 process {
1748 """
18- file('contract_dense.grm.id').text = "fid1 iid1\\n"
19-
20- grmBuffer = java.nio.ByteBuffer.allocate(4).order(java.nio.ByteOrder.LITTLE_ENDIAN)
21- grmBuffer.putFloat(1.0f)
22- file('contract_dense.grm.bin').bytes = grmBuffer.array()
23-
24- grmNBuffer = java.nio.ByteBuffer.allocate(4).order(java.nio.ByteOrder.LITTLE_ENDIAN)
25- grmNBuffer.putFloat(100.0f)
26- file('contract_dense.grm.N.bin').bytes = grmNBuffer.array()
27-
28- input[0] = Channel.value([
29- [ id:'contract_dense' ],
30- file('contract_dense.grm.id'),
31- file('contract_dense.grm.bin'),
32- file('contract_dense.grm.N.bin')
33- ])
49+ input[0] = GCTA_TEST_DENSE_GRM_CONTRACT.out.dense_grm
3450 input[1] = Channel.value(0.05)
3551 """
3652 }
@@ -53,22 +69,9 @@ nextflow_process {
5369 when {
5470 process {
5571 """
56- file('contract_dense.grm.id').text = "fid1 iid1\\n"
57-
58- grmBuffer = java.nio.ByteBuffer.allocate(4).order(java.nio.ByteOrder.LITTLE_ENDIAN)
59- grmBuffer.putFloat(1.0f)
60- file('contract_dense.grm.bin').bytes = grmBuffer.array()
61-
62- grmNBuffer = java.nio.ByteBuffer.allocate(4).order(java.nio.ByteOrder.LITTLE_ENDIAN)
63- grmNBuffer.putFloat(100.0f)
64- file('contract_dense.grm.N.bin').bytes = grmNBuffer.array()
65-
66- input[0] = Channel.value([
67- [ id:'contract_dense_mismatch' ],
68- file('contract_dense.grm.id'),
69- file('contract_dense.grm.bin'),
70- file('contract_dense.grm.N.bin')
71- ])
72+ input[0] = GCTA_TEST_DENSE_GRM_CONTRACT.out.dense_grm.map { meta, grm_id, grm_bin, grm_n_bin ->
73+ [[ id:'contract_dense_mismatch' ], grm_id, grm_bin, grm_n_bin]
74+ }
7275 input[1] = Channel.value(0.05)
7376 """
7477 }
@@ -89,16 +92,7 @@ nextflow_process {
8992 when {
9093 process {
9194 """
92- file('stub_dense.grm.id').text = "fid1 iid1\\n"
93- file('stub_dense.grm.bin').bytes = []
94- file('stub_dense.grm.N.bin').bytes = []
95-
96- input[0] = Channel.value([
97- [ id:'stub_dense' ],
98- file('stub_dense.grm.id'),
99- file('stub_dense.grm.bin'),
100- file('stub_dense.grm.N.bin')
101- ])
95+ input[0] = GCTA_TEST_DENSE_GRM_STUB.out.dense_grm
10296 input[1] = Channel.value(0.05)
10397 """
10498 }
0 commit comments