plotMetadataCorHeatmap: Plot Metadata Correlation Heatmap

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

plotMetadataCorHeatmapR Documentation

Plot Metadata Correlation Heatmap

Description

This function plots a heatmap of metadata correlation values. It accepts a Seurat object and a set of metadata columns to correlate. The correlations are calculated using either Pearson or Spearman methods, and the resulting heatmap can include the principal component (PCA) values and be saved with a specific suffix.

Usage

plotMetadataCorHeatmap(
  columns = c("nCount_RNA", "nFeature_RNA", "percent.mito", "percent.ribo"),
  obj,
  cormethod = c("pearson", "spearman")[1],
  main = paste("Metadata", cormethod, "correlations"),
  show_numbers = FALSE,
  digits = 1,
  suffix = NULL,
  add_PCA = TRUE,
  n_PCs = 8,
  w = ceiling((length(columns) + n_PCs)/2),
  h = w,
  use_ggcorrplot = FALSE,
  n_cutree = (n_PCs),
  ...
)

Arguments

columns

A vector of metadata column names to calculate correlations. Default: c("nCount_RNA", "nFeature_RNA", "percent.mito", "percent.ribo").

obj

The main Seurat object used for calculations. No default value.

cormethod

The method to calculate correlations. Can be either "pearson" or "spearman". Default: "pearson".

main

The main title for the plot. Default: "Metadata correlations" followed by the correlation method.

show_numbers

Logical, determines if correlation values should be displayed on the plot. Default: FALSE.

digits

The number of decimal places for displayed correlation values. Default: 1.

suffix

A suffix added to the output filename. Default: NULL.

add_PCA

Logical, determines if PCA values should be included in the correlation calculation. Default: TRUE.

n_PCs

The number of PCA components to be included if 'add_PCA' is TRUE. Default: 8.

w

The width of the plot in inches. Default: ceiling((length(columns)+n_PCs)/2).

h

The height of the plot in inches. Default: the value of w.

use_ggcorrplot

Logical, determines if the ggcorrplot package should be used for plotting. Default: FALSE.

n_cutree

The number of clusters to be used in hierarchical clustering. Default: the number of PCs.

...

Additional parameters passed to the internally called ggcorrplot function.

See Also

ggcorrplot


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