Skip to content

Commit

Permalink
Correcting monothread
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumquatum committed Apr 22, 2020
1 parent edc5caa commit b894ce1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/net_and_modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,13 @@ build_net <- function(data_expr, fit_cut_off = 0.90, cor_func = c("pearson", "sp
network_type <- match.arg(network_type)
tom_type <- match.arg(tom_type)
if (!is.null(n_threads)) {
if (!is.numeric(n_threads) | n_threads < 2 | n_threads %% 1 != 0) stop("n_threads must be a whole number > 2")}
if (!is.numeric(n_threads) | n_threads < 1 | n_threads %% 1 != 0) stop("n_threads must be a whole number >= 1")}

# WGCNA's multi-threading
quiet(WGCNA::enableWGCNAThreads(n_threads))
if (n_threads == 1) {
quiet(WGCNA::disableWGCNAThreads())
} else quiet(WGCNA::enableWGCNAThreads(n_threads))

# TODO : change this function for an internal one because WGCNA's function isn't prefixed, causing warnings

# Correlation selection and correlation matrix computation
Expand Down

0 comments on commit b894ce1

Please sign in to comment.