Entering edit mode

10.3 years ago

k.nirmalraman
★
1.1k

I have expression data, filtered based on DE analysis.

I would like to do hierachical clustering.

```
y<-ExpressionMatrix_filtered # n*4 matrix with rownames=genenames
hr <- hclust(as.dist(1-cor(t(y), method="pearson")), method="centroid");
hc <- hclust(as.dist(1-cor(y, method="spearman")), method="centroid")
# Cuts the tree and creates color vector for clusters.
mycl <- cutree(hr,k=4, h=max(hr$height)/1.5);
mycolhc <- rainbow(length(unique(mycl)), start=0.1, end=0.9); mycolhc <- mycolhc[as.vector(mycl)] ; myheatcol <- bluered(75)
```

One can ofcourse plot the clusters as follows,

```
`heatmap.2(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), col=myheatcol, scale="row", density.info="none", trace="none", RowSideColors=mycolhc,margins=c(10,10))'
```

however, I'd like `ggplot`

package `geom_tile`

type of visualization. I have two questions in this regard.

- How can I plot the clusters? I know the order of the genes are in
`hr$order`

. How can I get this to the same order for ggplot? - Is it also possible to get the dendogram for rowV and colV

Any help would be really great. Thanks!