Skip to content

Commit

Permalink
Merge pull request #1331 from maxulysse/dev
Browse files Browse the repository at this point in the history
add stub for local modules
  • Loading branch information
maxulysse authored Jul 2, 2024
2 parents a29e775 + 7e9077e commit b901cbe
Show file tree
Hide file tree
Showing 21 changed files with 557 additions and 54 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements
- [PR #1328](https://github.com/nf-core/rnaseq/pull/1328) - Add pipeline level test for STAR-RSEM and HISAT2
- [PR #1329](https://github.com/nf-core/rnaseq/pull/1329) - Remove tags from all nf-test files
- [PR #1330](https://github.com/nf-core/rnaseq/pull/1330) - Update all nf-core/modules and subworkflows
- [PR #1331](https://github.com/nf-core/rnaseq/pull/1331) - Adding stubs for local modules

### Parameters

Expand Down
27 changes: 27 additions & 0 deletions modules/local/deseq2_qc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,31 @@ process DESEQ2_QC {
bioconductor-deseq2: \$(Rscript -e "library(DESeq2); cat(as.character(packageVersion('DESeq2')))")
END_VERSIONS
"""

stub:
def args2 = task.ext.args2 ?: ''
def label_lower = args2.toLowerCase()
prefix = task.ext.prefix ?: "deseq2"
"""
mkdir size_factors
touch ${label_lower}.pca.vals_mqc.tsv
touch ${label_lower}.sample.dists_mqc.tsv
touch ${prefix}.plots.pdf
touch ${prefix}.dds.RData
touch ${prefix}.pca.vals.txt
touch ${prefix}.sample.dists.txt
touch R_sessionInfo.log
touch size_factors/${prefix}.size_factors.RData
for i in `head $counts -n 1 | cut -f3-`;
do
touch size_factors/\${i}.size_factors.RData
done
cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//')
bioconductor-deseq2: \$(Rscript -e "library(DESeq2); cat(as.character(packageVersion('DESeq2')))")
END_VERSIONS
"""
}
25 changes: 23 additions & 2 deletions modules/local/deseq2_qc/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,32 @@ nextflow_process {
process.out.pca_multiqc,
process.out.pca_txt,
process.out.rdata,
process.out.size_factors
process.out.size_factors,
process.out.versions
).match() }
)
}

}

test("parse count data correctly - stub") {

options "-stub"

when {
process {
"""
input[0] = file(params.pipelines_testdata_base_path + "deseq2qc/countFile.tsv", checkIfExists: true)
input[1] = file(params.pipelines_testdata_base_path + "deseq2qc/deseq2_pca_header.txt", checkIfExists: true)
input[2] = file(params.pipelines_testdata_base_path + "deseq2qc/deseq2_clustering_header.txt", checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
92 changes: 87 additions & 5 deletions modules/local/deseq2_qc/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,87 @@
{
"parse count data correctly - stub": {
"content": [
{
"0": [
"deseq2.plots.pdf:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"1": [
"deseq2.dds.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"2": [
"deseq2.pca.vals.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"3": [

],
"4": [
"deseq2.sample.dists.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"5": [

],
"6": [
"R_sessionInfo.log:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"7": [
[
"RAP1_IAA_30M_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"RAP1_UNINDUCED_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"RAP1_UNINDUCED_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"WT_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"WT_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"deseq2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"8": [
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
],
"dists_multiqc": [

],
"dists_txt": [
"deseq2.sample.dists.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"log": [
"R_sessionInfo.log:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"pca_multiqc": [

],
"pca_txt": [
"deseq2.pca.vals.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"pdf": [
"deseq2.plots.pdf:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"rdata": [
"deseq2.dds.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"size_factors": [
[
"RAP1_IAA_30M_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"RAP1_UNINDUCED_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"RAP1_UNINDUCED_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"WT_REP1.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"WT_REP2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e",
"deseq2.size_factors.RData:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-21T11:38:08.92794"
},
"parse count data correctly": {
"content": [
[

],
[
"deseq2.sample.dists.txt:md5,1616ce40eb58ee75640efed219c6bbec"
Expand All @@ -11,7 +90,7 @@
"R_sessionInfo.log:md5,fb0da0d7ad6994ed66a8e68348b19676"
],
[

],
[
"deseq2.pca.vals.txt:md5,4cda8e32ec39326c1350e77b4b607aad"
Expand All @@ -28,12 +107,15 @@
"WT_REP2.txt:md5,2ce093f2c2e92c1bde1cd3da91ac884c",
"deseq2.size_factors.RData:md5,51c6643a0f8a9edabbff8df0165451f2"
]
],
[
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-03-07T12:34:51.582179"
"timestamp": "2024-06-21T11:21:20.349616"
}
}
}
10 changes: 10 additions & 0 deletions modules/local/gtf2bed/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ process GTF2BED {
perl: \$(echo \$(perl --version 2>&1) | sed 's/.*v\\(.*\\)) built.*/\\1/')
END_VERSIONS
"""

stub:
"""
touch ${gtf.baseName}.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
perl: \$(echo \$(perl --version 2>&1) | sed 's/.*v\\(.*\\)) built.*/\\1/')
END_VERSIONS
"""
}
19 changes: 19 additions & 0 deletions modules/local/gtf2bed/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ nextflow_process {
{ assert snapshot(process.out).match() }
)
}
}

test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.gtf", checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
23 changes: 23 additions & 0 deletions modules/local/gtf2bed/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
{
"sarscov2 - bam - stub": {
"content": [
{
"0": [
"genome.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"1": [
"versions.yml:md5,d04d815c224b980b6f3818d4b2fd4fe3"
],
"bed": [
"genome.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions": [
"versions.yml:md5,d04d815c224b980b6f3818d4b2fd4fe3"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-21T11:46:28.123826"
},
"sarscov2 - bam": {
"content": [
{
Expand Down
10 changes: 10 additions & 0 deletions modules/local/gtf_filter/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ process GTF_FILTER {
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""

stub:
"""
touch ${fasta.baseName}.filtered.gtf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
23 changes: 21 additions & 2 deletions modules/local/gtf_filter/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ nextflow_process {
script "../main.nf"
process "GTF_FILTER"

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

when {
process {
Expand All @@ -21,7 +21,26 @@ nextflow_process {
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - fasta - gtf - stub") {

options "-stub"

when {
process {
"""
input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gtf', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
29 changes: 26 additions & 3 deletions modules/local/gtf_filter/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Should run without failures": {
"sarscov2 - fasta - gtf": {
"content": [
{
"0": [
Expand All @@ -18,8 +18,31 @@
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-03-06T15:52:37.977802"
"timestamp": "2024-06-21T11:47:56.314297"
},
"sarscov2 - fasta - gtf - stub": {
"content": [
{
"0": [
"genome.filtered.gtf:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"1": [
"versions.yml:md5,4adf55ec05d247fd6d253459bd80856f"
],
"genome_gtf": [
"genome.filtered.gtf:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions": [
"versions.yml:md5,4adf55ec05d247fd6d253459bd80856f"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-21T11:48:19.085835"
}
}
12 changes: 12 additions & 0 deletions modules/local/multiqc_custom_biotype/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ process MULTIQC_CUSTOM_BIOTYPE {
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.biotype_counts_mqc.tsv
touch ${prefix}.biotype_counts_rrna_mqc.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
Loading

0 comments on commit b901cbe

Please sign in to comment.