阅读背景:

如何在heatmap.2()中缩短ColSideColors的高度

来源:互联网 

My following code:

我的以下代码:

library(gplots);
library(RColorBrewer);

dat <- read.table("https://pastebin.com/raw.php?i=wM7WxEvY",sep="\t",na.strings="NA",header=TRUE)
dat <- dat[complete.cases(dat),]
dat.log <- log2(dat);

# Clustering and distance function
hclustfunc <- function(x) hclust(x, method="ward")
distfunc <- function(x) dist(x,method="maximum")

# Here we cluster based on the Celltype (Column)
d <- distfunc(t(dat.log))
fit <- hclustfunc(d)
clusters <- cutree(fit, h=20)
nofclust.height <-  length(unique(as.vector(clusters)));


# Colors setting 
hmcols <- rev(redblue(256));
selcol <- colorRampPalette(brewer.pal(9,"Set1"))
clustcol.height = selcol(nofclust.height);


pdf(file="temp.pdf",width=30,height=40);
heatmap.2(as.matrix(dat.log),Colv=FALSE,lhei = c(0.25,4),ColSideColors=clustcol.height[clusters],density.info="none",scale="none",margin=c(10,10),col=hmcols,symkey=F,trace="none",dendrogram="none",keysize=1,hclust=hclustfunc,distfun=distfunc);
dev.off();
library(gplots);



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: