plotBinaryHeat: plotBinaryHeat

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotBinaryHeat.R

Description

Plot a heatmap binarized values for a select set of genes or peaks across all cells. Optionally also cluster those genes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotBinaryHeat(
  exp,
  classes,
  markers,
  colors = colorRampPalette(c("white", "black"))(n = 100),
  newOrder = 1:length(unique(classes)),
  clusterGenes = FALSE,
  clusterGenesK = length(unique(classes)),
  averageCells = 0,
  outs = FALSE,
  plotheat = TRUE,
  gaps = TRUE,
  seed = 10
)

Arguments

exp

A matrix of *binary* (0s and 1s) expression values. For example, the one found in sortGenes(...)$binary.

classes

A vector or factor of cell classes, whose length is equal to ncol(exp).

markers

A character vector of gene or peak names to plot in the heatmap.

colors

Color palette used for the heatmap.

newOrder

Reorder the clusters in the heatmap? See Examples.

clusterGenes

Cluster genes before plotting?

clusterGenesK

How many clusters should genes by clustered into? See Details.

averageCells

Plot averages of cells instead of individual cells. You can use this when you have a large number of cells. See Details.

outs

Should gene cluster output and pheatmap object be returned? FALSE by default.

plotheat

Should the heatmap be drawn? TRUE by default.

gaps

Should the heatmap have gaps between cell types and gene clusters? TRUE by default.

seed

Randomization seed used for gene clustering initialization.

Details

plotBinaryHeat is similar to plotMarkerHeat but works on the binarized matrix, plotting only 0s and 1s (for scRNA-Seq, this means ignoring expression values and just plotting whether the gene is expressed or not). If averageCells is > 1, the fraction of the averaged cells where the gene or peak was detected will be plotted (a number between 0 and 1).

clusterGenesK parameter controls the number of gene clusters when clusterGenes is TRUE. By default, it is equal to the number of cell types/clusters.

By default, the heatmap plots every single cell in one column, this might take forever if you have a lot of cells (would say >10k) or it can crash when you do not have enough RAM. If so, it might be good to set averageCells to n where n is the number of cells you want to average. For example, if averageCells = 10, every 10 cells will be averaged (without averaging across cell clusters) before plotting the heatmap. if averageCells =< 1, no averaging happens. Hints: (1) If you want one column per cell cluster, set averageCells to a very high number (larger than the number of cells in the largest cluster). (2) Gene clustering occurs after cell averaging, so averaging will be useful in this case to prevent running k-means on binary values.

Value

If outs is TRUE, plotMarkerHeat returns a list containing:

p

The pheatmap object corresponding to the plot.

gene_class_info

Gene cluster assignments if gene clustering was requested. See Details.

new_class_info

The new order of cell clusters. See Examples.

Author(s)

Mahmoud M Ibrahim <mmibrahim@pm.me>

See Also

plotMarkerHeat

Examples

1
2
3
4
5
6
data(kidneyTabulaMuris)
gs = sortGenes(kidneyTabulaMuris$exp, kidneyTabulaMuris$cellType)
mm = getMarkers(gs, quant = 0.999)

#this plots a heatmap without reordering genes
plotBinaryHeat(gs$binary, gs$inputClass, mm$markers)

mahmoudibrahim/genesorteR documentation built on April 20, 2021, 4:07 p.m.