splitEnrichment: Visualize enrichment results with a split violin plot

View source: R/splitEnrichment.R

splitEnrichmentR Documentation

Visualize enrichment results with a split violin plot

Description

This function allows to the user to examine the distribution of enrichment across groups by generating a split violin plot.

Usage

splitEnrichment(
  input.data,
  assay = NULL,
  split.by = NULL,
  group.by = NULL,
  gene.set = NULL,
  order.by = NULL,
  facet.by = NULL,
  scale = TRUE,
  palette = "inferno"
)

Arguments

input.data

Enrichment output from escape.matrix or runEscape.

assay

Name of the assay to plot if data is a single-cell object.

split.by

Variable to form the split violin, must have 2 levels.

group.by

Categorical parameter to plot along the x.axis. If input is a single-cell object the default will be cluster.

gene.set

Gene set to plot (on y-axis).

order.by

Method to organize the x-axis - "mean" will arrange the x-axis by the mean of the gene.set, while "group" will arrange the x-axis by in alphanumerical order. Using NULL will not reorder the x-axis.

facet.by

Variable to facet the plot into n distinct graphs.

scale

Visualize raw values FALSE or Z-transform enrichment values TRUE.

palette

Colors to use in visualization - input any hcl.pals.

Value

ggplot2 object violin-based distributions of selected gene.set

Examples

GS <- list(Bcells = c("MS4A1", "CD79B", "CD79A", "IGH1", "IGH2"),
           Tcells = c("CD3E", "CD3D", "CD3G", "CD7","CD8A"))
pbmc_small <- SeuratObject::pbmc_small
pbmc_small <- runEscape(pbmc_small, 
                        gene.sets = GS, 
                        min.size = NULL)
                        
splitEnrichment(pbmc_small, 
                assay = "escape",
                split.by = "groups",
                gene.set = "Tcells")


ncborcherding/escape documentation built on Sept. 23, 2024, 10:01 p.m.