songw01 / MEGENA

Multiscale embedded gene co-expression network analysis
GNU General Public License v3.0
48 stars 16 forks source link

Error performing calculate.correlation on Seurat object #17

Open scas224 opened 2 years ago

scas224 commented 2 years ago

Hi, I am trying to use MEGENA to perform a gene network analysis on a Seurat Object with normalized and scaled data, but the calculate.correlation function returns an empty object. I am using the scale.data slot: datExpr<-TBIxAging_pbmc@assays$SCT@scale.data

And then I am taking a random sample to check that it runs on a smaller set of my data (before taking the many hours to run it on the entire object): datExpr<-datExpr[ , sample(colnames(datExpr), 100)]

But when I run calculate.correlation: ijw <- calculate.correlation(datExpr,doPerm = 10, output.corTable = FALSE, output.permFDR = FALSE)

It returns an empty object:

ijw [1] row col rho

<0 rows> (or 0-length row.names)

And gives these warnings: Warning messages: 1: In cor(datExpr, method = estimator) : the standard deviation is zero 2: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 3: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 4: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 5: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 6: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 7: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 8: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 9: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 10: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 11: In cor(datExpr, datExpr[perm.ind[[i]], ], method = estimator) : the standard deviation is zero 12: In min(FDR.table$cut.off[FDR.table$FDR < FDR.cutoff]) : no non-missing arguments to min; returning Inf

I checked the input, and it appears to be a gene expression matrix in the same format as the data in the demo pipeline, so I am not sure why this is happening. I saw another user mention this issue a few years ago, but they were told it was because they had genes with empty values, but because I am using the scale.data slot, I don't think that is the issue here. Any thoughts?

scas224 commented 2 years ago

I thought that I figured out the issue- the package was not installed correctly, but I went back to follow the vignette to see if it fixed the problem, and the calculate.correlation function seems to no longer exist?

Error in calculate.correlation(datExpr, doPerm = cor.perm, output.corTable = FALSE, : could not find function "calculate.correlation"

I found the vignette again on GitHub, and it appears that this function has been replaced with calculate.rho.signed. Is this correct? When did this happen, and are there any significant differences between the functions? I tried to use this function with my data after correctly installing the package, but I still received the same warnings, although it did return a different output- a list of 2, but the first component of the list is still empty:

ijw $signif.ijw [1] row col rho

<0 rows> (or 0-length row.names)

$FDR cut.off FPR PR FDR 1 0.00 1.0000000 1.0000000 1.0000000 2 0.01 0.9803195 0.9845002 0.9957535 3 0.02 0.9020231 0.9128183 0.9881737 4 0.03 0.8254073 0.8451662 0.9766213 5 0.04 0.7619072 0.7905842 0.9637269 6 0.05 0.7100682 0.7467889 0.9508284 7 0.06 0.6666058 0.7100171 0.9388588 8 0.07 0.6330479 0.6812271 0.9292760 9 0.08 0.6052242 0.6568345 0.9214257 10 0.09 0.5822420 0.6362988 0.9150450 11 0.10 0.5634972 0.6187836 0.9106531 12 0.11 0.5474074 0.6032000 0.9075057 13 0.12 0.5340567 0.5895656 0.9058477 14 0.13 0.5227926 0.5776401 0.9050491 15 0.14 0.5133306 0.5670799 0.9050491 16 0.15 0.5052723 0.5574712 0.9050491 17 0.16 0.4983106 0.5486169 0.9050491 18 0.17 0.4924287 0.5408730 0.9050491 19 0.18 0.4874234 0.5338784 0.9050491 20 0.19 0.4829561 0.5272189 0.9050491 21 0.20 0.4792309 0.5211739 0.9050491 22 0.21 0.4760974 0.5159026 0.9050491 23 0.22 0.4732236 0.5108981 0.9050491 24 0.23 0.4709063 0.5066115 0.9050491 25 0.24 0.4688898 0.5026902 0.9050491

CYYCNSL commented 1 year ago

I also encountered the same problem in the function calculate.correlation(), did teacher solve it? my question is: Error in calculate.correlation(dataExpr, doPerm = cor.perm, output.corTable = FALSE, : could not find function "calculate.correlation"