Skip to contents

Server logic for the ComplexHeatmap module

Usage

ComplexHeatmap_HeatmapServer(
  id,
  data,
  hide.inputs = NULL,
  hide.tabs = NULL,
  defaults = NULL
)

Arguments

id

The ID for the Shiny module.

data

A reactive yielding either a data frame (the matrix's columns plus any row-annotation columns, all together — the original, single-table behavior) or list(matrix = <data.frame>, column_annotations = <data.frame>) to additionally enable column annotations, where column_annotations is a per-sample metadata table keyed by a column matching the matrix's selected column names (see the "Column Key" input). A NULL value (or a list missing matrix) is treated as "not ready yet" and the module waits for data.

hide.inputs

A character vector of input IDs to hide. These will still be initialized and their values used, but the user will not be able to see/adjust them in the UI.

hide.tabs

A character vector of tab names to hide. Inputs in these tabs will still be initialized and used, but not shown in the UI.

defaults

A named list of default values for the inputs. When the reset button is clicked, inputs are reset to these values rather than hardcoded fallbacks. Typically the same list passed to the UI function. An entry may also be a shiny::reactive() or shiny::reactiveVal(), in which case the input tracks it as the parent app's state changes; see setup_reactive_defaults().

Value

The moduleServer function for the ComplexHeatmap module. The returned reactive yields the source-download bundle (matrix data + inputs).

Details

The incoming data frame is converted to a numeric matrix using the selected matrix columns (and optional row-name column). Row/column annotation tracks configured on the "Annotations" tab are built as ComplexHeatmap::rowAnnotation()/ComplexHeatmap::columnAnnotation() (one per side) and passed as left_annotation/right_annotation/ top_annotation/bottom_annotation. The heatmap is built with ComplexHeatmap::Heatmap() and registered for interactivity with InteractiveComplexHeatmap::makeInteractiveComplexHeatmap(), which draws it onto its own device to capture the interactive widget.

Both ComplexHeatmap and InteractiveComplexHeatmap are Bioconductor packages and are only required at runtime for this module; they are guarded with requireNamespace().

Author

Jacob Martin, Jared Andrews