Created
May 27, 2016 00:51
-
-
Save mbk0asis/d196bc389d0ab7f089c55e02fdbd0899 to your computer and use it in GitHub Desktop.
identifying members of clusters in heatmap.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gplots) | |
dta<-mouse_epi_HTT | |
breaks=c(seq(-2,-0.5,length=100),seq(-0.5,0.5,length=100),seq(0.5,2,length=100)) # manual range setting | |
my_color <- colorRampPalette(c("blue","white","red"))(n = 299) | |
#rc <- rainbow(nrow(dta), start=0, end=.3) | |
#cc <- rainbow(ncol(dta), start=0, end=.1) | |
# to draw a heatmap for % methylation | |
hm<-heatmap.2(as.matrix(dta),col=my_color, breaks=breaks, #symm=F,symkey=F, | |
cexRow=0.5,cexCol=1,margins=c(8,8),dendrogram=c("both"),trace="none",density.info="density", | |
Rowv = T, Colv = T) # Rowv,Colv : if True row or col values are clustered | |
# ,RowSideColors=rc, ColSideColors=cc) | |
hm | |
hc <- as.hclust(hm$rowDendrogram) | |
hc | |
plot(hc,cex=1,hang=-1) | |
ct<-rev(cutree(hc, h=8)[hc$order]) | |
ct | |
plot(ct) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment