WGCNA基因表达矩阵离群值去除
2021-05-20 本文已影响0人
M78_a
datExpr为基因表达矩阵的转置矩阵:行是样本名字,列是基因名
查看是否有离群样品
sampleTree = hclust(dist(datExpr), method = "average")
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="")
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="", cex.lab = 1.5,
cex.axis = 1.5, cex.main = 2,cex = 0.8)
Plot a line to show the cut
abline(h = 80, col = "red");
Determine cluster under the line
clust = cutreeStatic(sampleTree, cutHeight = 80, minSize = 10)
table(clust)#会看到利群的样本和非利群的样本分布在0和1分支
clust 1 contains the samples we want to keep.
keepSamples = (clust==1)
datExpr = datExpr[keepSamples, ]
nGenes = ncol(datExpr)
nSamples = nrow(datExpr)