htShiny: Interactive heatmaps as a Shiny app

View source: R/app.R

htShinyR Documentation

Interactive heatmaps as a Shiny app

Description

Interactive heatmaps as a Shiny app

Usage

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())

Arguments

ht_list

A Heatmap-class or a HeatmapList-class object. If it is not specified, the last generated heatmap is used. The heatmap object should better be already updated by draw() function.

title

Title of the app.

description

Description of the app. The content will be wrapped by a p tag and inserted before the interactive heatmap widget.

hline

Whether to add the horizontal line (by hr tag) after description.

html

HTML fragment inserted below the heatmap. The value can be a string or be wrapped by HTML.

heatmap_id

Pass to InteractiveComplexHeatmapOutput.

title1

Pass to InteractiveComplexHeatmapOutput.

title2

Pass to InteractiveComplexHeatmapOutput.

width1

Pass to InteractiveComplexHeatmapOutput.

height1

Pass to InteractiveComplexHeatmapOutput.

width2

Pass to InteractiveComplexHeatmapOutput.

height2

Pass to InteractiveComplexHeatmapOutput.

width3

Pass to InteractiveComplexHeatmapOutput.

layout

Pass to InteractiveComplexHeatmapOutput.

compact

Pass to InteractiveComplexHeatmapOutput.

action

Pass to InteractiveComplexHeatmapOutput.

cursor

Pass to InteractiveComplexHeatmapOutput.

response

Pass to InteractiveComplexHeatmapOutput.

brush_opt

Pass to InteractiveComplexHeatmapOutput.

output_ui_float

Pass to InteractiveComplexHeatmapOutput.

show_cell_fun

Whether show graphics made by cell_fun on the main heatmap?

show_layer_fun

Whether show graphics made by cell_fun on the main heatmap?

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 options argument in shinyApp.

Details

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()  

Value

A Shiny app object.

See Also

There are also many examples that can be get with htShinyExample.

Examples

# 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)
}

jokergoo/InteractiveComplexHeatmap documentation built on Feb. 28, 2024, 7:34 p.m.