Skip to content

Commit 8bf5865

Browse files
committed
Sync gcta/makegrm setup module
1 parent addd032 commit 8bf5865

4 files changed

Lines changed: 258 additions & 2 deletions

File tree

modules/nf-core/gcta/makegrm/main.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ process GCTA_MAKEGRM {
1717
task.ext.when == null || task.ext.when
1818

1919
script:
20+
def extra_args = task.ext.args ?: ''
21+
def prefix = task.ext.prefix ?: "${meta.id}"
2022
def genotype_files = bed_pgen instanceof List ? bed_pgen : [bed_pgen]
2123
def genotype_extension = genotype_files[0].name.tokenize('.').last()
2224
def multi_file_flag = genotype_extension == 'pgen' ? '--mpfile' : '--mbfile'
23-
def prefix = task.ext.prefix ?: "${meta.id}"
24-
def extra_args = task.ext.args ?: ''
2525

2626
"""
2727
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
nextflow_process {
2+
3+
name "Test Process GCTA_MAKEGRM"
4+
script "../main.nf"
5+
process "GCTA_MAKEGRM"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "gcta"
10+
tag "gcta/makegrm"
11+
12+
test("homo_sapiens popgen - plink2") {
13+
when {
14+
process {
15+
"""
16+
file('gcta_grm.mpfile').text = 'plink_simulated plink_simulated.pgen plink_simulated.psam plink_simulated.pvar\\n'
17+
18+
input[0] = [
19+
[ id:'gcta_grm' ],
20+
file('gcta_grm.mpfile'),
21+
[
22+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true)
23+
],
24+
[
25+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true)
26+
],
27+
[
28+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
29+
]
30+
]
31+
"""
32+
}
33+
}
34+
35+
then {
36+
assertAll(
37+
{ assert process.success },
38+
{ assert process.out.grm_files.size() == 1 },
39+
{ assert process.out.grm_files.get(0).get(0).id == 'gcta_grm' },
40+
{ assert process.out.grm_files.get(0).get(0).keySet() == ['id'] as Set },
41+
{ assert process.out.grm_files.get(0).get(1).size() == 3 },
42+
{
43+
assert process.out.grm_files.get(0).get(1).collect { file(it).name }.toSet() == [
44+
'gcta_grm.grm.id',
45+
'gcta_grm.grm.bin',
46+
'gcta_grm.grm.N.bin'
47+
] as Set
48+
},
49+
{ assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--make-grm') },
50+
{ assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--mpfile') },
51+
{
52+
assert snapshot(
53+
process.out.grm_files,
54+
process.out.findAll { key, val -> key.startsWith('versions') }
55+
).match()
56+
}
57+
)
58+
}
59+
}
60+
61+
test("homo_sapiens popgen - plink1") {
62+
when {
63+
process {
64+
"""
65+
file('gcta_grm.mbfile').text = 'plink_simulated\\n'
66+
67+
input[0] = [
68+
[ id:'gcta_grm_bed' ],
69+
file('gcta_grm.mbfile'),
70+
[
71+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true)
72+
],
73+
[
74+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
75+
],
76+
[
77+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
78+
]
79+
]
80+
"""
81+
}
82+
}
83+
84+
then {
85+
assertAll(
86+
{ assert process.success },
87+
{ assert process.out.grm_files.size() == 1 },
88+
{ assert process.out.grm_files.get(0).get(0).id == 'gcta_grm_bed' },
89+
{ assert process.out.grm_files.get(0).get(0).keySet() == ['id'] as Set },
90+
{ assert process.out.grm_files.get(0).get(1).size() == 3 },
91+
{
92+
assert process.out.grm_files.get(0).get(1).collect { file(it).name }.toSet() == [
93+
'gcta_grm_bed.grm.id',
94+
'gcta_grm_bed.grm.bin',
95+
'gcta_grm_bed.grm.N.bin'
96+
] as Set
97+
},
98+
{ assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--make-grm') },
99+
{ assert file(path(process.out.grm_files.get(0).get(1)[0]).parent.toString() + '/.command.sh').text.contains('--mbfile') },
100+
{
101+
assert snapshot(
102+
process.out.grm_files,
103+
process.out.findAll { key, val -> key.startsWith('versions') }
104+
).match()
105+
}
106+
)
107+
}
108+
}
109+
110+
test("homo_sapiens popgen - plink1 - stub") {
111+
options "-stub"
112+
113+
when {
114+
process {
115+
"""
116+
file('gcta_grm.mbfile').text = 'plink_simulated\\n'
117+
118+
input[0] = [
119+
[ id:'gcta_grm_bed' ],
120+
file('gcta_grm.mbfile'),
121+
[
122+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true)
123+
],
124+
[
125+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true)
126+
],
127+
[
128+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
129+
]
130+
]
131+
"""
132+
}
133+
}
134+
135+
then {
136+
assertAll(
137+
{ assert process.success },
138+
{ assert snapshot(process.out).match() }
139+
)
140+
}
141+
}
142+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"homo_sapiens popgen - plink2": {
3+
"content": [
4+
[
5+
[
6+
{
7+
"id": "gcta_grm"
8+
},
9+
[
10+
"gcta_grm.grm.N.bin:md5,acaa43bbbf2253d392537a178ecf09a4",
11+
"gcta_grm.grm.bin:md5,45f8dff14bda17d50009a21050572228",
12+
"gcta_grm.grm.id:md5,4f9aa36c44a417ff6d7caa9841e66ad9"
13+
]
14+
]
15+
],
16+
{
17+
"versions_gcta": [
18+
[
19+
"GCTA_MAKEGRM",
20+
"gcta",
21+
"1.94.1"
22+
]
23+
]
24+
}
25+
],
26+
"meta": {
27+
"nf-test": "0.9.3",
28+
"nextflow": "25.10.4"
29+
},
30+
"timestamp": "2026-05-15T21:08:43.209734458"
31+
},
32+
"homo_sapiens popgen - plink1": {
33+
"content": [
34+
[
35+
[
36+
{
37+
"id": "gcta_grm_bed"
38+
},
39+
[
40+
"gcta_grm_bed.grm.N.bin:md5,acaa43bbbf2253d392537a178ecf09a4",
41+
"gcta_grm_bed.grm.bin:md5,45f8dff14bda17d50009a21050572228",
42+
"gcta_grm_bed.grm.id:md5,4f9aa36c44a417ff6d7caa9841e66ad9"
43+
]
44+
]
45+
],
46+
{
47+
"versions_gcta": [
48+
[
49+
"GCTA_MAKEGRM",
50+
"gcta",
51+
"1.94.1"
52+
]
53+
]
54+
}
55+
],
56+
"meta": {
57+
"nf-test": "0.9.3",
58+
"nextflow": "25.10.4"
59+
},
60+
"timestamp": "2026-05-15T21:09:34.058651287"
61+
},
62+
"homo_sapiens popgen - plink1 - stub": {
63+
"content": [
64+
{
65+
"0": [
66+
[
67+
{
68+
"id": "gcta_grm_bed"
69+
},
70+
[
71+
"gcta_grm_bed.grm.N.bin:md5,d41d8cd98f00b204e9800998ecf8427e",
72+
"gcta_grm_bed.grm.bin:md5,d41d8cd98f00b204e9800998ecf8427e",
73+
"gcta_grm_bed.grm.id:md5,d41d8cd98f00b204e9800998ecf8427e"
74+
]
75+
]
76+
],
77+
"1": [
78+
[
79+
"GCTA_MAKEGRM",
80+
"gcta",
81+
"1.94.1"
82+
]
83+
],
84+
"grm_files": [
85+
[
86+
{
87+
"id": "gcta_grm_bed"
88+
},
89+
[
90+
"gcta_grm_bed.grm.N.bin:md5,d41d8cd98f00b204e9800998ecf8427e",
91+
"gcta_grm_bed.grm.bin:md5,d41d8cd98f00b204e9800998ecf8427e",
92+
"gcta_grm_bed.grm.id:md5,d41d8cd98f00b204e9800998ecf8427e"
93+
]
94+
]
95+
],
96+
"versions_gcta": [
97+
[
98+
"GCTA_MAKEGRM",
99+
"gcta",
100+
"1.94.1"
101+
]
102+
]
103+
}
104+
],
105+
"meta": {
106+
"nf-test": "0.9.3",
107+
"nextflow": "25.10.4"
108+
},
109+
"timestamp": "2026-05-15T21:10:21.024687128"
110+
}
111+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
params {
2+
modules_testdata_base_path = System.getenv("NF_MODULES_TESTDATA_BASE_PATH") ?: "https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/"
3+
}

0 commit comments

Comments
 (0)