diff --git a/CHANGELOG.md b/CHANGELOG.md index 6782b22..5769822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#100](https://github.com/nf-core/nanostring/pull/100) - Added nf-tests for local module `NACHO_QC`. - [#101](https://github.com/nf-core/nanostring/pull/101) - Added nf-tests for local module `COMPUTE_GENE_SCORES`. - [#102](https://github.com/nf-core/nanostring/pull/102) - Added nf-tests for local module `CREATE_GENE_HEATMAP`. +- [#103](https://github.com/nf-core/nanostring/pull/103) - Added nf-tests for local module `CREATE_ANNOTATED_TABLES`. - [#104](https://github.com/nf-core/nanostring/pull/104) - Update all nf-core modules and subworkflows. ### `Fixed` diff --git a/modules/local/create_annotated_tables/environment.yml b/modules/local/create_annotated_tables/environment.yml new file mode 100644 index 0000000..6af817c --- /dev/null +++ b/modules/local/create_annotated_tables/environment.yml @@ -0,0 +1,8 @@ +channels: + - conda-forge +dependencies: + - conda-forge::r-dplyr=1.1.4 + - conda-forge::r-ggplot2=3.4.4 + - conda-forge::r-readr=2.1.5 + - conda-forge::r-stringr=1.5.0 + - conda-forge::r-tidyr=1.3.0 diff --git a/modules/local/create_annotated_tables.nf b/modules/local/create_annotated_tables/main.nf similarity index 55% rename from modules/local/create_annotated_tables.nf rename to modules/local/create_annotated_tables/main.nf index a9e6772..fbe2b24 100644 --- a/modules/local/create_annotated_tables.nf +++ b/modules/local/create_annotated_tables/main.nf @@ -1,10 +1,9 @@ process CREATE_ANNOTATED_TABLES { + tag "$sample_sheet" label 'process_single' - conda "r-tidyr=1.3.0 r-ggplot2=3.4.4 r-dplyr=1.1.4 r-stringr=1.5.0 r-readr=2.1.5" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-5ff8b00c2d7f6173e034c115dfe295627ff99689:beb0ad5f49ec2904f79edffacd41bba38492e881-0' : - 'biocontainers/mulled-v2-5ff8b00c2d7f6173e034c115dfe295627ff99689:beb0ad5f49ec2904f79edffacd41bba38492e881-0' }" + conda "${moduleDir}/environment.yml" + container "community.wave.seqera.io/library/r-dplyr_r-ggplot2_r-readr_r-stringr_r-tidyr:44c4e4fe69e11c2f" input: path counts @@ -32,5 +31,20 @@ process CREATE_ANNOTATED_TABLES { r-readr: \$(Rscript -e "library(readr); cat(as.character(packageVersion('readr')))") END_VERSIONS """ -} + stub: + def args = task.ext.args ?: '' + """ + touch ENDO.tsv + touch HK.tsv + touch mqc.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//') + r-ggplot2: \$(Rscript -e "library(ggplot2); cat(as.character(packageVersion('ggplot')))") + r-dplyr: \$(Rscript -e "library(dplyr); cat(as.character(packageVersion('dplyr')))") + r-readr: \$(Rscript -e "library(readr); cat(as.character(packageVersion('readr')))") + END_VERSIONS + """ +} diff --git a/modules/local/create_annotated_tables/tests/main.nf.test b/modules/local/create_annotated_tables/tests/main.nf.test new file mode 100644 index 0000000..5af36f9 --- /dev/null +++ b/modules/local/create_annotated_tables/tests/main.nf.test @@ -0,0 +1,31 @@ +nextflow_process { + + name "Test Process CREATE_ANNOTATED_TABLES" + script "../main.nf" + process "CREATE_ANNOTATED_TABLES" + tag "module" + + test("Should run without failures") { + + when { + process { + """ + // Normalized file + input[0] = file(params.pipelines_testdata_base_path + 'nanostring/modules_test_data/test_profile/normalized_counts.tsv', checkIfExists: true) + + // Sample sheet + input[1] = file(params.pipelines_testdata_base_path + 'nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/local/create_annotated_tables/tests/main.nf.test.snap b/modules/local/create_annotated_tables/tests/main.nf.test.snap new file mode 100644 index 0000000..6c066db --- /dev/null +++ b/modules/local/create_annotated_tables/tests/main.nf.test.snap @@ -0,0 +1,43 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + "counts_Norm_GEX_ENDO.tsv:md5,5992886680cb6fc6f3e901e79752d544" + ], + "1": [ + "counts_Norm_GEX_HK.tsv:md5,9d8a0503df864a82990648348131be21" + ], + "2": [ + [ + "Norm_GEX_ENDO_mqc.tsv:md5,5992886680cb6fc6f3e901e79752d544", + "Norm_GEX_HK_mqc.tsv:md5,9d8a0503df864a82990648348131be21" + ] + ], + "3": [ + "versions.yml:md5,43b871def59fb08862ac85e636101fe5" + ], + "annotated_data_mqc": [ + [ + "Norm_GEX_ENDO_mqc.tsv:md5,5992886680cb6fc6f3e901e79752d544", + "Norm_GEX_HK_mqc.tsv:md5,9d8a0503df864a82990648348131be21" + ] + ], + "annotated_endo_data": [ + "counts_Norm_GEX_ENDO.tsv:md5,5992886680cb6fc6f3e901e79752d544" + ], + "annotated_hk_data": [ + "counts_Norm_GEX_HK.tsv:md5,9d8a0503df864a82990648348131be21" + ], + "versions": [ + "versions.yml:md5,43b871def59fb08862ac85e636101fe5" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.1" + }, + "timestamp": "2024-11-20T14:10:50.997813905" + } +} \ No newline at end of file diff --git a/tests/test.nf.test.snap b/tests/test.nf.test.snap index 1754ace..a11f997 100644 --- a/tests/test.nf.test.snap +++ b/tests/test.nf.test.snap @@ -4,7 +4,7 @@ 5, { "CREATE_ANNOTATED_TABLES": { - "r-base": "4.3.2", + "r-base": "4.3.3", "r-ggplot2": null, "r-dplyr": "1.1.4", "r-readr": "2.1.5" @@ -112,4 +112,4 @@ }, "timestamp": "2024-11-22T14:03:55.044702369" } -} \ No newline at end of file +} diff --git a/tests/test_samples.nf.test.snap b/tests/test_samples.nf.test.snap index d9a3508..19ae973 100644 --- a/tests/test_samples.nf.test.snap +++ b/tests/test_samples.nf.test.snap @@ -4,7 +4,7 @@ 5, { "CREATE_ANNOTATED_TABLES": { - "r-base": "4.3.2", + "r-base": "4.3.3", "r-ggplot2": null, "r-dplyr": "1.1.4", "r-readr": "2.1.5" @@ -114,4 +114,4 @@ }, "timestamp": "2024-11-22T14:04:43.919125465" } -} \ No newline at end of file +} diff --git a/tests/test_scores.nf.test.snap b/tests/test_scores.nf.test.snap index 528969b..d59f1e7 100644 --- a/tests/test_scores.nf.test.snap +++ b/tests/test_scores.nf.test.snap @@ -15,7 +15,7 @@ "r-matrixstats": null }, "CREATE_ANNOTATED_TABLES": { - "r-base": "4.3.2", + "r-base": "4.3.3", "r-ggplot2": null, "r-dplyr": "1.1.4", "r-readr": "2.1.5" @@ -140,4 +140,4 @@ }, "timestamp": "2024-11-22T14:06:23.244531229" } -} \ No newline at end of file +} diff --git a/workflows/nanostring.nf b/workflows/nanostring.nf index 62ba3ad..9c3f218 100644 --- a/workflows/nanostring.nf +++ b/workflows/nanostring.nf @@ -91,7 +91,7 @@ workflow NANOSTRING { // MODULE: Annotate normalized counts with metadata from the samplesheet // CREATE_ANNOTATED_TABLES ( - NORMALIZE.out.normalized_counts.mix(NORMALIZE.out.normalized_counts_wo_HK), + NORMALIZE.out.normalized_counts.mix(NORMALIZE.out.normalized_counts_wo_HK).toSortedList().flatten(), samplesheet_path ) ch_versions = ch_versions.mix(CREATE_ANNOTATED_TABLES.out.versions)