morpheus.R icon indicating copy to clipboard operation
morpheus.R copied to clipboard

How to do Hierarchical Clustering in R like use web results?

Open yubau1112 opened this issue 3 years ago • 1 comments

Hi, I used

morpheus https://software.broadinstitute.org/morpheus/

It's a good tool to make heatmap!

but I need to automatically generate pictures.

So, I used

Morpheus.js-based heat map widget in R. https://github.com/cmap/morpheus.R

but how to do "Hierarchical Clustering" in R

I want to use Hierarchical Clustering

1. Metric One minus spearman rank correlation 
2. Linkage method Complete 
3. Cluster Columns and Rows

My command:

myfun <- function(x) hclust(as.dist(1-cor(t(as.matrix(x)),
                                          method = "spearman")), method = "complete")

morpheus(x, colorScheme=list(scalingMode="relative", colors=c('blue','White','red')),
         dendrogram = 'both',
         rowSize = 6,
         columnSize = 6,
         hclustfun = myfun),
         #tools=list(list(name='Hierarchical Clustering',
         #               params=list(group_rows_by=list('annotation2'), cluster='Rows and columns'))),
         columnAnnotations =columnAnnotations , overrideRowDefaults=FALSE,
         rows=list(list(field=list('annotation1'), highlightMatchingValues=FALSE, display=list('color'))))

But heatmap different with web results

how to do Hierarchical Clustering in R like use web model results?

thanks!

yubau

yubau1112 avatar Feb 22 '22 07:02 yubau1112

Morpheus.R uses R code to perform clustering so the results will differ from the website which uses JavaScript. If you want identical clustering results to the JavaScript implementation, please use https://github.com/cmap/morpheus-export

joshua-gould avatar Feb 22 '22 20:02 joshua-gould