Skip to content

Commit cb26bdc

Browse files
mantispsSPPearcemaxulysse
authored
nf-test migration: plink/indeppairwise (#8133)
* Migrated pytest to nf-test for `plink/indeppairwise` module & added stub run and test to it. * Update modules/nf-core/plink/indeppairwise/tests/main.nf.test Co-authored-by: Simon Pearce <[email protected]> * Fixed nf-test based on PR comments. * Restored `.pre-commit-config.yaml` to original state. * Update modules/nf-core/plink/indeppairwise/main.nf Co-authored-by: Simon Pearce <[email protected]> --------- Co-authored-by: Simon Pearce <[email protected]> Co-authored-by: Maxime U Garcia <[email protected]>
1 parent a97cba2 commit cb26bdc

File tree

8 files changed

+206
-60
lines changed

8 files changed

+206
-60
lines changed

modules/nf-core/plink/indeppairwise/main.nf

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
process PLINK_INDEPPAIRWISE {
32
tag "$meta.id"
43
label 'process_low'
@@ -31,10 +30,24 @@ process PLINK_INDEPPAIRWISE {
3130
--bed ${bed} \\
3231
--bim ${bim} \\
3332
--fam ${fam} \\
34-
--threads $task.cpus \\
33+
--threads ${task.cpus} \\
3534
--indep-pairwise ${window_size} ${variant_count} ${r2_threshold} \\
36-
$args \\
37-
--out $prefix
35+
${args} \\
36+
--out ${prefix}
37+
38+
cat <<-END_VERSIONS > versions.yml
39+
"${task.process}":
40+
plink: \$(echo \$(plink --version) | sed 's/^PLINK v//;s/64.*//')
41+
END_VERSIONS
42+
"""
43+
44+
stub:
45+
def prefix = task.ext.prefix ?: "${meta.id}"
46+
47+
"""
48+
touch ${prefix}.prune.in
49+
touch ${prefix}.prune.out
50+
3851
cat <<-END_VERSIONS > versions.yml
3952
"${task.process}":
4053
plink: \$(echo \$(plink --version) | sed 's/^PLINK v//;s/64.*//')
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
nextflow_process {
2+
3+
name "Test Process PLINK_INDEPPAIRWISE"
4+
script "../main.nf"
5+
process "PLINK_INDEPPAIRWISE"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "plink"
10+
tag "plink/indeppairwise"
11+
tag "plink/vcf"
12+
13+
setup {
14+
15+
config "./nextflow.config"
16+
17+
params {
18+
module_args = '--make-bed --biallelic-only strict --vcf-half-call haploid --allow-extra-chr'
19+
}
20+
21+
run("PLINK_VCF") {
22+
23+
script "../../vcf/main.nf"
24+
25+
process {
26+
"""
27+
input[0] = [
28+
[id:'test',single_end:false],// meta map
29+
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/vcf/ped/justhusky_minimal.vcf.gz", checkIfExists:true)
30+
]
31+
"""
32+
}
33+
}
34+
}
35+
36+
test("test_plink_indeppairwise") {
37+
when {
38+
process {
39+
"""
40+
input[0] = PLINK_VCF.out.bed.join(PLINK_VCF.out.bim).join(PLINK_VCF.out.fam)
41+
input[1] = Channel.value(50)
42+
input[2] = Channel.value(5)
43+
input[3] = Channel.value(0.2)
44+
"""
45+
}
46+
}
47+
then {
48+
assertAll(
49+
{ assert process.success },
50+
{ assert snapshot(process.out).match() }
51+
)
52+
}
53+
}
54+
55+
test("test_plink_indeppairwise - stub") {
56+
57+
options "-stub"
58+
59+
when {
60+
process {
61+
"""
62+
input[0] = PLINK_VCF.out.bed.join(PLINK_VCF.out.bim).join(PLINK_VCF.out.fam)
63+
input[1] = Channel.value(50)
64+
input[2] = Channel.value(5)
65+
input[3] = Channel.value(0.2)
66+
"""
67+
}
68+
}
69+
then {
70+
assertAll(
71+
{ assert process.success },
72+
{ assert snapshot(process.out).match() }
73+
)
74+
}
75+
}
76+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"test_plink_indeppairwise": {
3+
"content": [
4+
{
5+
"0": [
6+
[
7+
{
8+
"id": "test",
9+
"single_end": false
10+
},
11+
"test.prune.in:md5,dce7ba75405107468f2ce18fc95a9786"
12+
]
13+
],
14+
"1": [
15+
[
16+
{
17+
"id": "test",
18+
"single_end": false
19+
},
20+
"test.prune.out:md5,1f65f71308f2c4a03b9a4a98bbfb11e9"
21+
]
22+
],
23+
"2": [
24+
"versions.yml:md5,dd52fb8375a5ba36e766f25e9028d128"
25+
],
26+
"prunein": [
27+
[
28+
{
29+
"id": "test",
30+
"single_end": false
31+
},
32+
"test.prune.in:md5,dce7ba75405107468f2ce18fc95a9786"
33+
]
34+
],
35+
"pruneout": [
36+
[
37+
{
38+
"id": "test",
39+
"single_end": false
40+
},
41+
"test.prune.out:md5,1f65f71308f2c4a03b9a4a98bbfb11e9"
42+
]
43+
],
44+
"versions": [
45+
"versions.yml:md5,dd52fb8375a5ba36e766f25e9028d128"
46+
]
47+
}
48+
],
49+
"meta": {
50+
"nf-test": "0.9.2",
51+
"nextflow": "24.10.5"
52+
},
53+
"timestamp": "2025-03-26T14:55:08.717872783"
54+
},
55+
"test_plink_indeppairwise - stub": {
56+
"content": [
57+
{
58+
"0": [
59+
[
60+
{
61+
"id": "test",
62+
"single_end": false
63+
},
64+
"test.prune.in:md5,d41d8cd98f00b204e9800998ecf8427e"
65+
]
66+
],
67+
"1": [
68+
[
69+
{
70+
"id": "test",
71+
"single_end": false
72+
},
73+
"test.prune.out:md5,d41d8cd98f00b204e9800998ecf8427e"
74+
]
75+
],
76+
"2": [
77+
"versions.yml:md5,dd52fb8375a5ba36e766f25e9028d128"
78+
],
79+
"prunein": [
80+
[
81+
{
82+
"id": "test",
83+
"single_end": false
84+
},
85+
"test.prune.in:md5,d41d8cd98f00b204e9800998ecf8427e"
86+
]
87+
],
88+
"pruneout": [
89+
[
90+
{
91+
"id": "test",
92+
"single_end": false
93+
},
94+
"test.prune.out:md5,d41d8cd98f00b204e9800998ecf8427e"
95+
]
96+
],
97+
"versions": [
98+
"versions.yml:md5,dd52fb8375a5ba36e766f25e9028d128"
99+
]
100+
}
101+
],
102+
"meta": {
103+
"nf-test": "0.9.2",
104+
"nextflow": "24.10.5"
105+
},
106+
"timestamp": "2025-03-28T17:45:50.995416015"
107+
}
108+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
process {
2+
withName: "PLINK_VCF" {
3+
ext.args = params.module_args
4+
}
5+
}

tests/config/pytest_modules.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ paragraph/multigrmpy:
149149
phyloflash:
150150
- modules/nf-core/phyloflash/**
151151
- tests/modules/nf-core/phyloflash/**
152-
plink/indeppairwise:
153-
- modules/nf-core/plink/indeppairwise/**
154-
- tests/modules/nf-core/plink/indeppairwise/**
155152
pneumocat:
156153
- modules/nf-core/pneumocat/**
157154
- tests/modules/nf-core/pneumocat/**

tests/modules/nf-core/plink/indeppairwise/main.nf

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/modules/nf-core/plink/indeppairwise/nextflow.config

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/modules/nf-core/plink/indeppairwise/test.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)