diff --git a/modules/nf-core/shinyngs/staticdifferential/main.nf b/modules/nf-core/shinyngs/staticdifferential/main.nf index 40582d66..ea33769e 100644 --- a/modules/nf-core/shinyngs/staticdifferential/main.nf +++ b/modules/nf-core/shinyngs/staticdifferential/main.nf @@ -4,8 +4,8 @@ process SHINYNGS_STATICDIFFERENTIAL { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/r-shinyngs:2.0.0--r43hdfd78af_0' : - 'biocontainers/r-shinyngs:2.0.0--r43hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/2b/2b43cb5832431a3d581f3abdca0f5d45fa814b8a4b2c4e49f12296d2e07629fd/data' : + 'community.wave.seqera.io/library/r-shinyngs:2.0.0--feeacac14bcf4bb0' }" input: tuple val(meta), path(differential_result) // Differential info: contrast and differential stats @@ -37,4 +37,18 @@ process SHINYNGS_STATICDIFFERENTIAL { r-shinyngs: \$(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))") END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: meta.id + """ + mkdir -p $prefix/png && mkdir $prefix/html + touch $prefix/png/volcano.png + touch $prefix/html/volcano.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//') + r-shinyngs: \$(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))") + END_VERSIONS + """ } diff --git a/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test b/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test new file mode 100644 index 00000000..59153fcb --- /dev/null +++ b/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test @@ -0,0 +1,100 @@ +nextflow_process { + + name "Test Process SHINYNGS_STATICDIFFERENTIAL" + script "../main.nf" + process "SHINYNGS_STATICDIFFERENTIAL" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "shinyngs" + tag "shinyngs/staticdifferential" + + test("test") { + + when { + params{ + features_id_col = "gene_id" + reference = "mCherry" + target = "hND6" + differential_fc_column = "log2FoldChange" + differential_qval_column = "padj" + differential_feature_id_column = "gene_id" + differential_min_fold_change = 2.0 + differential_max_qval = 0.05 + differential_foldchanges_logged = true + differential_palette_name = "Set1" + module_args = [ + "--feature_id_col \"${params.features_id_col}\"", + "--reference_level \"${params.reference}\"", + "--treatment_level \"${params.target}\"", + "--fold_change_col \"${params.differential_fc_column}\"", + "--p_value_column \"${params.differential_qval_column}\"", + "--diff_feature_id_col \"${params.differential_feature_id_column}\"", + "--fold_change_threshold \"${params.differential_min_fold_change}\"", + "--p_value_threshold \"${params.differential_max_qval}\"", + "--unlog_foldchanges \"${params.differential_foldchanges_logged}\"", + "--palette_name \"${params.differential_palette_name}\"" + ].join(' ').trim() + } + process { + """ + input[0] = [['id':'treatment_mCherry_hND6_', 'variable':'treatment', 'reference':'mCherry', 'target':'hND6', 'blocking':''], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/treatment_mCherry_hND6_.deseq2.results.tsv", checkIfExists:true)] + input[1] = [['id':'SRP254919'], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/Mus_musculus.anno.tsv", checkIfExists:true), [file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/all.normalised_counts.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/all.vst.tsv", checkIfExists:true)]] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("stub") { + + options "-stub" + + when { + params{ + features_id_col = "gene_id" + reference = "mCherry" + target = "hND6" + differential_fc_column = "log2FoldChange" + differential_qval_column = "padj" + differential_feature_id_column = "gene_id" + differential_min_fold_change = 2.0 + differential_max_qval = 0.05 + differential_foldchanges_logged = true + differential_palette_name = "Set1" + module_args = [ + "--feature_id_col \"${params.features_id_col}\"", + "--reference_level \"${params.reference}\"", + "--treatment_level \"${params.target}\"", + "--fold_change_col \"${params.differential_fc_column}\"", + "--p_value_column \"${params.differential_qval_column}\"", + "--diff_feature_id_col \"${params.differential_feature_id_column}\"", + "--fold_change_threshold \"${params.differential_min_fold_change}\"", + "--p_value_threshold \"${params.differential_max_qval}\"", + "--unlog_foldchanges \"${params.differential_foldchanges_logged}\"", + "--palette_name \"${params.differential_palette_name}\"" + ].join(' ').trim() + } + process { + """ + input[0] = [['id':'treatment_mCherry_hND6_', 'variable':'treatment', 'reference':'mCherry', 'target':'hND6', 'blocking':''], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/treatment_mCherry_hND6_.deseq2.results.tsv", checkIfExists:true)] + input[1] = [['id':'SRP254919'], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/Mus_musculus.anno.tsv", checkIfExists:true), [file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/all.normalised_counts.tsv", checkIfExists:true), file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/all.vst.tsv", checkIfExists:true)]] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test.snap b/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test.snap new file mode 100644 index 00000000..a5b59e75 --- /dev/null +++ b/modules/nf-core/shinyngs/staticdifferential/tests/main.nf.test.snap @@ -0,0 +1,114 @@ +{ + "test": { + "content": [ + { + "0": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.png:md5,32d82a790e028f9476972a7f38190430" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,907105596993b0b0eda8989fba5a3a29" + ], + "versions": [ + "versions.yml:md5,907105596993b0b0eda8989fba5a3a29" + ], + "volcanos_html": [ + + ], + "volcanos_png": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.png:md5,32d82a790e028f9476972a7f38190430" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.3" + }, + "timestamp": "2024-12-26T16:03:53.372133087" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,907105596993b0b0eda8989fba5a3a29" + ], + "versions": [ + "versions.yml:md5,907105596993b0b0eda8989fba5a3a29" + ], + "volcanos_html": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "volcanos_png": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "volcano.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.3" + }, + "timestamp": "2024-12-26T16:04:08.867324031" + } +} \ No newline at end of file diff --git a/modules/nf-core/shinyngs/staticdifferential/tests/nextflow.config b/modules/nf-core/shinyngs/staticdifferential/tests/nextflow.config new file mode 100644 index 00000000..ad3d36ef --- /dev/null +++ b/modules/nf-core/shinyngs/staticdifferential/tests/nextflow.config @@ -0,0 +1,3 @@ +process { + ext.args = params.module_args +} diff --git a/modules/nf-core/shinyngs/staticdifferential/tests/tags.yml b/modules/nf-core/shinyngs/staticdifferential/tests/tags.yml new file mode 100644 index 00000000..03e2b59e --- /dev/null +++ b/modules/nf-core/shinyngs/staticdifferential/tests/tags.yml @@ -0,0 +1,2 @@ +shinyngs/app: + - "modules/nf-core/shinyngs/staticdifferential/**" diff --git a/modules/nf-core/shinyngs/validatefomcomponents/main.nf b/modules/nf-core/shinyngs/validatefomcomponents/main.nf index bedab3e6..6d1a47aa 100644 --- a/modules/nf-core/shinyngs/validatefomcomponents/main.nf +++ b/modules/nf-core/shinyngs/validatefomcomponents/main.nf @@ -44,4 +44,20 @@ process SHINYNGS_VALIDATEFOMCOMPONENTS { r-shinyngs: \$(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))") END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: meta.id + """ + mkdir $prefix + touch $prefix/${prefix}.sample_metadata.tsv + touch $prefix/${prefix}.feature_metadata.tsv + touch $prefix/${prefix}.assay.tsv + touch $prefix/${prefix}.contrasts_file.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//') + r-shinyngs: \$(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))") + END_VERSIONS + """ } diff --git a/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test b/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test new file mode 100644 index 00000000..8849f8a9 --- /dev/null +++ b/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test @@ -0,0 +1,66 @@ +nextflow_process { + + name "Test Process SHINYNGS_VALIDATEFOMCOMPONENTS" + script "../main.nf" + process "SHINYNGS_VALIDATEFOMCOMPONENTS" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "shinyngs" + tag "shinyngs/validatefomcomponents" + + test("test") { + + when { + params{ + observations_id_col = "sample" + features_id_col = "gene_id" + + module_args = "--sample_id_col '${params.observations_id_col}' --feature_id_col '${params.features_id_col}'" + } + process { + """ + input[0] = [['id':'SRP254919'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv", checkIfExists:true), file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv", checkIfExists:true)] + input[1] = [['id':'SRP254919'], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/Mus_musculus.anno.tsv", checkIfExists:true)] + input[2] = [['id':'SRP254919'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.contrasts.csv", checkIfExists:true)] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("stub") { + + options "-stub" + + when { + params{ + observations_id_col = "sample" + features_id_col = "gene_id" + + module_args = "--sample_id_col '${params.observations_id_col}' --feature_id_col '${params.features_id_col}'" + } + process { + """ + input[0] = [['id':'SRP254919'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv", checkIfExists:true), file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv", checkIfExists:true)] + input[1] = [['id':'SRP254919'], file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/differentialabundance/modules_testdata/Mus_musculus.anno.tsv", checkIfExists:true)] + input[2] = [['id':'SRP254919'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.contrasts.csv", checkIfExists:true)] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test.snap b/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test.snap new file mode 100644 index 00000000..7b005d00 --- /dev/null +++ b/modules/nf-core/shinyngs/validatefomcomponents/tests/main.nf.test.snap @@ -0,0 +1,164 @@ +{ + "test": { + "content": [ + { + "0": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.samplesheet.sample_metadata.tsv:md5,7c5233cf34fd8eaf7071f21f6fcac7d8" + ] + ], + "1": [ + [ + { + "id": "SRP254919" + }, + "Mus_musculus.anno.feature_metadata.tsv:md5,1b6a2af23f009f4669401678fe0947bb" + ] + ], + "2": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv:md5,0c2224f6c33af1fe93c3b1382b3e05ce" + ] + ], + "3": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.contrasts.contrasts_file.tsv:md5,e0980240404f48216aedb63b5094029f" + ] + ], + "4": [ + "versions.yml:md5,93d5c94e00214eeba1e2c4b0ef52b1ad" + ], + "assays": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv:md5,0c2224f6c33af1fe93c3b1382b3e05ce" + ] + ], + "contrasts": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.contrasts.contrasts_file.tsv:md5,e0980240404f48216aedb63b5094029f" + ] + ], + "feature_meta": [ + [ + { + "id": "SRP254919" + }, + "Mus_musculus.anno.feature_metadata.tsv:md5,1b6a2af23f009f4669401678fe0947bb" + ] + ], + "sample_meta": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.samplesheet.sample_metadata.tsv:md5,7c5233cf34fd8eaf7071f21f6fcac7d8" + ] + ], + "versions": [ + "versions.yml:md5,93d5c94e00214eeba1e2c4b0ef52b1ad" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.3" + }, + "timestamp": "2024-12-26T17:27:38.287530077" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.sample_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.feature_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.assay.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.contrasts_file.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + "versions.yml:md5,93d5c94e00214eeba1e2c4b0ef52b1ad" + ], + "assays": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.assay.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "contrasts": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.contrasts_file.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "feature_meta": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.feature_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "sample_meta": [ + [ + { + "id": "SRP254919" + }, + "SRP254919.sample_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,93d5c94e00214eeba1e2c4b0ef52b1ad" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.3" + }, + "timestamp": "2024-12-26T17:27:54.985123298" + } +} \ No newline at end of file diff --git a/modules/nf-core/shinyngs/validatefomcomponents/tests/nextflow.config b/modules/nf-core/shinyngs/validatefomcomponents/tests/nextflow.config new file mode 100644 index 00000000..ad3d36ef --- /dev/null +++ b/modules/nf-core/shinyngs/validatefomcomponents/tests/nextflow.config @@ -0,0 +1,3 @@ +process { + ext.args = params.module_args +} diff --git a/modules/nf-core/shinyngs/validatefomcomponents/tests/tags.yml b/modules/nf-core/shinyngs/validatefomcomponents/tests/tags.yml new file mode 100644 index 00000000..19d86ae0 --- /dev/null +++ b/modules/nf-core/shinyngs/validatefomcomponents/tests/tags.yml @@ -0,0 +1,2 @@ +shinyngs/app: + - "modules/nf-core/shinyngs/validatefomcomponents/**" diff --git a/workflows/differentialabundance.nf b/workflows/differentialabundance.nf index 707395dc..a9e0d3ab 100644 --- a/workflows/differentialabundance.nf +++ b/workflows/differentialabundance.nf @@ -317,6 +317,11 @@ workflow DIFFERENTIALABUNDANCE { ch_matrices_for_validation = ch_in_raw } + + ch_input.join(ch_matrices_for_validation).dump(tag:"VALIDATOR_ch_input") + ch_features.dump(tag:"VALIDATOR_ch_features") + ch_contrasts_file.dump(tag:"VALIDATOR_ch_contrasts_file") + VALIDATOR( ch_input.join(ch_matrices_for_validation), ch_features, @@ -569,6 +574,8 @@ workflow DIFFERENTIALABUNDANCE { ) // Differential analysis using the results of DESeq2 + ch_differential.dump(tag:"PLOT_DIFFERENTIAL_ch_differential") + ch_all_matrices.dump(tag:"PLOT_DIFFERENTIAL_ch_all_matrices") PLOT_DIFFERENTIAL( ch_differential,