pbHeatmap: Heatmap of cluster-sample pseudobulks

View source: R/pbHeatmap.R

pbHeatmapR Documentation

Heatmap of cluster-sample pseudobulks

Description

...

Usage

pbHeatmap(
  x,
  y,
  k = NULL,
  g = NULL,
  c = NULL,
  top_n = 20,
  fdr = 0.05,
  lfc = 1,
  sort_by = "p_adj.loc",
  decreasing = FALSE,
  assay = "logcounts",
  fun = mean,
  normalize = TRUE,
  col = viridis(10),
  row_anno = TRUE,
  col_anno = TRUE
)

Arguments

x

a SingleCellExperiment.

y

a list of DS analysis results as returned by pbDS or mmDS.

k

character vector; specifies which cluster ID(s) to retain. Defaults to levels(x$cluster_id).

g

character vector; specifies which genes to retain. Defaults to considering all genes.

c

character string; specifies which contrast/coefficient to retain. Defaults to names(y$table)[1].

top_n

single numeric; number of genes to retain per cluster.

fdr, lfc

single numeric; FDR and logFC cutoffs to filter results by. The specified FDR threshold is applied to p_adj.loc values.

sort_by

character string specifying a numeric results table column to sort by; "none" to retain original ordering.

decreasing

logical; whether to sort in decreasing order of sort_by.

assay

character string; specifies which assay to use; should be one of assayNames(x).

fun

function to use as summary statistic, e.g., mean, median, sum (depending on the input assay).

normalize

logical; whether to apply a z-normalization to each row (gene) of the cluster-sample pseudobulk data.

col

character vector of colors or color mapping function generated with colorRamp2. Passed to argument col in Heatmap (see ?ComplexHeatmap::Heatmap for details).

row_anno, col_anno

logical; whether to render annotations of cluster and group IDs, respectively.

Value

a HeatmapList-class object.

Author(s)

Helena L Crowell

Examples

# compute pseudobulks & run DS analysis
data(example_sce)
pb <- aggregateData(example_sce)
res <- pbDS(pb)

# cluster-sample expression means
pbHeatmap(example_sce, res)

# include only a single cluster
pbHeatmap(example_sce, res, k = "B cells")

# plot specific gene across all clusters
pbHeatmap(example_sce, res, g = "ISG20")


HelenaLC/ddSingleCell documentation built on Oct. 14, 2024, 2:08 p.m.