diff --git a/modules/local/gtf2bed/main.nf b/modules/local/gtf2bed/main.nf index 464d7f819..a2523c9cf 100644 --- a/modules/local/gtf2bed/main.nf +++ b/modules/local/gtf2bed/main.nf @@ -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 + """ } diff --git a/modules/local/gtf2bed/tests/main.nf.test b/modules/local/gtf2bed/tests/main.nf.test index 698714f8b..b640d2053 100644 --- a/modules/local/gtf2bed/tests/main.nf.test +++ b/modules/local/gtf2bed/tests/main.nf.test @@ -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() } + ) + } } } diff --git a/modules/local/gtf2bed/tests/main.nf.test.snap b/modules/local/gtf2bed/tests/main.nf.test.snap index 277ebdc23..66ec3bf9e 100644 --- a/modules/local/gtf2bed/tests/main.nf.test.snap +++ b/modules/local/gtf2bed/tests/main.nf.test.snap @@ -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": [ { diff --git a/modules/local/gtf_filter/main.nf b/modules/local/gtf_filter/main.nf index 39b215712..60eb9a9bd 100644 --- a/modules/local/gtf_filter/main.nf +++ b/modules/local/gtf_filter/main.nf @@ -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 + """ } diff --git a/modules/local/gtf_filter/tests/main.nf.test b/modules/local/gtf_filter/tests/main.nf.test index 31044be1a..324ee6bb9 100644 --- a/modules/local/gtf_filter/tests/main.nf.test +++ b/modules/local/gtf_filter/tests/main.nf.test @@ -4,7 +4,7 @@ nextflow_process { script "../main.nf" process "GTF_FILTER" - test("Should run without failures") { + test("sarscov2 - fasta - gtf") { when { process { @@ -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() } + ) + } + } } diff --git a/modules/local/gtf_filter/tests/main.nf.test.snap b/modules/local/gtf_filter/tests/main.nf.test.snap index b763c249c..d22a4fa5b 100644 --- a/modules/local/gtf_filter/tests/main.nf.test.snap +++ b/modules/local/gtf_filter/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "Should run without failures": { + "sarscov2 - fasta - gtf": { "content": [ { "0": [ @@ -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" } } \ No newline at end of file diff --git a/modules/local/multiqc_custom_biotype/main.nf b/modules/local/multiqc_custom_biotype/main.nf index d102f67d9..a4b923c3e 100644 --- a/modules/local/multiqc_custom_biotype/main.nf +++ b/modules/local/multiqc_custom_biotype/main.nf @@ -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 + """ } diff --git a/modules/local/multiqc_custom_biotype/tests/main.nf.test b/modules/local/multiqc_custom_biotype/tests/main.nf.test index 216f73336..bd6cde6bc 100644 --- a/modules/local/multiqc_custom_biotype/tests/main.nf.test +++ b/modules/local/multiqc_custom_biotype/tests/main.nf.test @@ -26,7 +26,31 @@ nextflow_process { { assert snapshot(process.out).match()} ) } - } + test("test sarscov2 count data - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of( + [ + [ id: 'test' ], + file(params.pipelines_testdata_base_path + 'multiqc_custom_biotype/test.featureCounts.txt', checkIfExists: true) + ] + ) + input[1] = file(params.pipelines_testdata_base_path + 'multiqc_custom_biotype/biotypes_header.txt', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success}, + { assert snapshot(process.out).match()} + ) + } + } } diff --git a/modules/local/multiqc_custom_biotype/tests/main.nf.test.snap b/modules/local/multiqc_custom_biotype/tests/main.nf.test.snap index ae559097b..ff9420015 100644 --- a/modules/local/multiqc_custom_biotype/tests/main.nf.test.snap +++ b/modules/local/multiqc_custom_biotype/tests/main.nf.test.snap @@ -37,5 +37,44 @@ "nextflow": "24.01.0" }, "timestamp": "2024-03-08T09:38:04.260609" + }, + "test sarscov2 count data - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test.biotype_counts_mqc.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.biotype_counts_rrna_mqc.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + "versions.yml:md5,575b3b4c8a8a6e508c8ceeca41331b6b" + ], + "tsv": [ + [ + { + "id": "test" + }, + [ + "test.biotype_counts_mqc.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.biotype_counts_rrna_mqc.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,575b3b4c8a8a6e508c8ceeca41331b6b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T11:50:15.104113" } } \ No newline at end of file diff --git a/modules/local/preprocess_transcripts_fasta_gencode/main.nf b/modules/local/preprocess_transcripts_fasta_gencode/main.nf index 9d530b77d..2722e66c7 100644 --- a/modules/local/preprocess_transcripts_fasta_gencode/main.nf +++ b/modules/local/preprocess_transcripts_fasta_gencode/main.nf @@ -28,4 +28,16 @@ process PREPROCESS_TRANSCRIPTS_FASTA_GENCODE { sed: \$(echo \$(sed --version 2>&1) | sed 's/^.*GNU sed) //; s/ .*\$//') END_VERSIONS """ + + stub: + def gzipped = fasta.toString().endsWith('.gz') + def outfile = gzipped ? file(fasta.baseName).baseName : fasta.baseName + """ + touch ${outfile}.fixed.fa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sed: \$(echo \$(sed --version 2>&1) | sed 's/^.*GNU sed) //; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test b/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test index 9585f8ae7..b07b4c001 100644 --- a/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test +++ b/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test @@ -28,7 +28,33 @@ nextflow_process { { assert snapshot(process.out).match() } ) } - } + test("gencode fasta - stub") { + + options "-stub" + + when { + process { + """ + def fileContents = [ + '>chr22|removeme', + 'ACTCAAGATAATGATGAGTAAAGAATATATTTCTAACAACAAAAAGGAAATTTGATAGTA' + ] + def gencodeFasta = file("${workDir}/gencodeFasta.fasta") + gencodeFasta.withWriter{ out -> + fileContents.each {out.println it} + } + input[0] = gencodeFasta + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test.snap b/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test.snap index 8c0580686..eaef85b1b 100644 --- a/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test.snap +++ b/modules/local/preprocess_transcripts_fasta_gencode/tests/main.nf.test.snap @@ -21,5 +21,28 @@ "nextflow": "23.10.1" }, "timestamp": "2024-03-06T16:16:36.494744" + }, + "gencode fasta - stub": { + "content": [ + { + "0": [ + "gencodeFasta.fixed.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "versions.yml:md5,e2c7f636c472887a914b128d1444737e" + ], + "fasta": [ + "gencodeFasta.fixed.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,e2c7f636c472887a914b128d1444737e" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T11:54:20.291494" } } \ No newline at end of file diff --git a/modules/local/rsem_merge_counts/main.nf b/modules/local/rsem_merge_counts/main.nf index b21ca4aa4..c220e31de 100644 --- a/modules/local/rsem_merge_counts/main.nf +++ b/modules/local/rsem_merge_counts/main.nf @@ -52,4 +52,17 @@ process RSEM_MERGE_COUNTS { sed: \$(echo \$(sed --version 2>&1) | sed 's/^.*GNU sed) //; s/ .*\$//') END_VERSIONS """ + + stub: + """ + touch rsem.merged.gene_counts.tsv + touch rsem.merged.gene_tpm.tsv + touch rsem.merged.transcript_counts.tsv + touch rsem.merged.transcript_tpm.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sed: \$(echo \$(sed --version 2>&1) | sed 's/^.*GNU sed) //; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/local/rsem_merge_counts/tests/main.nf.test b/modules/local/rsem_merge_counts/tests/main.nf.test index 9bb1caeb2..61008082a 100644 --- a/modules/local/rsem_merge_counts/tests/main.nf.test +++ b/modules/local/rsem_merge_counts/tests/main.nf.test @@ -24,10 +24,39 @@ nextflow_process { } then { - assert process.success - assert snapshot(process.out).match() + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) } - } + test("stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + file(params.pipelines_testdata_base_path + "rsem_merge_counts/genes/RAP1_IAA_30M_REP1.genes.results", checkIfExists: true), + file(params.pipelines_testdata_base_path + "rsem_merge_counts/genes/RAP1_UNINDUCED_REP1.genes.results", checkIfExists: true), + file(params.pipelines_testdata_base_path + "rsem_merge_counts/genes/RAP1_UNINDUCED_REP2.genes.results", checkIfExists: true) + ]).collect() + input[1] = Channel.of([ + file(params.pipelines_testdata_base_path + "rsem_merge_counts/isoforms/RAP1_IAA_30M_REP1.isoforms.results", checkIfExists: true), + file(params.pipelines_testdata_base_path + "rsem_merge_counts/isoforms/RAP1_UNINDUCED_REP1.isoforms.results", checkIfExists: true), + file(params.pipelines_testdata_base_path + "rsem_merge_counts/isoforms/RAP1_UNINDUCED_REP2.isoforms.results", checkIfExists: true) + ]).collect() + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/local/rsem_merge_counts/tests/main.nf.test.snap b/modules/local/rsem_merge_counts/tests/main.nf.test.snap index 800263c1a..1715d1279 100644 --- a/modules/local/rsem_merge_counts/tests/main.nf.test.snap +++ b/modules/local/rsem_merge_counts/tests/main.nf.test.snap @@ -1,4 +1,45 @@ { + "stub": { + "content": [ + { + "0": [ + "rsem.merged.gene_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "rsem.merged.gene_tpm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "2": [ + "rsem.merged.transcript_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "3": [ + "rsem.merged.transcript_tpm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "4": [ + "versions.yml:md5,48ca3e12c91829af8019462b3f6aa29c" + ], + "counts_gene": [ + "rsem.merged.gene_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "counts_transcript": [ + "rsem.merged.transcript_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "tpm_gene": [ + "rsem.merged.gene_tpm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "tpm_transcript": [ + "rsem.merged.transcript_tpm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,48ca3e12c91829af8019462b3f6aa29c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T11:55:29.45389" + }, "Should run without failures": { "content": [ { diff --git a/modules/local/star_genomegenerate_igenomes/main.nf b/modules/local/star_genomegenerate_igenomes/main.nf index 7b5115a6c..e36e04179 100644 --- a/modules/local/star_genomegenerate_igenomes/main.nf +++ b/modules/local/star_genomegenerate_igenomes/main.nf @@ -66,4 +66,53 @@ process STAR_GENOMEGENERATE_IGENOMES { END_VERSIONS """ } -} + + stub: + if (gtf) { + """ + mkdir star + touch star/Genome + touch star/Log.out + touch star/SA + touch star/SAindex + touch star/chrLength.txt + touch star/chrName.txt + touch star/chrNameLength.txt + touch star/chrStart.txt + touch star/exonGeTrInfo.tab + touch star/exonInfo.tab + touch star/geneInfo.tab + touch star/genomeParameters.txt + touch star/sjdbInfo.txt + touch star/sjdbList.fromGTF.out.tab + touch star/sjdbList.out.tab + touch star/transcriptInfo.tab + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + star: \$(STAR --version | sed -e "s/STAR_//g") + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//') + END_VERSIONS + """ + } else { + """ + mkdir star + touch star/Genome + touch star/Log.out + touch star/SA + touch star/SAindex + touch star/chrLength.txt + touch star/chrName.txt + touch star/chrNameLength.txt + touch star/chrStart.txt + touch star/genomeParameters.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + star: \$(STAR --version | sed -e "s/STAR_//g") + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//') + END_VERSIONS + """ + }}