Why are these two clustering patterns different?
2
0
Entering edit mode
chris86 ▴ 420
@chris86-8408
Last seen 5.0 years ago
UCL, United Kingdom

Hi

I have clustered my normalised gene expression data using two methods. 1. NMF aheatmap 2. Using R's hclust function. I am trying to work out why these two methods give different clustering patterns despite me specifying the aheatmap function to use the same methods as the default R's function. Observe.

 

tdata <- t(data)
Raw2 <- tdata
dissimilarity <- 1 - cor(Raw2, method = 'pearson') # abs has been removed
distance <- as.dist(dissimilarity)
hc <- hclust(distance, method = 'complete')
plot(hc, main="Dissimilarity = 1 - (Correlation)", xlab="")

 

aheatmap(data, distfun = 'pearson', hclustfun = 'complete', scale = 'row')

 

This has been annoying me all morning, I have checked the aheatmap source code and it seems to use as.dist and hclust just as I am doing here, but the order of genes/probes is different - hence the clustering pattern is different.

 

Best,


Chris

bioconductor • 1.2k views
ADD COMMENT
0
Entering edit mode
@wolfgang-huber-3550
Last seen 3 months ago
EMBL European Molecular Biology Laborat…

Chris,

changes of a reply should increase with a reproducible code example (minimal, and incl. small dataset) and the plots you are seeing.

Best wishes

Wolfgang

ADD COMMENT
0
Entering edit mode
Aedin Culhane ▴ 510
@aedin-culhane-1526
Last seen 5.3 years ago
United States

Hi

It could be because aheatmap includes a scale or re-order function.  However looks 

 

 plot(hclust(dist(t(USArrests), method="euclidean"), "complete"), hang=-1)

aheatmap(USArrests, distfun = "euclidean", hclustfun = "complete") 

 

However when you have more than about 10 columns, aheatmap doesn't size the dendrogram and heatmap consistently.  Try  aheatmap(t(USArrests), distfun = "euclidean", hclustfun = "complete") 

 

I would recommend using ComplexHeatmap instead.  It has a lot of very nice features and works well.

Good Luck

Aedin

 

ADD COMMENT

Login before adding your answer.

Traffic: 544 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6