data(iris)
cor.cut(iris[,1:4],cutoff=0.8, use="pairwise.complete.obs")
cor.hcl(iris[,1:4],cutoff=0.75,fig.f = TRUE)
ph <- cor.heat(iris[,1:4], dend="top")
ph
update(ph, scales = list(x = list(rot = 45)))
## change heatmap color scheme
cor.heat(iris[,1:4], dend="right", xlab="", ylab="",
col.regions = colorRampPalette(c("green", "black", "red")))
## or use hm.cols
cor.heat(iris[,1:4], dend="right", xlab="", ylab="", col.regions = hm.cols())
## prepare data set
data(abr1)
cls <- factor(abr1$fact$class)
dat <- preproc(abr1$pos[,110:1930], method="log10")
## feature selection
res <- fs.rf(dat,cls)
## take top 20 features
fs <- res$fs.order[1:20]
## construct the data set for correlation analysis
mat <- dat[,fs]
cor.cut(mat,cutoff=0.9)
ch <- cor.hcl(mat,cutoff=0.75,fig.f = TRUE, xlab="Peaks")
## plot dendrogram horizontally with coloured labels.
ch <- cor.hcl(mat,cutoff=0.75,fig.f = TRUE, horiz=TRUE,center=TRUE,
nodePar = list(lab.cex = 0.6, lab.col = "forest green", pch = NA),
xlim=c(2,0))
names(ch)
cor.heat(mat,dend="right")
cor.heat(mat,dend="right",col.regions = colorRampPalette(c("yellow", "red")))
## use corrgram with order by the hierarchical clustering
co <- cor(mat, use="pairwise.complete.obs")
ord <- order.dendrogram(as.dendrogram(hclust(as.dist(1-co))))
corrgram.circle(co[ord,ord], main="Corrgrams with circle")
corrgram.ellipse(co[ord,ord], label = TRUE, main = "Corrgrams with circle",
col.regions = hm.cols())
## if without ordering
corrgram.circle(co, main="Corrgrams with circle")
## example of cor.heat.gram
fs.1 <- res$fs.order[21:50]
mat.1 <- dat[,fs.1]
res.cor <-
cor.heat.gram(mat, mat.1, main="Heatmap of correlation between mat.1 and mat.2")
names(res.cor)
res.cor$cor.heat
res.cor$cor.gram
Run the code above in your browser using DataLab