Error in running WGCNA

net = blockwiseModules(datExpr, power = softPower,
TOMType = "unsigned", minModuleSize = 30,
reassignThreshold = 0, mergeCutHeight = 0.25,
numericLabels = TRUE, pamRespectsDendro = FALSE,
saveTOMs = TRUE,
saveTOMFileBase = "BCell_TOM",
verbose = 3)

Calculating module eigengenes block-wise from all genes
Flagging genes and samples with too many missing values...
..step 1
....pre-clustering genes to determine blocks..
Projective K-means:
..k-means clustering..
..merging smaller clusters...
Block sizes:
gBlocks
1 2 3
4947 3284 3053
..Working on block 1 .
TOM calculation: adjacency..
..will use 11 parallel threads.
Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
..saving TOM for block 1 into file BCell_TOM-block.1.RData
....clustering..
....detecting modules..
....calculating module eigengenes..
....checking kME in modules..
..removing 326 genes from module 1 because their KME is too low.
..removing 226 genes from module 2 because their KME is too low.
..removing 3 genes from module 4 because their KME is too low.
..removing 4 genes from module 5 because their KME is too low.
..Working on block 2 .
TOM calculation: adjacency..
..will use 11 parallel threads.
Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
..saving TOM for block 2 into file BCell_TOM-block.2.RData
....clustering..
....detecting modules..
....calculating module eigengenes..
....checking kME in modules..
..removing 198 genes from module 1 because their KME is too low.
..removing 25 genes from module 2 because their KME is too low.
..removing 32 genes from module 3 because their KME is too low.
..removing 7 genes from module 4 because their KME is too low.
..removing 1 genes from module 5 because their KME is too low.
..removing 6 genes from module 6 because their KME is too low.
..removing 6 genes from module 7 because their KME is too low.
..removing 11 genes from module 9 because their KME is too low.
..removing 6 genes from module 10 because their KME is too low.
..removing 1 genes from module 17 because their KME is too low.
..Working on block 3 .
TOM calculation: adjacency..
..will use 11 parallel threads.
Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
..saving TOM for block 3 into file BCell_TOM-block.3.RData
....clustering..
....detecting modules..
....calculating module eigengenes..
....checking kME in modules..
..removing 143 genes from module 1 because their KME is too low.
..removing 33 genes from module 2 because their KME is too low.
..removing 48 genes from module 3 because their KME is too low.
..removing 44 genes from module 4 because their KME is too low.
..removing 22 genes from module 5 because their KME is too low.
..removing 18 genes from module 6 because their KME is too low.
..removing 2 genes from module 7 because their KME is too low.
..removing 2 genes from module 9 because their KME is too low.

Error in (new("standardGeneric", .Data = function (x, y = NULL, use = "everything", : unused arguments (weights.x = NULL, weights.y = NULL, cosine = FALSE)
Traceback:

  1. blockwiseModules(datExpr, power = softPower, TOMType = "unsigned",
    . minModuleSize = 30, reassignThreshold = 0, mergeCutHeight = 0.25,
    . numericLabels = TRUE, pamRespectsDendro = FALSE, saveTOMs = TRUE,
    . saveTOMFileBase = "SLE_BCell_TOM", verbose = 3)
  2. do.call(match.fun(corFnc), c(list(datExpr[, goodLabels != 0],
    . AllMEs), if (corFncAcceptsWeights) list(weights.x = if (haveWeights) weights[,
    . goodLabels != 0] else NULL, weights.y = NULL) else NULL,
    . corOptions))

#############################################
在biostas问答版的帖子中就有高手做出了解答:## Error in (function...) thrown by WGCNA tutorial (R)

原因为:WGCNA与其他软件包之间存在冲突。WGCNA中的cor函数与R中自带的cor在命名空间上有冲突。
解决方法为:在使用该函数之前暂时重新分配功能,见下方正确用法
cor <- WGCNA::cor
net = blockwiseModules(datExpr, power = 6,
TOMType = "unsigned", minModuleSize = 30,
reassignThreshold = 0, mergeCutHeight = 0.25,
numericLabels = TRUE, pamRespectsDendro = FALSE,
saveTOMs = TRUE,
saveTOMFileBase = "femaleMouseTOM",
verbose = 3)
cor<-stats::cor

As correctly answered by multiple people here, the problem is that WGCNA has its own function "cor" and this correlates in the namespace with "cor" from the package stats.

Rather than loading and unloading modules or restarting R one might as well temporarily re-assign the function:

你可能感兴趣的:(Error in running WGCNA)