Skip to contents

This function creates a dot plot using Antibody-Derived Tag (ADT) data from a Seurat object, applying log transformation and optional noise to the data. The function also provides customization options for colors, downsampling, and buffer adjustments for the plot axes.

Usage

adt_dotplot(
  seu,
  x,
  y,
  color = NULL,
  addvalue = 1,
  downsample = 0.2,
  cols = NULL,
  add_noise = TRUE,
  size = 0.8,
  xpbuff = 0.5,
  ypbuff = 0.5,
  xnbuff = 0,
  ynbuff = 0,
  remove_negs = TRUE
)

Arguments

seu

A Seurat object containing ADT data.

x

A string representing the name of the feature to plot on the x-axis.

y

A string representing the name of the feature to plot on the y-axis.

color

(Optional) A string representing the name of the feature to use for coloring the dots. Defaults to NULL.

addvalue

A numeric value added to each feature value before log transformation. Defaults to 1.

downsample

A numeric value between 0 and 1 specifying the fraction of the data to randomly sample. Defaults to 0.2.

cols

(Optional) A vector of colors to use for coloring the dots. Can be used for both continuous and categorical color scales. Defaults to NULL.

add_noise

A logical indicating whether to add noise (via jittering) to the data before plotting. Defaults to TRUE.

size

A numeric value specifying the size of the dots in the plot. Defaults to 0.8.

xpbuff

A numeric value specifying the positive buffer for the x-axis limits. Defaults to 0.5.

ypbuff

A numeric value specifying the positive buffer for the y-axis limits. Defaults to 0.5.

xnbuff

A numeric value specifying the negative buffer for the x-axis limits. Defaults to 0.

ynbuff

A numeric value specifying the negative buffer for the y-axis limits. Defaults to 0.

remove_negs

A logical value indicating whether to remove points with negative values on the x or y axes after log transformation. Defaults to TRUE.

Value

A ggplot object representing the dot plot.

Examples

# Example usage
adt_dotplot(seu = my_seurat_object,
            x = "ADT_feature1",
            y = "ADT_feature2",
            color = "ADT_feature3")
#> Error in eval(expr, envir, enclos): object 'my_seurat_object' not found