WGCNA | pickSoftThreshold.fromSimilarity not working for input similarity matrix
3
1
Entering edit mode
jol.espinoz ▴ 40
@jolespinoz-11290
Last seen 6 months ago

I'm trying to use a similarity matrix from [SparCC](http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1002687) but I need to figure out which softthreshold to pick using `pickSoftThreshold.fromSimilarity`

 

I'm getting the following error: 

> pickSoftThreshold.fromSimilarity(DF_sim)
Error in checkAdjMat(similarity, min, max) : adjacency is not numeric

 

I'm loading in my similarity measure as:

```

DF_sim = read.table("./Analysis/sparcc_corr/euphotic.sparcc.tsv", sep="\t", row.names=1, header = TRUE, check.names=FALSE,  stringsAsFactors = FALSE)

> class(DF_sim)
[1] "data.frame"
> dim(DF_sim)
[1] 2053 2053

```

My data is symmetric and between -1 and 1.  I tried doing `as.numeric(DF_sim)` as input along with `abs(DF_sim)` in case it needed + numbers.  

 

How can I get my SparCC correlation matrix to work with `pickSoftThreshold.fromSimilarity`? 

> packageVersion("WGCNA")
[1] ‘1.51’

 

WGCNA similarity correlation bioconductor rnaseq • 1.7k views
ADD COMMENT
0
Entering edit mode

How do you loaded DF_sim to R? Have you checked if isSymmetric(DF_sim) returns the same error? Could you provide the traceback of the error?

It could be that the error tolerance is lower than the difference in the matrix, you could then change the error tolerance or make it symmetric as Peter A: WGCNA | pickSoftThreshold.fromSimilarity not working for input similarity matrix.

ADD REPLY
3
Entering edit mode
@peter-langfelder-4469
Last seen 13 months ago
United States

It means your matrix is not exactly symmetric. Symmetrize it using

(DF_mat + t(DF_mat))/2

then try again.

ADD COMMENT
0
Entering edit mode

That was it. Thanks a lot Peter!  

ADD REPLY
0
Entering edit mode
@peter-langfelder-4469
Last seen 13 months ago
United States

Try DF_mat = as.matrix(DF_sim), then run the function again on DF_mat.

HTH, Peter

ADD COMMENT
0
Entering edit mode
> DF_mat = as.matrix(DF_sim)
> class(DF_mat)
[1] "matrix"
> checkSimilarity(DF_mat)
Error in checkAdjMat(similarity, min, max) : adjacency is not symmetric
> pickSoftThreshold.fromSimilarity(DF_mat)
Error in checkAdjMat(similarity, min, max) : adjacency is not symmetric
ADD REPLY
0
Entering edit mode

I wonder if it's b/c it's calling `checkAdjMat` instead of `checkSimilarity`? 

ADD REPLY
0
Entering edit mode
@peter-langfelder-4469
Last seen 13 months ago
United States

Please run

max(abs(DF_mat - t(DF_mat)), na.rm = TRUE)

Check the result; the code throws the error because this number is greater than 1e-12.

ADD COMMENT
0
Entering edit mode
> max(abs(DF_mat - t(DF_mat)), na.rm = TRUE)
[1] 1.000089e-12
ADD REPLY
0
Entering edit mode

Yup, I think that was it.  So my SparCC correlation matrix has values out of range? 

ADD REPLY

Login before adding your answer.

Traffic: 432 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