plotAndSaveHeatmaps: Plot and Save Heatmaps from Metadata Calculation Results

View source: R/Seurat.Utils.Visualization.R

plotAndSaveHeatmapsR Documentation

Plot and Save Heatmaps from Metadata Calculation Results

Description

Generates and saves heatmap visualizations for each metric in the results obtained from metadata calculations, such as 'calculateAverageMetaData() - mean or median values of specified features across different categories.

Usage

plotAndSaveHeatmaps(
  results,
  path = getwd(),
  file.prefix = "heatmap_",
  scale = "column",
  cluster_rows = FALSE,
  display_numbers = TRUE,
  show_rownames = TRUE,
  show_colnames = TRUE,
  rowname_column = 1,
  ...
)

Arguments

results

A list containing data frames with calculated metrics for each specified metadata feature, grouped by categories. Typically, this is the output from a function like calculateAverageMetaData().

path

The directory path where the heatmap images will be saved. Defaults to the current working directory (getwd()).

file.prefix

A prefix for the filenames of the saved heatmap images. Defaults to "heatmap_".

scale

Character indicating if the values should be scaled in the row direction, column direction, both ('row', 'column', 'none'). Defaults to "column".

cluster_rows

Logical indicating whether to cluster rows. Defaults to FALSE.

show_rownames

Logical indicating whether to show row names. Defaults to TRUE.

show_colnames

Logical indicating whether to show column names. Defaults to TRUE.

...

Additional arguments passed to pheatmap::pheatmap.

Details

This function loops through each metric in the results, creates a heatmap for it using pheatmap, and saves the heatmap as a PNG file in the specified path. The file names will start with the provided file.prefix, followed by the metric name.

Value

Invisible. The function primarily generates and saves files without returning data.

Examples

# Assuming `results` is the output from `calculateAverageMetaData`:
results <- calculateAverageMetaData(obj = combined.obj)
plotAndSaveHeatmaps(results, path = "path/to/save/heatmaps", file.prefix = "myData_")


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.