我正在尝试按照PDF中的说明构建一个共表达网络。第一步是构建树状图。这是代码。
指向LiverFemale3600.csv的链接位于压缩文件中。
# Load the WGCNA package
library(WGCNA);
options(stringsAsFactors = FALSE);
#Read in the female liver data set
femData = read.csv("LiverFemale3600.csv");
datExpr0 = as.data.frame(t(femData[, -c(1:8)]));
names(datExpr0) = femData$substanceBXH;
rownames(datExpr0) = names(femData)[-c(1:8)];
sampleTree = hclust(dist(datExpr0), method = "average");
par(cex = 0.6);
par(mar = c(0,4,2,0))
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="", cex.lab = 1.5, cex.axis = 1.5, cex.main = 2)
在这里,plot(( 不会在 RStudio 中返回任何内容。打印窗口为空,但也不会返回任何错误。
当 show(sampleTree( 运行时,我得到了以下内容。
> show(sampleTree)
Call:
hclust(d = dist(datExpr0), method = "average")
Cluster method : average
Distance : euclidean
Number of objects: 135
如果您希望绘图出现在 RStudio 的绘图帧中,只需运行plot
行。否则,运行par
线将打开一个单独的绘图窗口,并且图形将不会显示在 RStudio 中的正常绘图框中。