I'm applying WGCNA to RNASeq data following this tutorial. For several functions it give me an error that the package functions are not found.
> sft <- pickSoftThreshold(normalized_counts,
+ dataIsExpr = TRUE,
+ corFnc = cor,
+ networkType = "signed"
+ )
Error in pickSoftThreshold(normalized_counts, dataIsExpr = TRUE, corFnc = cor, :
could not find function "pickSoftThreshold"
I tried to make sure that the package was called correctly, but when I called it the following error emerged:
> library(WGCNA)
Error: package or namespace load failed for ‘WGCNA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘xfun’
In addition: Warning message:
package ‘WGCNA’ was built under R version 4.1.3
So I tried installing the package "xfun":
> install.packages("xfun")
Installing package into ‘C:/Users/me/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/xfun_0.31.zip'
Content type 'application/zip' length 401092 bytes (391 KB)
downloaded 391 KB
package ‘xfun’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\me\Documents\R\win-library\4.1’ for modifying
Try removing ‘C:\Users\me\Documents\R\win-library\4.1/00LOCK’
I followed some threads that suggested trying the following code for the error:
> install.packages("xfun", dependencies = TRUE, INSTALL_opts = '--no-lock')
package ‘pkgbuild’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\parnian\Documents\R\win-library\4.1’ for modifying
Try removing ‘C:\Users\me\Documents\R\win-library\4.1/00LOCK’
I don't know how to overcome these errors to be able to use WGCNA functions such as pickSoftThreshold() or cutreeStatistic(). I tried deleting 00LOCK, restarting the session and reinstalling the WGCNA and xfun packages on Windows. I even tried using the package on Linux but didn't work. Any idea how I can use the package properly? Thanks
Did you follow the other suggestions here ? It depends on previously aborted installation of some package.