Skip to contents

Generates a dot plot where dot color encodes scaled average expression and dot size encodes percent of cells expressing each gene. Cell groups (y-axis) are numbered and can be hierarchically clustered. Genes (x-axis) are grouped by a gene-metadata column and faceted accordingly.

Usage

SplitDotPlot(
  seurat_object,
  markers_df,
  gene_column = "Genes",
  gene_group_column = "CellType",
  group.by = "seurat_clusters",
  split.by = NULL,
  gene_col = NULL,
  gene_group_col = NULL,
  ClusterFeatures = FALSE,
  col.min = 0,
  col.max = 2.5,
  scale.min = 5,
  scale.max = 100,
  dot.scale = 6,
  cols = "RdBu",
  output_dir = NULL,
  file_name = NULL
)

Arguments

seurat_object

A Seurat object.

markers_df

A data frame containing at least two columns: gene names and gene group labels.

gene_column

Character. Column in markers_df with gene names. Default "Genes".

gene_group_column

Character. Column in markers_df with gene group labels (used for x-axis faceting). Default "CellType".

group.by

Character. Metadata column for the y-axis (cell groups). Default "GlobalAssignment".

split.by

Character or NULL. Metadata column to split rows by. NULL shows all groups together. Default "CancerType".

gene_col

Deprecated alias for gene_column. Ignored when gene_column is set explicitly.

gene_group_col

Deprecated alias for gene_group_column. Ignored when gene_group_column is set explicitly.

ClusterFeatures

Logical. Hierarchically cluster cell groups (y-axis)? Default FALSE.

col.min, col.max

Numeric. Color scale clamp limits for scaled average expression. Defaults 0 and 2.5.

scale.min, scale.max

Numeric. Size scale clamp limits for percent expressed. Defaults 5 and 100.

dot.scale

Numeric. Maximum dot radius. Default 6.

cols

Ignored (kept for API compatibility). Color palette is viridis plasma.

output_dir

Character or NULL. Directory to save a PDF. NULL (default) returns the plot without saving. When NULL, the function walks up to the output_dir stored by PrepObject, unless AutoSavePlots = FALSE was set there.

file_name

Character or NULL. Base name (no extension) for the saved PDF. NULL (default) auto-generates a name that includes the markers_df variable name (when detectable) followed by group.by and split.by, e.g. <markers>_<group.by>_<split.by>_SplitDotPlot, so different groupings and splits never overwrite each other.

Value

A ggplot2 object (invisibly when saved to disk).

Details

A temporary metadata column (Temp_Interaction_Var) is added to the Seurat object during computation and automatically removed on exit.