Skip to content

Commit b901cbe

Browse files
authored
Merge pull request #1331 from maxulysse/dev
add stub for local modules
2 parents a29e775 + 7e9077e commit b901cbe

File tree

21 files changed

+557
-54
lines changed

21 files changed

+557
-54
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements
9696
- [PR #1328](https://github.com/nf-core/rnaseq/pull/1328) - Add pipeline level test for STAR-RSEM and HISAT2
9797
- [PR #1329](https://github.com/nf-core/rnaseq/pull/1329) - Remove tags from all nf-test files
9898
- [PR #1330](https://github.com/nf-core/rnaseq/pull/1330) - Update all nf-core/modules and subworkflows
99+
- [PR #1331](https://github.com/nf-core/rnaseq/pull/1331) - Adding stubs for local modules
99100

100101
### Parameters
101102

modules/local/deseq2_qc/main.nf

+27
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,31 @@ process DESEQ2_QC {
5757
bioconductor-deseq2: \$(Rscript -e "library(DESeq2); cat(as.character(packageVersion('DESeq2')))")
5858
END_VERSIONS
5959
"""
60+
61+
stub:
62+
def args2 = task.ext.args2 ?: ''
63+
def label_lower = args2.toLowerCase()
64+
prefix = task.ext.prefix ?: "deseq2"
65+
"""
66+
mkdir size_factors
67+
touch ${label_lower}.pca.vals_mqc.tsv
68+
touch ${label_lower}.sample.dists_mqc.tsv
69+
touch ${prefix}.plots.pdf
70+
touch ${prefix}.dds.RData
71+
touch ${prefix}.pca.vals.txt
72+
touch ${prefix}.sample.dists.txt
73+
touch R_sessionInfo.log
74+
touch size_factors/${prefix}.size_factors.RData
75+
76+
for i in `head $counts -n 1 | cut -f3-`;
77+
do
78+
touch size_factors/\${i}.size_factors.RData
79+
done
80+
81+
cat <<-END_VERSIONS > versions.yml
82+
"${task.process}":
83+
r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//')
84+
bioconductor-deseq2: \$(Rscript -e "library(DESeq2); cat(as.character(packageVersion('DESeq2')))")
85+
END_VERSIONS
86+
"""
6087
}

modules/local/deseq2_qc/tests/main.nf.test

+23-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,32 @@ nextflow_process {
2626
process.out.pca_multiqc,
2727
process.out.pca_txt,
2828
process.out.rdata,
29-
process.out.size_factors
29+
process.out.size_factors,
30+
process.out.versions
3031
).match() }
3132
)
3233
}
33-
3434
}
3535

36+
test("parse count data correctly - stub") {
37+
38+
options "-stub"
39+
40+
when {
41+
process {
42+
"""
43+
input[0] = file(params.pipelines_testdata_base_path + "deseq2qc/countFile.tsv", checkIfExists: true)
44+
input[1] = file(params.pipelines_testdata_base_path + "deseq2qc/deseq2_pca_header.txt", checkIfExists: true)
45+
input[2] = file(params.pipelines_testdata_base_path + "deseq2qc/deseq2_clustering_header.txt", checkIfExists: true)
46+
"""
47+
}
48+
}
49+
50+
then {
51+
assertAll(
52+
{ assert process.success },
53+
{ assert snapshot(process.out).match() }
54+
)
55+
}
56+
}
3657
}

modules/local/deseq2_qc/tests/main.nf.test.snap

+87-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,87 @@
11
{
2+
"parse count data correctly - stub": {
3+
"content": [
4+
{
5+
"0": [
6+
"deseq2.plots.pdf:md5,d41d8cd98f00b204e9800998ecf8427e"
7+
],
8+
"1": [
9+
"deseq2.dds.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
10+
],
11+
"2": [
12+
"deseq2.pca.vals.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
13+
],
14+
"3": [
15+
16+
],
17+
"4": [
18+
"deseq2.sample.dists.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
19+
],
20+
"5": [
21+
22+
],
23+
"6": [
24+
"R_sessionInfo.log:md5,d41d8cd98f00b204e9800998ecf8427e"
25+
],
26+
"7": [
27+
[
28+
"RAP1_IAA_30M_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
29+
"RAP1_UNINDUCED_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
30+
"RAP1_UNINDUCED_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
31+
"WT_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
32+
"WT_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
33+
"deseq2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
34+
]
35+
],
36+
"8": [
37+
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
38+
],
39+
"dists_multiqc": [
40+
41+
],
42+
"dists_txt": [
43+
"deseq2.sample.dists.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
44+
],
45+
"log": [
46+
"R_sessionInfo.log:md5,d41d8cd98f00b204e9800998ecf8427e"
47+
],
48+
"pca_multiqc": [
49+
50+
],
51+
"pca_txt": [
52+
"deseq2.pca.vals.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
53+
],
54+
"pdf": [
55+
"deseq2.plots.pdf:md5,d41d8cd98f00b204e9800998ecf8427e"
56+
],
57+
"rdata": [
58+
"deseq2.dds.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
59+
],
60+
"size_factors": [
61+
[
62+
"RAP1_IAA_30M_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
63+
"RAP1_UNINDUCED_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
64+
"RAP1_UNINDUCED_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
65+
"WT_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
66+
"WT_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
67+
"deseq2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
68+
]
69+
],
70+
"versions": [
71+
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
72+
]
73+
}
74+
],
75+
"meta": {
76+
"nf-test": "0.8.4",
77+
"nextflow": "24.04.2"
78+
},
79+
"timestamp": "2024-06-21T11:38:08.92794"
80+
},
281
"parse count data correctly": {
382
"content": [
483
[
5-
84+
685
],
786
[
887
"deseq2.sample.dists.txt:md5,1616ce40eb58ee75640efed219c6bbec"
@@ -11,7 +90,7 @@
1190
"R_sessionInfo.log:md5,fb0da0d7ad6994ed66a8e68348b19676"
1291
],
1392
[
14-
93+
1594
],
1695
[
1796
"deseq2.pca.vals.txt:md5,4cda8e32ec39326c1350e77b4b607aad"
@@ -28,12 +107,15 @@
28107
"WT_REP2.txt:md5,2ce093f2c2e92c1bde1cd3da91ac884c",
29108
"deseq2.size_factors.RData:md5,51c6643a0f8a9edabbff8df0165451f2"
30109
]
110+
],
111+
[
112+
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
31113
]
32114
],
33115
"meta": {
34116
"nf-test": "0.8.4",
35-
"nextflow": "23.10.1"
117+
"nextflow": "24.04.2"
36118
},
37-
"timestamp": "2024-03-07T12:34:51.582179"
119+
"timestamp": "2024-06-21T11:21:20.349616"
38120
}
39-
}
121+
}

modules/local/gtf2bed/main.nf

+10
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,14 @@ process GTF2BED {
2828
perl: \$(echo \$(perl --version 2>&1) | sed 's/.*v\\(.*\\)) built.*/\\1/')
2929
END_VERSIONS
3030
"""
31+
32+
stub:
33+
"""
34+
touch ${gtf.baseName}.bed
35+
36+
cat <<-END_VERSIONS > versions.yml
37+
"${task.process}":
38+
perl: \$(echo \$(perl --version 2>&1) | sed 's/.*v\\(.*\\)) built.*/\\1/')
39+
END_VERSIONS
40+
"""
3141
}

modules/local/gtf2bed/tests/main.nf.test

+19
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,25 @@ nextflow_process {
2020
{ assert snapshot(process.out).match() }
2121
)
2222
}
23+
}
24+
25+
test("sarscov2 - bam - stub") {
26+
27+
options "-stub"
2328

29+
when {
30+
process {
31+
"""
32+
input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.gtf", checkIfExists: true)
33+
"""
34+
}
35+
}
36+
37+
then {
38+
assertAll(
39+
{ assert process.success },
40+
{ assert snapshot(process.out).match() }
41+
)
42+
}
2443
}
2544
}

modules/local/gtf2bed/tests/main.nf.test.snap

+23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
{
2+
"sarscov2 - bam - stub": {
3+
"content": [
4+
{
5+
"0": [
6+
"genome.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
7+
],
8+
"1": [
9+
"versions.yml:md5,d04d815c224b980b6f3818d4b2fd4fe3"
10+
],
11+
"bed": [
12+
"genome.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
13+
],
14+
"versions": [
15+
"versions.yml:md5,d04d815c224b980b6f3818d4b2fd4fe3"
16+
]
17+
}
18+
],
19+
"meta": {
20+
"nf-test": "0.8.4",
21+
"nextflow": "24.04.2"
22+
},
23+
"timestamp": "2024-06-21T11:46:28.123826"
24+
},
225
"sarscov2 - bam": {
326
"content": [
427
{

modules/local/gtf_filter/main.nf

+10
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ process GTF_FILTER {
2929
python: \$(python --version | sed 's/Python //g')
3030
END_VERSIONS
3131
"""
32+
33+
stub:
34+
"""
35+
touch ${fasta.baseName}.filtered.gtf
36+
37+
cat <<-END_VERSIONS > versions.yml
38+
"${task.process}":
39+
python: \$(python --version | sed 's/Python //g')
40+
END_VERSIONS
41+
"""
3242
}

modules/local/gtf_filter/tests/main.nf.test

+21-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ nextflow_process {
44
script "../main.nf"
55
process "GTF_FILTER"
66

7-
test("Should run without failures") {
7+
test("sarscov2 - fasta - gtf") {
88

99
when {
1010
process {
@@ -21,7 +21,26 @@ nextflow_process {
2121
{ assert snapshot(process.out).match() }
2222
)
2323
}
24-
2524
}
2625

26+
test("sarscov2 - fasta - gtf - stub") {
27+
28+
options "-stub"
29+
30+
when {
31+
process {
32+
"""
33+
input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
34+
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gtf', checkIfExists: true)
35+
"""
36+
}
37+
}
38+
39+
then {
40+
assertAll(
41+
{ assert process.success },
42+
{ assert snapshot(process.out).match() }
43+
)
44+
}
45+
}
2746
}

modules/local/gtf_filter/tests/main.nf.test.snap

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Should run without failures": {
2+
"sarscov2 - fasta - gtf": {
33
"content": [
44
{
55
"0": [
@@ -18,8 +18,31 @@
1818
],
1919
"meta": {
2020
"nf-test": "0.8.4",
21-
"nextflow": "23.10.1"
21+
"nextflow": "24.04.2"
2222
},
23-
"timestamp": "2024-03-06T15:52:37.977802"
23+
"timestamp": "2024-06-21T11:47:56.314297"
24+
},
25+
"sarscov2 - fasta - gtf - stub": {
26+
"content": [
27+
{
28+
"0": [
29+
"genome.filtered.gtf:md5,d41d8cd98f00b204e9800998ecf8427e"
30+
],
31+
"1": [
32+
"versions.yml:md5,4adf55ec05d247fd6d253459bd80856f"
33+
],
34+
"genome_gtf": [
35+
"genome.filtered.gtf:md5,d41d8cd98f00b204e9800998ecf8427e"
36+
],
37+
"versions": [
38+
"versions.yml:md5,4adf55ec05d247fd6d253459bd80856f"
39+
]
40+
}
41+
],
42+
"meta": {
43+
"nf-test": "0.8.4",
44+
"nextflow": "24.04.2"
45+
},
46+
"timestamp": "2024-06-21T11:48:19.085835"
2447
}
2548
}

modules/local/multiqc_custom_biotype/main.nf

+12
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,16 @@ process MULTIQC_CUSTOM_BIOTYPE {
3333
python: \$(python --version | sed 's/Python //g')
3434
END_VERSIONS
3535
"""
36+
37+
stub:
38+
def prefix = task.ext.prefix ?: "${meta.id}"
39+
"""
40+
touch ${prefix}.biotype_counts_mqc.tsv
41+
touch ${prefix}.biotype_counts_rrna_mqc.tsv
42+
43+
cat <<-END_VERSIONS > versions.yml
44+
"${task.process}":
45+
python: \$(python --version | sed 's/Python //g')
46+
END_VERSIONS
47+
"""
3648
}

0 commit comments

Comments
 (0)