cmap / morpheus.R

R interface to morpheus.js heatmap widget
https://software.broadinstitute.org/morpheus/
BSD 3-Clause "New" or "Revised" License
37 stars 14 forks source link

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

Open yubau1112 opened 2 years ago

yubau1112 commented 2 years ago

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

joshua-gould commented 2 years ago

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