R software error
1
2
Entering edit mode
8.7 years ago
saj98 ▴ 140

Hello everyone

I am doing network analyses by using WGCNA, I got error message when I am setting the soft threshold. Here is what I got.

I am following these commands:

> library(WGCNA)

disableWGCNAThreads()
> library(cluster)
> options(stringsAsFactors = FALSE)
> femData = read.csv("gene.csv")
> names(femData)
 [1] "gene_id"           "gene"              "locus"             "log2.fold_change."
 [5] "test_stat"         "p_value"           "q_value"           "AF"               
 [9] "AF.1"              "AF.2"              "AD"                "AD.1"             
[13] "AD.2"             
> dim(femData)
[1] 6765   13
> datExprFemale=as.data.frame(t(femData[, -c(1:7)]))
> names(datExprFemale)=femData$gene
> rownames(datExprFemale)=names(femData)[-c(1:7)]
> powers=c(1:10)
> sft=pickSoftThreshold(datExprFemale,powerVector=powers)
Error in summary(lm1)$coefficients[2, 1] : subscript out of bounds

In addition: Warning message:

executing %dopar% sequentially: no parallel backend registered

I tried to find similar questions in archive, but I could not.

Please I need help with this issue if anyone able to help.

Best

Shaima

R • 4.4k views
ADD COMMENT
0
Entering edit mode

@saj98 Can you please give an example of your data so we can reproduce your problem and try to solve it?

ADD REPLY
0
Entering edit mode

I am following these commands:

> library(WGCNA)

disableWGCNAThreads()
> library(cluster)
> options(stringsAsFactors = FALSE)
> femData = read.csv("gene.csv")
> names(femData)
 [1] "gene_id"           "gene"              "locus"             "log2.fold_change."
 [5] "test_stat"         "p_value"           "q_value"           "AF"               
 [9] "AF.1"              "AF.2"              "AD"                "AD.1"             
[13] "AD.2"             
> dim(femData)
[1] 6765   13
> datExprFemale=as.data.frame(t(femData[, -c(1:7)]))
> names(datExprFemale)=femData$gene
> rownames(datExprFemale)=names(femData)[-c(1:7)]
> powers=c(1:10)
> sft=pickSoftThreshold(datExprFemale,powerVector=powers)
Error in summary(lm1)$coefficients[2, 1] : subscript out of bounds
ADD REPLY
0
Entering edit mode

For the warning message:

Have you tried the allowWGCNAThreads() function?

ADD REPLY
0
Entering edit mode

Yes I did, but I got the same error.

ADD REPLY
0
Entering edit mode

Are you trying to perform WGCNA analysis with 6 samples?

ADD REPLY
0
Entering edit mode

Yes I am doing six samples.

ADD REPLY
1
Entering edit mode
8.7 years ago

The error means you're trying to access an element outside the array; this usually means one your indices is greater than the last available index of the array.

As for the warning, check the doParallel docs: "Remember: unless registerDoMC is called, foreach will not run in parallel. Simply loading the doParallel package is not enough."

ADD COMMENT
0
Entering edit mode

Hello Jean Thanks for answering me, I appreciate your time. Can you give me more details about Do parallel, I tried to use but I had same issue. Best

ADD REPLY
0
Entering edit mode

It's all in the docs I linked to above. Basically, all you need is

library(doParallel);
registerDoParallel(cores= x);

where x is the number of cores/workers you want to use. Note that this is only worthwhile for relatively lengthy computations as creating parallel workers is expensive and can take longer than running a fast bit of code.

ADD REPLY

Login before adding your answer.

Traffic: 2567 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6