Skip to contents

A GPU-accelerated heatmap for large expression matrices (samples x genes). The matrix is uploaded to the GPU as a single texture and colormapped in a fragment shader (via regl), so matrices with a million or more cells pan and zoom smoothly. The colorbar legend and row/column tick labels are drawn as crisp vector overlays; ticks appear only when few enough to be legible.

Usage

bioheatmap(
  mat,
  colormap = c("viridis", "rdbu"),
  z_score = FALSE,
  vmin = NULL,
  vmax = NULL,
  show_colorbar = TRUE,
  theme = NULL,
  width = NULL,
  height = NULL,
  element_id = NULL
)

heatmap_plotomics(
  mat,
  colormap = c("viridis", "rdbu"),
  z_score = FALSE,
  vmin = NULL,
  vmax = NULL,
  show_colorbar = TRUE,
  theme = NULL,
  width = NULL,
  height = NULL,
  element_id = NULL
)

Arguments

mat

A numeric matrix (rows x columns). rownames(mat) and colnames(mat), when present, are used as row/column tick labels.

colormap

Color ramp: "viridis" (sequential) or "rdbu" (diverging).

z_score

Logical; if TRUE, each row is z-score normalized before coloring (a row-centered heatmap).

vmin, vmax

Lower/upper clamp of the color domain. NULL (the default) auto-scales from the data; for "rdbu" the auto domain is symmetric about zero.

show_colorbar

Logical; draw the colorbar legend.

theme

Optional named list of theme overrides (colors, fonts, ...) merged over the component defaults in the browser. NULL uses the default theme.

width, height

Widget dimensions (any valid CSS size).

element_id

Optional explicit DOM id.

Value

An htmlwidget object.

Details

The function is exported as bioheatmap() (and aliased as heatmap_plotomics()) to avoid masking stats::heatmap().

Examples

set.seed(1)
m <- matrix(rnorm(50 * 30), nrow = 50, ncol = 30)
rownames(m) <- paste0("gene", seq_len(50))
colnames(m) <- paste0("sample", seq_len(30))
bioheatmap(m, z_score = TRUE)