diff --git a/modules/nf-core/variancepartition/dream/main.nf b/modules/nf-core/variancepartition/dream/main.nf index f04388625db2..456eab69e82f 100644 --- a/modules/nf-core/variancepartition/dream/main.nf +++ b/modules/nf-core/variancepartition/dream/main.nf @@ -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 diff --git a/modules/nf-core/variancepartition/dream/meta.yml b/modules/nf-core/variancepartition/dream/meta.yml index a98fe8fd98eb..87e3d30c5b6d 100644 --- a/modules/nf-core/variancepartition/dream/meta.yml +++ b/modules/nf-core/variancepartition/dream/meta.yml @@ -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" diff --git a/modules/nf-core/variancepartition/dream/templates/dream.R b/modules/nf-core/variancepartition/dream/templates/dream.R index d8dcb493922f..f110e3f23b50 100644 --- a/modules/nf-core/variancepartition/dream/templates/dream.R +++ b/modules/nf-core/variancepartition/dream/templates/dream.R @@ -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 @@ -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) @@ -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]] diff --git a/modules/nf-core/variancepartition/dream/tests/main.nf.test.snap b/modules/nf-core/variancepartition/dream/tests/main.nf.test.snap index 46afa72c1495..987192caba7c 100644 --- a/modules/nf-core/variancepartition/dream/tests/main.nf.test.snap +++ b/modules/nf-core/variancepartition/dream/tests/main.nf.test.snap @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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" } } \ No newline at end of file