###########2022.03.18########
######QDD相关性分析热图######
install.packages("corrplot")
library(corrplot)
qiaodancorr = read.table("E:/Desktop/qiaodan.txt",header = T,sep = "\t",row.names = 1)
corr <- round(cor(qiaodancorr), 1)
#构建cor.mtest函数
cor.mtest <- function(mat, ...) {
mat <- as.matrix(mat)
n <- ncol(mat)
p.mat<- matrix(NA, n, n)
diag(p.mat) <- 0
for (i in 1:(n - 1)) {
for (j in (i + 1):n) {
tmp <- cor.test(mat[, i], mat[, j], ...)
p.mat[i, j] <- p.mat[j, i] <- tmp$p.value
}
}
colnames(p.mat) <- rownames(p.mat) <- colnames(mat)
p.mat
}
mydatap<- cor.mtest(qiaodancorr) #计算原始数据的p.mat并定义此数据集合
pch = 4, pch.col = "black", pch.cex = 3,
plotCI = c("n","square", "circle", "rect"), lowCI.mat = NULL, uppCI.mat = NULL, ...)
corrplot.mixed(corr = corr,lower = "number", upper = "circle",p.mat = mydatap,
insig = "label_sig",
sig.level = c(0.001,0.01,0.05),
pch.cex = 1,
plotCI = c("n","square", "circle", "rect"),
lowCI.mat = NULL,
uppCI.mat = NULL)
网友评论