Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate a part of the dendrogram #31

Closed
NicolasHipp opened this issue Apr 15, 2016 · 2 comments
Closed

Rotate a part of the dendrogram #31

NicolasHipp opened this issue Apr 15, 2016 · 2 comments

Comments

@NicolasHipp
Copy link

Hello,
I'm a newbie in R utilisation and I try to use ComplexHeatmap to visualize my data. I work on single cell qPCR analysis and i would like to rotate a part of the dendrogram.
I try to change the order with a vector in the "column_dend_reorder" command, but I don't understand how it works.

Does anybody performed this before?
Thks,
Nicolas :)
change order

@jokergoo
Copy link
Owner

Hi,

Maybe you can check the dendextend package:

https://cran.r-project.org/web/packages/dendextend/vignettes/introduction.html#changing-a-dendrograms-structure

There is a rotate() function which can adjust the order of branches in a dendrogram.

In your case, you should generate a dendrogram for columns first:

column_dend = as.dendrogram(hclust(t(mat)))
column_dend = rotate(column_dend, ...)  # define how you rotate the branches

In the vignette I mentioned above, the author use "pipe-style syntax", so:

dend15 %>% 
   set("labels_colors") %>% 
   rotate(5:1)

is identical to

rotate(set(dend15, "labels_colors"), 5:1)

and sent it to Heatmap():

Heatmap(mat, cluster_columns = column_dend, ...)

@NicolasHipp
Copy link
Author

Hi,

I tried this solution and it works perfectly ::)

Thks for the help ! :)

Nicolas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants