Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nf-tests to gprofile2/gost #7265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions modules/nf-core/gprofiler2/gost/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process GPROFILER2_GOST {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-3712554873398d849d0d11b22440f41febbc4ede:aa19bb8afc0ec6456a4f3cd650f7577c3bbdd4f3-0':
'biocontainers/mulled-v2-3712554873398d849d0d11b22440f41febbc4ede:aa19bb8afc0ec6456a4f3cd650f7577c3bbdd4f3-0' }"
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e4/e4b0e10a72db4ad519c128c4e3cef6e10bc1a83440af31f105ab389a5532589a/data':
'community.wave.seqera.io/library/r-ggplot2_r-gprofiler2:fab855ea9f680400' }"

input:
tuple val(meta), path(de_file)
Expand All @@ -28,4 +28,24 @@ process GPROFILER2_GOST {

script:
template 'gprofiler2_gost.R'

stub:
def prefix = task.ext.prefix ?: meta.id
"""
touch ${prefix}.gprofiler2.all_enriched_pathways.tsv
touch ${prefix}.gprofiler2.gost_results.rds
touch ${prefix}.gprofiler2.gostplot.png
touch ${prefix}.gprofiler2.gostplot.html
touch ${prefix}.gprofiler2.*.sub_enriched_pathways.tsv
touch ${prefix}.gprofiler2.*.sub_enriched_pathways.png
touch ${prefix}.ENSG_filtered.gmt
touch ${prefix}.R_sessionInfo.log

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('ggplot2')))")
r-gprofiler2: \$(Rscript -e "library(gprofiler2); cat(as.character(packageVersion('gprofiler2')))")
END_VERSIONS
"""
}
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ gprofiler2.version <- as.character(packageVersion('gprofiler2'))
ggplot2.version <- as.character(packageVersion('ggplot2'))
writeLines(
c(
'"\${task.process}":',
'"$task.process":',
paste(' r-base:', r.version),
paste(' r-ggplot2:', ggplot2.version),
paste(' r-gprofiler2:', gprofiler2.version)
Expand Down
115 changes: 115 additions & 0 deletions modules/nf-core/gprofiler2/gost/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
nextflow_process {

name "Test Process GPROFILER2_GOST"
script "../main.nf"
process "GPROFILER2_GOST"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "gprofiler"
tag "gprofiler_gost"
tag "gost"
tag "gprofiler2/gost"
tag "gprofiler2"

test("test") {

when {
params{
gprofiler2_significant = true
gprofiler2_measure_underrepresentation = false
gprofiler2_correction_method = "gSCS"
gprofiler2_evcodes = false
gprofiler2_max_qval = 0.05
gprofiler2_domain_scope = "annotated"
gprofiler2_min_diff = 1
report_round_digits = 4
gprofiler2_palette_name = "Blues"
differential_feature_id_column = "gene_id"
gprofiler2_token = null
gprofiler2_organism = "mmusculus"
gprofiler2_background_column = null
gprofiler2_sources = null

module_args = [
"--significant \"${params.gprofiler2_significant}\"",
"--measure_underrepresentation \"${params.gprofiler2_measure_underrepresentation}\"",
"--correction_method \"${params.gprofiler2_correction_method}\"",
"--evcodes \"${params.gprofiler2_evcodes}\"",
"--pval_threshold \"${params.gprofiler2_max_qval}\"",
"--domain_scope ${params.gprofiler2_domain_scope}",
"--min_diff \"${params.gprofiler2_min_diff}\"",
"--round_digits ${params.report_round_digits}",
"--palette_name \"${params.gprofiler2_palette_name}\"",
((params.differential_feature_id_column == null) ? '' : "--de_id_column \"${params.differential_feature_id_column}\""),
((params.gprofiler2_token == null) ? '' : "--token \"${params.gprofiler2_token}\""),
((params.gprofiler2_organism == null) ? '' : "--organism \"${params.gprofiler2_organism}\""),
((params.gprofiler2_background_column == null) ? '' : "--background_column \"${params.gprofiler2_background_column}\""),
((params.gprofiler2_sources == null) ? '' : "--sources \"${params.gprofiler2_sources}\"")
].join(' ').trim()
}
process {
"""
input[0] = [['id':'Condition_genotype_WT_KO', 'variable':'Condition genotype', 'reference':'WT', 'target':'KO', 'blocking':'batch'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/Condition_genotype_WT_KO.deseq2.results_filtered.tsv", checkIfExists: true)]
input[1] = file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt", checkIfExists: true)
input[2] = file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/study.filtered.tsv", checkIfExists: true)
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(
process.out.all_enrich,
process.out.plot_png,
process.out.sub_enrich,
process.out.sub_plot,
process.out.filtered_gmt,
process.out.session_info,
process.out.versions,
process.out.plot_html.collect{ meta,html -> file(html).name }, //assert unstable file
process.out.rds.collect{ meta,rds -> file(rds).name } //assert unstable file
).match()
}
)
}
}

test("stub") {

options "-stub"

when {
params{
module_args = null
}
process {
"""
input[0] = [['id':'Condition_genotype_WT_KO', 'variable':'Condition genotype', 'reference':'WT', 'target':'KO', 'blocking':'batch'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/Condition_genotype_WT_KO.deseq2.results_filtered.tsv", checkIfExists: true)]
input[1] = file("https://github.com/nf-core/test-datasets/raw/refs/heads/modules/data/genomics/mus_musculus/gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt", checkIfExists: true)
input[2] = file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/study.filtered.tsv", checkIfExists: true)
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(
process.out.all_enrich,
process.out.plot_png,
process.out.sub_enrich,
process.out.sub_plot,
process.out.filtered_gmt,
process.out.session_info,
process.out.versions,
process.out.plot_html.collect{ meta,html -> file(html).name }, //assert unstable file
process.out.rds.collect{ meta,rds -> file(rds).name } //assert unstable file
).match()
}
)
}
}
}
193 changes: 193 additions & 0 deletions modules/nf-core/gprofiler2/gost/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"test": {
"content": [
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.all_enriched_pathways.tsv:md5,1134a02ca061c463bcbff277eefbfb19"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.gostplot.png:md5,4b83d1bcf7dc9dbf6cef3d545e440c5b"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
[
"Condition_genotype_WT_KO.gprofiler2.GO:BP.sub_enriched_pathways.tsv:md5,d527b94cdb160070bcaa0bfb0cecf914",
"Condition_genotype_WT_KO.gprofiler2.GO:CC.sub_enriched_pathways.tsv:md5,ef418c3f06d50446317928e37ec8ddfb",
"Condition_genotype_WT_KO.gprofiler2.GO:MF.sub_enriched_pathways.tsv:md5,e460d4917feb0b64d334a528f59e0731",
"Condition_genotype_WT_KO.gprofiler2.HP.sub_enriched_pathways.tsv:md5,865d8f092503552831c51d775a98c6eb",
"Condition_genotype_WT_KO.gprofiler2.KEGG.sub_enriched_pathways.tsv:md5,413724002abe683f376ea914d4f21ade",
"Condition_genotype_WT_KO.gprofiler2.MIRNA.sub_enriched_pathways.tsv:md5,fce81051d7af955ddb2925ba2da9ff57",
"Condition_genotype_WT_KO.gprofiler2.REAC.sub_enriched_pathways.tsv:md5,e89e1876698ea644671a0720c85f4dbb",
"Condition_genotype_WT_KO.gprofiler2.TF.sub_enriched_pathways.tsv:md5,e272217ec7fcf01ea463ab8bcc8335cf",
"Condition_genotype_WT_KO.gprofiler2.WP.sub_enriched_pathways.tsv:md5,fdd1efa836d85bb127e933e925290cba"
]
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
[
"Condition_genotype_WT_KO.gprofiler2.GO:BP.sub_enriched_pathways.png:md5,d89498267e985adf0ad1266e2deb9f48",
"Condition_genotype_WT_KO.gprofiler2.GO:CC.sub_enriched_pathways.png:md5,e04cdd51b200671613254d021d3af242",
"Condition_genotype_WT_KO.gprofiler2.GO:MF.sub_enriched_pathways.png:md5,33ea0652d78111978677acde0fe7f807",
"Condition_genotype_WT_KO.gprofiler2.HP.sub_enriched_pathways.png:md5,6c040ac4baba73ae5637b00650e6aea1",
"Condition_genotype_WT_KO.gprofiler2.KEGG.sub_enriched_pathways.png:md5,fbd232c4eeced95ceda60b43a02dbe1f",
"Condition_genotype_WT_KO.gprofiler2.MIRNA.sub_enriched_pathways.png:md5,956880d3bf4852a06b0ffaaaba565732",
"Condition_genotype_WT_KO.gprofiler2.REAC.sub_enriched_pathways.png:md5,0e8f9217d275668986771dc7fede3170",
"Condition_genotype_WT_KO.gprofiler2.TF.sub_enriched_pathways.png:md5,0697164bc87e95e6508db966df94e01e",
"Condition_genotype_WT_KO.gprofiler2.WP.sub_enriched_pathways.png:md5,09976762c7541ff9e5009e8763986845"
]
]
],
[

],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"R_sessionInfo.log:md5,47643dc530c1a01102cc9db58c1f6b62"
]
],
[
"versions.yml:md5,7ff4ab78463faf97bba7e698ed9a9069"
],
[
"Condition_genotype_WT_KO.gprofiler2.gostplot.html"
],
[
"Condition_genotype_WT_KO.gprofiler2.gost_results.rds"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-27T19:16:24.14894842"
},
"stub": {
"content": [
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.all_enriched_pathways.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.gostplot.png:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.*.sub_enriched_pathways.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.*.sub_enriched_pathways.png:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.ENSG_filtered.gmt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "Condition_genotype_WT_KO",
"variable": "Condition genotype",
"reference": "WT",
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.R_sessionInfo.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
"versions.yml:md5,7ff4ab78463faf97bba7e698ed9a9069"
],
[
"Condition_genotype_WT_KO.gprofiler2.gostplot.html"
],
[
"Condition_genotype_WT_KO.gprofiler2.gost_results.rds"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-27T19:16:37.689819563"
}
}
3 changes: 3 additions & 0 deletions modules/nf-core/gprofiler2/gost/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
process {
ext.args = params.module_args
}
Loading