Visualize genes on a dot or violin plot.

plotCounts(object, ...)

# S4 method for SingleCellExperiment
plotCounts(object, genes,
  value = c("logcounts", "normcounts"), geom = c("violin", "dot"),
  perSample = TRUE, legend = getOption("acid.legend", default = TRUE),
  title = NULL)

# S4 method for Seurat
plotCounts(object, genes, value = c("logcounts",
  "normcounts"), geom = c("violin", "dot"), perSample = TRUE,
  legend = getOption("acid.legend", default = TRUE), title = NULL)

# S4 method for cell_data_set
plotCounts(object, genes,
  value = c("logcounts", "normcounts"), geom = c("violin", "dot"),
  perSample = TRUE, legend = getOption("acid.legend", default = TRUE),
  title = NULL)

plotDot(object, ...)

# S4 method for SingleCellExperiment
plotDot(object, genes, perSample = TRUE,
  colMin = -2.5, colMax = 2.5, dotMin = 0L, dotScale = 6L,
  color = getOption("acid.continuous.color", default =
  ggplot2::scale_colour_gradient2(low = "orange", mid = "gray75", high =
  "purple", midpoint = 0L)), legend = getOption("acid.legend", default =
  TRUE), title = NULL)

# S4 method for Seurat
plotDot(object, genes, perSample = TRUE,
  colMin = -2.5, colMax = 2.5, dotMin = 0L, dotScale = 6L,
  color = getOption("acid.continuous.color", default =
  ggplot2::scale_colour_gradient2(low = "orange", mid = "gray75", high =
  "purple", midpoint = 0L)), legend = getOption("acid.legend", default =
  TRUE), title = NULL)

# S4 method for cell_data_set
plotDot(object, genes, perSample = TRUE,
  colMin = -2.5, colMax = 2.5, dotMin = 0L, dotScale = 6L,
  color = getOption("acid.continuous.color", default =
  ggplot2::scale_colour_gradient2(low = "orange", mid = "gray75", high =
  "purple", midpoint = 0L)), legend = getOption("acid.legend", default =
  TRUE), title = NULL)

plotViolin(object, ...)

# S4 method for SingleCellExperiment
plotViolin(object, genes,
  value = c("logcounts", "normcounts"), perSample = TRUE,
  scale = c("count", "width", "area"),
  color = getOption("acid.discrete.color", default = NULL),
  legend = getOption("acid.legend", default = TRUE), title = NULL)

# S4 method for Seurat
plotViolin(object, genes, value = c("logcounts",
  "normcounts"), perSample = TRUE, scale = c("count", "width", "area"),
  color = getOption("acid.discrete.color", default = NULL),
  legend = getOption("acid.legend", default = TRUE), title = NULL)

# S4 method for cell_data_set
plotViolin(object, genes,
  value = c("logcounts", "normcounts"), perSample = TRUE,
  scale = c("count", "width", "area"),
  color = getOption("acid.discrete.color", default = NULL),
  legend = getOption("acid.legend", default = TRUE), title = NULL)

Arguments

object

Object.

genes

character. Gene identifiers.

value

Value to assign.

geom

character(1). Plot type. Uses match.arg() to pick the type. Currently supports "dot" and "violin".

perSample

logical(1). Visualize the distributions per sample.

legend

logical(1). Include plot legend.

title

character(1). Title.

colMin

numeric(1). Minimum scaled average expression threshold. Everything smaller will be set to this.

colMax

numeric(1). Maximum scaled average expression threshold. Everything larger will be set to this.

dotMin

numeric(1). The fraction of cells at which to draw the smallest dot. All cell groups with less than this expressing the given gene will have no dot drawn.

dotScale

numeric(1). Scale the size of the points, similar to cex.

color

ScaleDiscrete. Desired ggplot2 color scale. Must supply discrete values. When set NULL, the default ggplot2 color palette will be used. If manual color definitions are desired, we recommend using ggplot2::scale_color_manual().

To set the discrete color palette globally, use:

options(acid.color.discrete = ggplot2::scale_color_viridis_d())
scale

if "area" (default), all violins have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width.

...

Additional arguments.

Value

ggplot.

Note

Dot geom currently only supports logcounts.

Updated 2019-08-06.

See also

Examples

data( Seurat, cell_data_set, package = "acidtest" ) ## Seurat ==== object <- Seurat ## Plotting with either gene IDs or gene names (symbols) works. genes <- head(rownames(object), n = 4L) print(genes)
#> [1] "MS4A1" "CD79B" "CD79A" "HLA-DRA"
## Per sample mode enabled. plotCounts(object, genes = genes, perSample = TRUE)
#> Error: Unknown column `HLA-DRA`
## Per sample mode disabled. plotCounts(object, genes = genes, perSample = FALSE)
#> Error: Unknown column `HLA-DRA`
## cell_data_set ==== object <- cell_data_set genes <- head(rownames(object), n = 4L) print(genes)
#> [1] "WBGene00006436" "WBGene00006789" "WBGene00001168" "WBGene00010964"
plotCounts(object, genes = genes)