htShiny | R Documentation |
Interactive heatmaps as a Shiny app
htShiny(ht_list = get_last_ht(), title = NULL,
description = NULL, hline = TRUE, html = NULL,
# parameters passed to InteractiveComplexHeatmapOutput()
heatmap_id = NULL, title1 = "Original heatmap", title2 = "Selected sub-heatmap",
width1 = ifelse(layout == "1|(2-3)", 800, 450),
height1 = ifelse(layout == "1-(2|3)", 700, 350),
width2 = 400,
height2 = 350,
width3 = ifelse(layout == "(1-2)|3", 800, 400),
layout = ifelse("brush" %in% response, "(1-2)|3", "1-3"), compact = FALSE,
action = "click", cursor = TRUE, response = c(action, "brush"),
brush_opt = list(stroke = "#f00", opacity = 0.6),
output_ui_float = FALSE,
# specific for sub-heatmap
show_cell_fun = TRUE, show_layer_fun = TRUE,
save = NULL, app_options = list())
ht_list |
A |
title |
Title of the app. |
description |
Description of the app. The content will be wrapped by a |
hline |
Whether to add the horizontal line (by |
html |
HTML fragment inserted below the heatmap. The value can be a string or be wrapped by |
heatmap_id |
Pass to |
title1 |
Pass to |
title2 |
Pass to |
width1 |
Pass to |
height1 |
Pass to |
width2 |
Pass to |
height2 |
Pass to |
width3 |
Pass to |
layout |
Pass to |
compact |
Pass to |
action |
Pass to |
cursor |
Pass to |
response |
Pass to |
brush_opt |
Pass to |
output_ui_float |
Pass to |
show_cell_fun |
Whether show graphics made by |
show_layer_fun |
Whether show graphics made by |
save |
The value can be set to a folder name so that the shiny app is saved into several files. |
app_options |
All pass to the |
With any Heatmap
/HeatmapList
object, directly send to htShiny()
to create a Shiny app for the heatmap(s):
htShiny(ht_list)
If the heatmaps are already drawn, ht_list
can be omitted and the last heatmap object is retrieved automatically:
Heatmap(...) + other_heatmaps_or_annotations # or other functions that internally use Heatmap() htShiny()
A Shiny app object.
There are also many examples that can be get with htShinyExample
.
# use last generated heatmap
if(interactive() && dev.interactive()) {
m = matrix(rnorm(100), 10)
Heatmap(m)
htShiny()
}
# by providing a heatmap/heatmap list
if(interactive()) {
m = matrix(rnorm(100), 10)
rownames(m) = 1:10
colnames(m) = 1:10
ht = Heatmap(m)
ht = draw(ht)
htShiny(ht)
}
# vertical heatmap list
if(interactive()) {
m1 = matrix(rnorm(100), 10)
rownames(m1) = 1:10
colnames(m1) = 1:10
ht1 = Heatmap(m1, row_km = 2, column_km = 2)
m2 = matrix(sample(letters[1:10], 100, replace = TRUE), 10)
ht2 = Heatmap(m2)
ht_list = draw(ht1 + ht2)
htShiny(ht_list)
ht_list = ht1 %v% ht2
htShiny(ht_list)
}
# compact mode
if(interactive()) {
m = matrix(rnorm(100), 10)
Heatmap(m)
htShiny(compact = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.