Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/csoneson/treeheatmap
https://github.com/csoneson/treeheatmap
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/csoneson/treeheatmap
- Owner: csoneson
- Created: 2020-05-06T07:51:23.000Z (over 4 years ago)
- Default Branch: devel
- Last Pushed: 2024-01-29T16:20:50.000Z (11 months ago)
- Last Synced: 2024-12-18T11:47:10.993Z (21 days ago)
- Language: HTML
- Size: 2.88 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
Awesome Lists containing this project
README
# TreeHeatmap
This package is created to visualize heatmap at different levels of the tree. It allows the visualization of the heatmap to be zoomed in specific branches of the tree, and also provides annotation functions to decorate the heatmap. The syntax of annotation functions mainly follows the commonly used package ggplot2. `TreeHeatmap` can work seamlessly with `ggtree`. Geom layers that are generated in this package have a prefix geom_th to distinguish those provided in ggplot2 or ggtree.# Installation
```
devtools::install_github("fionarhuang/TreeHeatmap")
```# Viz stool data
Please find the code ([here](https://github.com/fionarhuang/TreeHeatmap/blob/master/data-raw/Viz_stool.R)) to generate the figure using `TreeHeatmap`. Or start with a toy example below to learn about `TreeHeatmap`.
![Alt text](https://github.com/fionarhuang/TreeHeatmap/blob/master/vignettes/stool.png)
# Start with a toy example
![Alt text](https://github.com/fionarhuang/TreeHeatmap/blob/master/vignettes/exFig.png)
```
library(TreeHeatmap)
library(ggnewscale)
library(ggplot2)
library(ggtree)data("toydata")
toytree <- toydata$toytree
count <- toydata$count
count_agg <- toydata$count_aggggtree(toytree, branch.length = "none", size = 0.1) +
# the first heatmap & show column tree
geom_th_heatmap(th_data = count, name = "hm1", gap = 1,
cluster_column = TRUE, color_coltree = "blue",
size_coltree = 0.5) +
scale_fill_viridis_c(option = "A", name = "hm1") +
new_scale_fill() +
# the second heatmap
geom_th_heatmap(th_data = count_agg, name = "hm2", gap = 0.2) +
scale_fill_viridis_c(option = "D", name = "hm2") +
# annotation on the row tree
geom_hilight(node = 18, fill = "blue", alpha = 0.5) +
geom_hilight(node = 15, fill = "orange", alpha = 0.5) +
geom_tippoint(color = "red", shape = 8) +
# row / column names
geom_th_text(name = "hm2", side = "right", nudge_x = 0.5,
color = "red") +
geom_th_text(name = "hm2", side = "top", nudge_y = 0.5,
angle = 90, size = 3) +
# display values
geom_th_addvalue(name = "hm1", color = "white", size = 4)```