InteractiveComplexHeatmapWidget: Interactive complex heatmap widget

View source: R/shiny-widget.R

InteractiveComplexHeatmapWidgetR Documentation

Interactive complex heatmap widget

Description

Interactive complex heatmap widget

Usage

InteractiveComplexHeatmapWidget(
    input, output, session, ht_list, heatmap_id = NULL, output_id,
    
    # parameters passed to InteractiveComplexHeatmapOutput()
    title1 = "Original heatmap", title2 = "Selected sub-heatmap",
    width1 = ifelse(layout == "1|(2-3)", 800, 450),
    height1 = ifelse(layout == "1-(2|3)", 700, 350),
    width2 = 370,
    height2 = 350,
    width3 = ifelse(layout == "(1-2)|3", 800, 370),
    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 = TRUE, output_ui_float = FALSE,
    
    # parameters passed to makeInteractiveComplexHeatmap()
    click_action = NULL, brush_action = NULL,
    
    # other configurations
    js_code = "", close_button = TRUE, cancel_action = c("remove", "hide"))

Arguments

input

Passed from the Shiny server function.

output

Passed from the Shiny server function.

session

Passed from the Shiny server function.

ht_list

A Heatmap-class or a HeatmapList-class object.

heatmap_id

ID of the plot. If it is not specified, an internal ID is assigned.

output_id

Where the heatmap is put.

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

Pass to InteractiveComplexHeatmapOutput.

output_ui_float

Pass to InteractiveComplexHeatmapOutput.

click_action

Pass to makeInteractiveComplexHeatmap.

brush_action

Pass to makeInteractiveComplexHeatmap.

js_code

Additional JavaScript code that is put after the interactive heatmap UI. The value can be a text or a function that takes "heatmap ID" as the argument and returns the formatted JavaScript code.

close_button

Whether to add a close button at the end of the widget.

cancel_action

Whether to remove the UI from HTML or just hide it when the UI is closed.

Details

It creates an interactive heatmap widget according to a certain action. The UI is placed to the output ID that user defined.

The function is normally put inside observe or observeEvent.

Value

No value is returned.

Examples

if(interactive()) {
    require(ComplexHeatmap)

    ui = fluidPage(
        actionButton("show_heatmap", "Generate_heatmap"),
        htmlOutput("heatmap_output")
    )

    server = function(input, output, session) {
        m = matrix(rnorm(100), 10)
        ht = Heatmap(m)

        observeEvent(input$show_heatmap, {
            InteractiveComplexHeatmapWidget(input, output, session, ht, 
                output_id = "heatmap_output")
        })
    }
    shiny::shinyApp(ui, server)
}

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