tof_plot_sample_heatmap: Make a heatmap summarizing sample marker expression patterns...

View source: R/visualization.R

tof_plot_sample_heatmapR Documentation

Make a heatmap summarizing sample marker expression patterns in CyTOF data

Description

This function makes a heatmap of sample-to-sample marker expression patterns in single-cell data. Markers are plotted along the horizontal (x-) axis of the heatmap and sample IDs are plotted along the vertical (y-) axis of the heatmap.

Usage

tof_plot_sample_heatmap(
  tof_tibble,
  sample_col,
  marker_cols = where(tof_is_numeric),
  central_tendency_function = stats::median,
  scale_markerwise = FALSE,
  scale_samplewise = FALSE,
  line_width = 0.25,
  theme = ggplot2::theme_minimal()
)

Arguments

tof_tibble

A 'tof_tbl' or a 'tibble'.

sample_col

An unquoted column name indicating which column in 'tof_tibble' stores the ids for the sample to which each cell belongs.

marker_cols

Unquoted column names indicating which column in 'tof_tibble' should be interpreted as markers to be plotted along the x-axis of the heatmap. Supports tidyselect helpers.

central_tendency_function

A function to use for computing the measure of central tendency that will be aggregated from each sample in cluster_col. Defaults to the median.

scale_markerwise

A boolean value indicating if the heatmap should rescale the columns of the heatmap such that the maximum value for each marker is 1 and the minimum value is 0. Defaults to FALSE.

scale_samplewise

A boolean value indicating if the heatmap should rescale the rows of the heatmap such that the maximum value for each sample is 1 and the minimum value is 0. Defaults to FALSE.

line_width

A numeric value indicating how thick the lines separating the tiles of the heatmap should be. Defaults to 0.25.

theme

A ggplot2 theme to apply to the heatmap. Defaults to theme_minimal

Value

A ggplot object.

Examples

sim_data <-
    dplyr::tibble(
        cd45 = rnorm(n = 1000),
        cd38 = rnorm(n = 1000),
        cd34 = rnorm(n = 1000),
        cd19 = rnorm(n = 1000),
        sample_id = sample(paste0("sample", 1:5), size = 1000, replace = TRUE)
    )

heatmap <-
    tof_plot_sample_heatmap(
        tof_tibble = sim_data,
        sample_col = sample_id
    )


keyes-timothy/tidytof documentation built on Aug. 28, 2024, 8:37 a.m.