Skip to contents

Generate HeatmapAnnotation objects from metadata that can be added to classification heatmaps.

Usage

get_custom_annotations(
  metadata = NULL,
  annotation_vars = NULL,
  sample_order = NULL,
  custom_colors = NULL,
  show_legends = FALSE,
  annotation_height = 4,
  font_size = 8
)

Arguments

metadata

A data frame with samples as rows and annotation variables as columns. Row names should match sample IDs in the expression data.

annotation_vars

Character vector specifying which columns from metadata to include. If NULL (default), all columns will be used.

sample_order

Optional, vector specifying sample order. Should match the order used in the main heatmap.

custom_colors

Optional named list of color schemes for specific annotations. Names should match annotation variable names.

show_legends

Logical vector or single value indicating whether to show legends for each annotation. Default is FALSE.

annotation_height

Height of annotation tracks in mm. Default is 4.

font_size

Font size for annotation labels. Default is 8.

Value

HeatmapAnnotation object that can be passed to plot_classification_heatmap

Details

This function takes a metadata data frame and creates annotation tracks that can be integrated into the main classification heatmap. It automatically handles different data types and provides sensible color schemes.

Examples

custom_annot <- get_custom_annotations(
  metadata = sjodahl_2017_meta,
  annotation_vars = c("gender", "turb_stage"),
  show_legends = TRUE)