Skip to content

Commit

Permalink
Merge pull request #103 from alanmmobbs93/update/create-test-create_a…
Browse files Browse the repository at this point in the history
…nnotated_tables

Create nf-tests for create_annotated_tables module
  • Loading branch information
alanmmobbs93 authored Nov 22, 2024
2 parents bc40764 + c1eaaa2 commit c20d880
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

### `Fixed`

Expand Down
8 changes: 8 additions & 0 deletions modules/local/create_annotated_tables/environment.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
"""
}
31 changes: 31 additions & 0 deletions modules/local/create_annotated_tables/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}

}

}
43 changes: 43 additions & 0 deletions modules/local/create_annotated_tables/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 3 additions & 3 deletions tests/test.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -115,6 +115,6 @@
"nf-test": "0.9.0",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-19T21:23:55.334879021"
"timestamp": "2024-11-21T12:52:19.83780821"
}
}
}
6 changes: 3 additions & 3 deletions tests/test_samples.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -115,6 +115,6 @@
"nf-test": "0.9.0",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-19T21:24:55.10531256"
"timestamp": "2024-11-21T18:48:26.062894171"
}
}
}
4 changes: 2 additions & 2 deletions tests/test_scores.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -141,6 +141,6 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-20T20:01:05.948521351"
"timestamp": "2024-11-21T12:55:12.430646745"
}
}
2 changes: 1 addition & 1 deletion workflows/nanostring.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c20d880

Please sign in to comment.