Learn R Programming

romic (version 1.3.3)

plot_heatmap: Plot Heatmap

Description

Generate a heatmap visualization of a features x samples matrix of measurements.

Usage

plot_heatmap(
  tomic,
  feature_var = NULL,
  sample_var = NULL,
  value_var = NULL,
  cluster_dim = "both",
  distance_measure = "dist",
  hclust_method = "ward.D2",
  change_threshold = Inf,
  max_display_features = 800,
  x_title = NULL,
  y_title = NULL,
  colorbar_title = NULL,
  transpose = FALSE
)

Value

a ggplot2 grob

Arguments

tomic

Either a tidy_omic or triple_omic object

feature_var

variable from "features" to use as a unique feature label.

sample_var

variable from "samples" to use as a unique sample label.

value_var

which variable in "measurements" to use for quantification.

cluster_dim

rows, columns, or both

distance_measure

variable to use for computing dis-similarity

corr

pearson correlation

dist

euclidean distance

hclust_method

method from stats::hclust to use for clustering

change_threshold

values with a more extreme absolute change will be thresholded to this value.

max_display_features

aggregate and downsample distinct feature to this number to speed to up heatmap rendering.

x_title

label for x-axis (if NULL then use feature_var)

y_title

label for y-axis (if NULL then use sample_var)

colorbar_title

label for color-bar; default is log2 abundance

transpose

if TRUE then samples will be rows and features will be columns. Set all other variables as if transpose was FALSE.

Examples

Run this code

library(dplyr)

tomic <- brauer_2008_triple %>%
  filter_tomic(
    filter_type = "category",
    filter_table = "features",
    filter_variable = "BP",
    filter_value = c(
      "protein biosynthesis",
      "rRNA processing", "response to stress"
    )
  )

plot_heatmap(
  tomic = tomic,
  value_var = "expression",
  change_threshold = 5,
  cluster_dim = "rows",
  distance_measure = "corr",
  transpose = FALSE
)

Run the code above in your browser using DataLab