Skip to contents

Plot a heatmap of marker genes fold change over metacells

Usage

plot_rna_markers_mat(
  mat,
  metacell_types = NULL,
  cell_type_colors = NULL,
  low_color = "blue",
  high_color = "red",
  mid_color = "white",
  midpoint = 0,
  min_lfp = -3,
  max_lfp = 3,
  plot_legend = TRUE,
  top_cell_type_bar = TRUE,
  gene_colors = NULL,
  col_names = FALSE,
  row_names = TRUE,
  col_names_orient = "slanted",
  plot_right = TRUE,
  interleave = TRUE,
  vertial_gridlines = FALSE,
  annotation_title = "Cell type",
  top_annotation_title = "Cell type",
  title = NULL
)

Arguments

mat

a heatmap of marker genes fold change over metacells (e.g. output of get_rna_marker_matrix)

metacell_types

a data frame with a field called "metacell" and a field called "cell_type" (optional)

cell_type_colors

a data frame with a field called "cell_type" and a field called "color" (optional)

low_color

a color for low fold change

high_color

a color for high fold change

mid_color

a color for mid fold change

midpoint

midpoint for the color scale (default: 0)

min_lfp

minimum log2 fold change (default: -3). Value below this will be set to min_lfp.

max_lfp

maximum log2 fold change (default: 3). Value above this will be set to max_lfp.

plot_legend

TRUE to plot a legend of the cell types (default: TRUE)

top_cell_type_bar

add a cell type annotation also at the top of the heatmap (default: TRUE)

gene_colors

a named list with a color for each marker gene (optional)

col_names

show column names (metacells)

row_names

The names that will be used as the Y-axis labels. A NULL (the defualt) indicates that the original matrix rownames are used. A FALSE indicates that no Y-axis labels should be displayed.

col_names_orient

Orientation of the X-axis label

plot_right

Whether to put the Y-axis labels at the right side of the heatmap (as well as at the left hand side)

interleave

show the gene names (rows) interleaved

annotation_title

title for cell type annotation. Default: "Cell type"

top_annotation_title

title for top cell type annotation. Default: "Cell type"

title

title for the plot

vertical_gridlines

show vertical gridlines

Value

a ggplot object with the heatmap (and legend if plot_legend is TRUE)

Examples

if (FALSE) {
m_rna <- get_rna_marker_matrix(atac_mc)
plot_rna_markers_mat(m_rna, atac_mc@metadata, atac_mc@metadata, col_names = F)
}