Skip to contents

Extends SplitDotPlot() with two additional features:

  • ClusterGenes: hierarchically clusters genes on the x-axis.

  • min.pct.exp: drops genes expressed in fewer than this percent of cells in every group.

Usage

SplitDotPlot2(
  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,
  ClusterGroups = FALSE,
  ClusterGenes = TRUE,
  min.pct.exp = 15,
  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.

ClusterGroups

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

ClusterGenes

Logical. Hierarchically cluster genes (x-axis)? Default TRUE.

min.pct.exp

Numeric. Minimum percent expression a gene must reach in at least one group to be kept. Default 15.

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).