Skip to content

Commit

Permalink
Update diff subworkflows (#7414)
Browse files Browse the repository at this point in the history
* [gsea] unable default seed option

* [subworkflow] update abundance_differential_filter to output a list of files for variance stabilised matrices. This is to facilitate the channel handling afterwards in the differentialabundance pipeline

* [gsea] add module test config

* update functional subworkflow. Also update gprofiler2 related snapshots - as they changed after database update

* [gprofiler2] add option to specify the database archive

* [gsea] remove default seed set in gsea module

* change(abundance_differential_filter): use groupTuple for ch_variance_stabilised_matrix

* change(differential and functional subworkflows): add back mergeMap and update snapshots

* fix(snapshot): update gprofiler2/gost test snapshots

* fix(gprofiler2_gost): set base url to an old archive for reproducibility.

* fix(gprofiler2_gost): update test snapshots to match with the latest database

* simplify ch_variance_stabilised_matrix with groupTuple()

Co-authored-by: Jonathan Manning <[email protected]>

* update propd container

* update differential and functional subworkflows by replacing 'method' by 'method_differential' and 'method_functional'

* fix: update version snapshots for the new propd container

---------

Co-authored-by: Jonathan Manning <[email protected]>
  • Loading branch information
suzannejin and pinin4fjords authored Feb 13, 2025
1 parent 5bca12d commit 785efc6
Show file tree
Hide file tree
Showing 23 changed files with 311 additions and 302 deletions.
7 changes: 5 additions & 2 deletions modules/nf-core/gprofiler2/gost/templates/gprofiler2_gost.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ opt <- list(
domain_scope = 'annotated',
min_diff = 1,
round_digits = -1,
palette_name = 'Blues'
palette_name = 'Blues',
archive = 'gprofiler'
)

opt_types <- lapply(opt, class)
Expand Down Expand Up @@ -235,7 +236,9 @@ if (nrow(de.genes) > 0) {
} else if (!is.null(opt\$organism)) {

# Next, check if organism was provided. Get the GMT file from gprofiler and save both the full file as well as the filtered one to metadata
gmt_url <- paste0("https://biit.cs.ut.ee/gprofiler//static/gprofiler_full_", opt\$organism, ".ENSG.gmt")
base_url <- paste0("https://biit.cs.ut.ee/", opt\$archive)
gmt_url <- paste0(base_url, "//static/gprofiler_full_", opt\$organism, ".ENSG.gmt")
set_base_url(base_url)
tryCatch(
{
gmt_path <- paste0("gprofiler_full_", opt\$organism, ".ENSG.gmt")
Expand Down
22 changes: 11 additions & 11 deletions modules/nf-core/gprofiler2/gost/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"target": "KO",
"blocking": "batch"
},
"Condition_genotype_WT_KO.gprofiler2.all_enriched_pathways.tsv:md5,1134a02ca061c463bcbff277eefbfb19"
"Condition_genotype_WT_KO.gprofiler2.all_enriched_pathways.tsv:md5,31d1e4cfa1d09b30bf9126415cb93aff"
]
],
[
Expand All @@ -23,15 +23,15 @@
"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.GO:BP.sub_enriched_pathways.tsv:md5,6211f4fa1a226f3aaab77c3fb9318fe7",
"Condition_genotype_WT_KO.gprofiler2.GO:CC.sub_enriched_pathways.tsv:md5,98a49b69f8b724d88d6367dea494ca53",
"Condition_genotype_WT_KO.gprofiler2.GO:MF.sub_enriched_pathways.tsv:md5,39ce8238319df47708df78b1c461a89d",
"Condition_genotype_WT_KO.gprofiler2.HP.sub_enriched_pathways.tsv:md5,616f3a5d19844001bb8aac38049e987a",
"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"
"Condition_genotype_WT_KO.gprofiler2.MIRNA.sub_enriched_pathways.tsv:md5,9168f1d7f7d1b1db18a4652db05b81b6",
"Condition_genotype_WT_KO.gprofiler2.REAC.sub_enriched_pathways.tsv:md5,3571ac765c47e1c38c63c463465f2a1e",
"Condition_genotype_WT_KO.gprofiler2.TF.sub_enriched_pathways.tsv:md5,4d23e5fdc96395ea79d174b1afe84756",
"Condition_genotype_WT_KO.gprofiler2.WP.sub_enriched_pathways.tsv:md5,e99c42df912a9ee75c7197f92d615979"
]
]
],
Expand Down Expand Up @@ -65,9 +65,9 @@
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
"nextflow": "24.10.4"
},
"timestamp": "2025-01-21T11:29:54.746689985"
"timestamp": "2025-02-07T15:34:05.718473191"
},
"stub": {
"content": [
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/gprofiler2/gost/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
process {
ext.args = params.module_args
}
}
1 change: 0 additions & 1 deletion modules/nf-core/gsea/gsea/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ process GSEA_GSEA {
def rpt_label = prefix.replaceAll('\\.$', '') // Remove any trailing dots from prefix when passed as report label, so GSEA doesn't produce double-dotted top-level outputs
def chip_command = chip ? "-chip $chip -collapse true" : ''
def VERSION = '4.3.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
if (!(args ==~ /.*-rnd_seed.*/)) {args += " -rnd_seed 10"}

"""
# Run GSEA
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/gsea/gsea/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ nextflow_process {

test("test") {

config "./nextflow.config"

when {
process {
"""
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/gsea/gsea/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: 'GSEA_GSEA' {
ext.args = { "-rnd_seed 10" }
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/propr/propd/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ channels:

dependencies:
- bioconda::bioconductor-limma=3.58.1
- conda-forge::r-propr=5.1.5
- conda-forge::r-propr=5.1.6
4 changes: 2 additions & 2 deletions modules/nf-core/propr/propd/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process PROPR_PROPD {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b6/b65f7192866fbd9a947df15b104808abb720e7a224bbe3ca8f7f8f680f52c97a/data' :
'community.wave.seqera.io/library/bioconductor-limma_r-propr:f52f1d4fea746393' }"
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/27/276e08c149faa028a34ec65f74ac9eac58c2036a30db1f72acc9e35967936620/data' :
'community.wave.seqera.io/library/bioconductor-limma_r-propr:8d299a2da993327c' }"

input:
tuple val(meta), val(contrast_variable), val(reference), val(target)
Expand Down
24 changes: 12 additions & 12 deletions modules/nf-core/propr/propd/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
]
],
[
"versions.yml:md5,1d96e70c16cc53a1d7b2e1a54fd8b7e8"
"versions.yml:md5,f356eb5d430713b086255dfc32b5d6ee"
],
"treatment_mCherry_hND6_.propd.genewise.png"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nextflow": "24.10.4"
},
"timestamp": "2024-11-27T10:11:40.654796611"
"timestamp": "2025-02-13T11:28:17.523375516"
},
"Test propr/propd when using Box-cox transformation": {
"content": [
Expand All @@ -39,15 +39,15 @@
]
],
[
"versions.yml:md5,1d96e70c16cc53a1d7b2e1a54fd8b7e8"
"versions.yml:md5,f356eb5d430713b086255dfc32b5d6ee"
],
"treatment_mCherry_hND6_.propd.genewise.png"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nextflow": "24.10.4"
},
"timestamp": "2024-11-27T10:12:22.252395938"
"timestamp": "2025-02-13T11:29:03.711287557"
},
"Test propr/propd when using permutation tests": {
"content": [
Expand Down Expand Up @@ -76,15 +76,15 @@
]
],
[
"versions.yml:md5,1d96e70c16cc53a1d7b2e1a54fd8b7e8"
"versions.yml:md5,f356eb5d430713b086255dfc32b5d6ee"
],
"treatment_mCherry_hND6_.propd.genewise.png"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nextflow": "24.10.4"
},
"timestamp": "2024-11-27T10:13:03.55054778"
"timestamp": "2025-02-13T11:29:38.37807294"
},
"Test propr/propd when saving all outputs": {
"content": [
Expand Down Expand Up @@ -126,15 +126,15 @@
],
null,
[
"versions.yml:md5,1d96e70c16cc53a1d7b2e1a54fd8b7e8"
"versions.yml:md5,f356eb5d430713b086255dfc32b5d6ee"
],
"treatment_mCherry_hND6_.propd.genewise.png",
"treatment_mCherry_hND6_.propd.rds"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nextflow": "24.10.4"
},
"timestamp": "2024-11-27T10:12:01.936451896"
"timestamp": "2025-02-13T11:28:45.957361627"
}
}
39 changes: 22 additions & 17 deletions subworkflows/nf-core/abundance_differential_filter/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {

// Set up how the channels crossed below will be used to generate channels for processing
def criteria = multiMapCriteria { meta_input, abundance, analysis_method, fc_threshold, stat_threshold, meta_exp, samplesheet, meta_contrasts, variable, reference, target ->
def meta_for_diff = mergeMaps(meta_contrasts, meta_input) + [ 'method': analysis_method ]
def meta_input_new = meta_input + [ 'method': analysis_method ]
def meta_for_diff = mergeMaps(meta_contrasts, meta_input) + [ 'method_differential': analysis_method ]
def meta_input_new = meta_input + [ 'method_differential': analysis_method ]
samples_and_matrix:
[ meta_input_new, samplesheet, abundance ]
contrasts_for_diff:
Expand Down Expand Up @@ -71,13 +71,13 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {
// LIMMA_NORM directly. It internally runs normalization + DE analysis.

LIMMA_NORM(
norm_inputs.contrasts_for_norm.filter{it[0].method == 'limma'},
norm_inputs.samples_and_matrix.filter{it[0].method == 'limma'}
norm_inputs.contrasts_for_norm.filter{it[0].method_differential == 'limma'},
norm_inputs.samples_and_matrix.filter{it[0].method_differential == 'limma'}
)

LIMMA_DIFFERENTIAL(
inputs.contrasts_for_diff.filter{ it[0].method == 'limma' },
inputs.samples_and_matrix.filter{ it[0].method == 'limma' }
inputs.contrasts_for_diff.filter{ it[0].method_differential == 'limma' },
inputs.samples_and_matrix.filter{ it[0].method_differential == 'limma' }
)

// ----------------------------------------------------
Expand All @@ -92,15 +92,15 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {
// DESEQ2_NORM directly. It internally runs normalization + DE analysis.

DESEQ2_NORM(
norm_inputs.contrasts_for_norm.filter{it[0].method == 'deseq2'},
norm_inputs.samples_and_matrix.filter{it[0].method == 'deseq2'},
norm_inputs.contrasts_for_norm.filter{it[0].method_differential == 'deseq2'},
norm_inputs.samples_and_matrix.filter{it[0].method_differential == 'deseq2'},
ch_control_features.first(),
ch_transcript_lengths.first()
)

DESEQ2_DIFFERENTIAL(
inputs.contrasts_for_diff.filter{it[0].method == 'deseq2'},
inputs.samples_and_matrix.filter{it[0].method == 'deseq2'},
inputs.contrasts_for_diff.filter{it[0].method_differential == 'deseq2'},
inputs.samples_and_matrix.filter{it[0].method_differential == 'deseq2'},
ch_control_features.first(),
ch_transcript_lengths.first()
)
Expand All @@ -113,8 +113,8 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {
// not produce a normalized matrix.

PROPR_PROPD(
inputs.contrasts_for_diff.filter{it[0].method == 'propd'},
inputs.samples_and_matrix.filter { it[0].method == 'propd' }
inputs.contrasts_for_diff.filter{it[0].method_differential == 'propd'},
inputs.samples_and_matrix.filter { it[0].method_differential == 'propd' }
)

// ----------------------------------------------------
Expand All @@ -131,6 +131,11 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {
ch_model = DESEQ2_DIFFERENTIAL.out.model
.mix(LIMMA_DIFFERENTIAL.out.model)

ch_variance_stabilised_matrix = DESEQ2_NORM.out.rlog_counts.ifEmpty([[],[]])
.mix(DESEQ2_NORM.out.vst_counts.ifEmpty([[],[]]))
.groupTuple()
.filter{ meta, files -> meta != [] }

ch_versions = DESEQ2_DIFFERENTIAL.out.versions
.mix(LIMMA_DIFFERENTIAL.out.versions)
.mix(PROPR_PROPD.out.versions)
Expand Down Expand Up @@ -158,14 +163,14 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {
]
filter_input: [meta + filter_meta, results]
fc_input: [
method_params[meta.method].fc_column,
method_params[meta.method_differential].fc_column,
filter_meta.fc_threshold,
method_params[meta.method].fc_cardinality
method_params[meta.method_differential].fc_cardinality
]
stat_input: [
method_params[meta.method].stat_column,
method_params[meta.method_differential].stat_column,
filter_meta.stat_threshold,
method_params[meta.method].stat_cardinality
method_params[meta.method_differential].stat_cardinality
]
}

Expand All @@ -186,7 +191,7 @@ workflow ABUNDANCE_DIFFERENTIAL_FILTER {

// other
normalised_matrix = ch_normalised_matrix
variance_stabilised_matrix = DESEQ2_NORM.out.rlog_counts.mix(DESEQ2_NORM.out.vst_counts)
variance_stabilised_matrix = ch_variance_stabilised_matrix
model = ch_model
versions = ch_versions
}
7 changes: 4 additions & 3 deletions subworkflows/nf-core/abundance_differential_filter/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ output:
- meta:
type: map
description: Metadata map
- matrix:
type: file
description: Variance stabilised count matrix file
- matrices:
type: list
description: A list of variance stabilised count matrix files
pattern: "*.{csv,tsv}"

- model:
description: Channel containing statistical model object from differential analysis
structure:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ process {
"--vs_method rlog",
(meta.blocking == null) ? "" : "--blocking_variables $meta.blocking"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}" }
ext.prefix = { "${meta.id}_${meta.method_differential}" }
}

withName: 'DESEQ2_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_norm" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ process {
"--vs_method rlog",
(meta.blocking == null) ? "" : "--blocking_variables $meta.blocking"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}" }
ext.prefix = { "${meta.id}_${meta.method_differential}" }
}

withName: 'DESEQ2_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_norm" }
}

withName: 'LIMMA_DIFFERENTIAL' {
Expand All @@ -19,10 +19,10 @@ process {
"--probe_id_col gene_id",
"--use_voom TRUE"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}_voom" }
ext.prefix = { "${meta.id}_${meta.method_differential}_voom" }
}

withName: 'LIMMA_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_voom_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_voom_norm" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ process {
"--vs_method rlog",
(meta.blocking == null) ? "" : "--blocking_variables $meta.blocking"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}" }
ext.prefix = { "${meta.id}_${meta.method_differential}" }
}

withName: 'DESEQ2_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_norm" }
}

withName: 'LIMMA_DIFFERENTIAL' {
Expand All @@ -19,15 +19,15 @@ process {
"--probe_id_col gene_id",
"--use_voom TRUE"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}_voom" }
ext.prefix = { "${meta.id}_${meta.method_differential}_voom" }
}

withName: 'LIMMA_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_voom_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_voom_norm" }
}

withName: 'PROPR_PROPD' {
ext.args = {"--round_digits 5 --save_adjacency true"}
ext.prefix = { "${meta.id}_${meta.method}" }
ext.prefix = { "${meta.id}_${meta.method_differential}" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ process {
"--sample_id_col name",
"--blocking_variables $meta.blocking"
].join(' ').trim() }
ext.prefix = { "${meta.id}_${meta.method}" }
ext.prefix = { "${meta.id}_${meta.method_differential}" }
}

withName: 'LIMMA_NORM' {
ext.prefix = { "${meta.id}_${meta.method}_norm" }
ext.prefix = { "${meta.id}_${meta.method_differential}_norm" }
}

withName: 'AFFY_JUSTRMA' {
Expand Down
Loading

0 comments on commit 785efc6

Please sign in to comment.