Skip to content
Draft
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
2 changes: 1 addition & 1 deletion modules/nf-core/variancepartition/dream/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ process VARIANCEPARTITION_DREAM {
tuple val(meta), path("*.dream.results.tsv") , emit: results
tuple val(meta), path("*.dream.model.txt") , emit: model
tuple val(meta), path("*.normalised_counts.tsv") , emit: normalised_counts, optional: true
path "versions.yml" , emit: versions
path "versions.yml" , emit: versions, topic: versions

when:
task.ext.when == null || task.ext.when
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/variancepartition/dream/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ output:
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
topics:
versions:
- versions.yml:
type: string
description: The name of the process
authors:
- "@alanmmobbs03"
- "@nschcolnicov"
Expand Down
28 changes: 28 additions & 0 deletions modules/nf-core/variancepartition/dream/templates/dream.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ opt <- list(
contrast_string = "$comparison", # Full (complex) contrast expression comparison needed if using formula
sample_id_col = "sample", # Column name for sample IDs
threads = "$task.cpus", # Number of threads for multithreading
blas_threads = 1, # Number of threads for BLAS/OpenMP backends
subset_to_contrast_samples = FALSE, # Whether to subset to contrast samples
exclude_samples_col = NULL, # Column for excluding samples
exclude_samples_values = NULL, # Values for excluding samples
Expand Down Expand Up @@ -116,6 +117,7 @@ keys <- c("formula", "contrast_string", "contrast_target", "contrast_variable",
opt[keys] <- lapply(opt[keys], nullify)

opt\$threads <- as.numeric(opt\$threads)
opt\$blas_threads <- as.numeric(opt\$blas_threads)
opt\$apply_voom <- as.logical(opt\$apply_voom)
opt\$proportion <- as.numeric(opt\$proportion)
opt\$trend <- as.logical(opt\$trend)
Expand All @@ -135,6 +137,32 @@ if (!is.null(opt\$seed)) {
set.seed(opt\$seed)
}

if (is.na(opt\$blas_threads) || opt\$blas_threads < 1) {
stop("'blas_threads' must be a positive integer")
}
opt\$blas_threads <- as.integer(opt\$blas_threads)

configure_blas_threads <- function(threads) {
thread_env <- c(
OPENBLAS_NUM_THREADS = threads,
OMP_NUM_THREADS = threads,
MKL_NUM_THREADS = threads,
BLIS_NUM_THREADS = threads,
VECLIB_MAXIMUM_THREADS = threads,
NUMEXPR_NUM_THREADS = threads
)
do.call(Sys.setenv, as.list(thread_env))

if (requireNamespace("RhpcBLASctl", quietly = TRUE)) {
RhpcBLASctl::blas_set_num_threads(threads)
RhpcBLASctl::omp_set_num_threads(threads)
}

cat("Configured implicit BLAS/OpenMP threads to", threads, "\n")
}

configure_blas_threads(opt\$blas_threads)

# Load metadata
metadata <- read_delim_flexible(opt\$sample_file, header = TRUE, stringsAsFactors = TRUE)
rownames(metadata) <- metadata[[opt\$sample_id_col]]
Expand Down
44 changes: 22 additions & 22 deletions modules/nf-core/variancepartition/dream/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2025-12-23T18:57:51.598745459",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2025-12-23T18:57:51.598745459"
},
"RNAseq - Feature Counts - formula + comparison contrast string - interaction": {
"content": [
Expand All @@ -37,11 +37,11 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2025-12-26T15:10:51.980662299",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2025-12-26T15:10:51.980662299"
},
"Mus musculus - contrasts - matrix - no formula": {
"content": [
Expand All @@ -61,11 +61,11 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2025-12-16T15:52:08.047223666",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
}
},
"timestamp": "2025-12-16T15:52:08.047223666"
},
"Mus musculus - expression table - contrasts + blocking factors": {
"content": [
Expand Down Expand Up @@ -130,11 +130,11 @@
]
}
],
"timestamp": "2025-12-16T19:59:57.947286403",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
}
},
"timestamp": "2025-12-16T19:59:57.947286403"
},
"Mus musculus - expression table - contrasts + blocking factors stub": {
"content": [
Expand Down Expand Up @@ -199,11 +199,11 @@
]
}
],
"timestamp": "2025-11-10T16:18:37.294899756",
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
}
},
"timestamp": "2025-11-10T16:18:37.294899756"
},
"Mus musculus - expression table - contrasts + formula + weighted comparison contrast string": {
"content": [
Expand All @@ -221,11 +221,11 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2025-12-23T18:57:42.761838155",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2025-12-23T18:57:42.761838155"
},
"Mus musculus - expression table - contrasts + formula + comparison contrast string - no intercept stub": {
"content": [
Expand Down Expand Up @@ -284,11 +284,11 @@
]
}
],
"timestamp": "2026-01-13T15:35:07.121696674",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2026-01-13T15:35:07.121696674"
},
"RNAseq - Voom - Feature Counts - formula + comparison contrast string - interaction": {
"content": [
Expand Down Expand Up @@ -316,11 +316,11 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2026-01-13T15:53:31.743589111",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2026-01-13T15:53:31.743589111"
},
"RNAseq - Feature Counts - formula + comparison contrast string - interaction with seed": {
"content": [
Expand Down Expand Up @@ -379,11 +379,11 @@
]
}
],
"timestamp": "2026-03-25T21:03:52.327619963",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
"nf-test": "0.9.3",
"nextflow": "25.10.3"
},
"timestamp": "2026-05-07T19:32:24.587570625"
},
"Mus musculus - expression table - contrasts + formula + comparison contrast string": {
"content": [
Expand All @@ -401,10 +401,10 @@
"versions.yml:md5,fc1f26eb2194018e99fc2916332676b7"
]
],
"timestamp": "2025-12-26T15:11:01.472042429",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.2"
}
},
"timestamp": "2025-12-26T15:11:01.472042429"
}
}
Loading