This is a test version of Biostars. For the public version, visit https://www.biostars.org.
WGCNA how to pick the soft threshold with R

When following the WGCNA manual, I input the data in a data frame, and determine the soft threshold power. I get an error message when determining the soft threshold power .. which really prevents me from using WGCNA. the original matrix has 20,000 rows (genes) and 20 columns (samples).

library(WGCNA)
options(stringsAsFactors = FALSE);
enableWGCNAThreads()

myData = read.csv("my_matrix.csv");
dataExpr0 = as.data.frame(t(myData))

powers = c(c(1:10), seq(from = 12, to=20, by=2))
sft = pickSoftThreshold(dataExpr0, powerVector = powers, verbose = 5)
pickSoftThreshold: will use block size 29382.
 pickSoftThreshold: calculating connectivity for given powers...
   ..working on genes 1 through 29382 of 34688
Error in { : task 2 failed - "cannot allocate vector of size 1.9 Gb"
In addition: There were 20 warnings (use warnings() to see them)
wgcna r

WGCNA is a hog when it comes to memory. I recall that there are some places where you can process things in blocks, you might see if you can do so at this stage. As is, the error is due to lack of memory.

Actually I decreased the dataset to half of the size, and was able to process it. Will close this post. Thanks~!

What kind of filters you applied to decrease the dataset ?

0 answers

No answers yet.

Log in to answer this question.