From 858cd5dfb1367ae3058dc4acfdf24aafdbb978b7 Mon Sep 17 00:00:00 2001 From: maxulysse Date: Fri, 21 Jun 2024 11:41:29 +0200 Subject: [PATCH] add stub for local/deseq2_qc --- modules/local/deseq2_qc/main.nf | 27 ++++++ modules/local/deseq2_qc/tests/main.nf.test | 25 ++++- .../local/deseq2_qc/tests/main.nf.test.snap | 92 ++++++++++++++++++- 3 files changed, 137 insertions(+), 7 deletions(-) diff --git a/modules/local/deseq2_qc/main.nf b/modules/local/deseq2_qc/main.nf index 7be6836f6..7ff5877bb 100644 --- a/modules/local/deseq2_qc/main.nf +++ b/modules/local/deseq2_qc/main.nf @@ -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 + """ } diff --git a/modules/local/deseq2_qc/tests/main.nf.test b/modules/local/deseq2_qc/tests/main.nf.test index f9319edab..a9d35997d 100644 --- a/modules/local/deseq2_qc/tests/main.nf.test +++ b/modules/local/deseq2_qc/tests/main.nf.test @@ -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() } + ) + } + } } diff --git a/modules/local/deseq2_qc/tests/main.nf.test.snap b/modules/local/deseq2_qc/tests/main.nf.test.snap index 865b8d5b8..1c6bc7105 100644 --- a/modules/local/deseq2_qc/tests/main.nf.test.snap +++ b/modules/local/deseq2_qc/tests/main.nf.test.snap @@ -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" @@ -11,7 +90,7 @@ "R_sessionInfo.log:md5,fb0da0d7ad6994ed66a8e68348b19676" ], [ - + ], [ "deseq2.pca.vals.txt:md5,4cda8e32ec39326c1350e77b4b607aad" @@ -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" } -} \ No newline at end of file +}