Generally, we expect similar count spreads for all genes between samples unless the library sizes or total RNA expression are different.

plotCountsPerFeature(object, ...)

# S4 method for SummarizedExperiment
plotCountsPerFeature(object, assay = 1L,
  minCounts = 1L, minCountsMethod = c("perFeature", "absolute"),
  interestingGroups = NULL, geom = c("boxplot", "density", "jitter"),
  trans = c("identity", "log2", "log10"), color = getOption(x =
  "acid.color.discrete", default =
  acidplots::scale_colour_synesthesia_d()), fill = getOption(x =
  "acid.fill.discrete", default = acidplots::scale_fill_synesthesia_d()),
  flip = getOption(x = "acid.flip", default = TRUE),
  countsAxisLabel = "counts", title = "Counts per feature")

# S4 method for SingleCellExperiment
plotCountsPerFeature(object, assay = 1L,
  minCounts = 1L, minCountsMethod = c("perFeature", "absolute"),
  interestingGroups = NULL, geom = c("boxplot", "density", "jitter"),
  trans = c("identity", "log2", "log10"), color = getOption(x =
  "acid.color.discrete", default =
  acidplots::scale_colour_synesthesia_d()), fill = getOption(x =
  "acid.fill.discrete", default = acidplots::scale_fill_synesthesia_d()),
  flip = getOption(x = "acid.flip", default = TRUE),
  countsAxisLabel = "counts", title = "Counts per feature")

Arguments

object

Object.

assay

vector(1). Name or index of count matrix slotted in assays(). When passing in a string, the name must be defined in assayNames().

minCounts

integer(1). Minimum count threshold to apply. Filters using "greater than or equal to" logic internally. Note that this threshold gets applied prior to logarithmic transformation, when trans argument applies.

minCountsMethod

character(1). Uses match.arg().

  • perFeature: Recommended. Applies cutoff per row feature (i.e. gene). Internally, rowSums() values are checked against this cutoff threshold prior to the melt operation.

  • absolute: Applies hard cutoff to counts column after the melt operation. This applies to all counts, not per feature.

interestingGroups

character. Groups of interest that define the samples. If left unset, defaults to sampleName.

geom

character(1). Type of ggplot2 geometric object to use.

trans

character(1). Apply a log transformation (e.g. log2(x + 1L)) to the count matrix prior to melting, if desired. Use "identity" to return unmodified (default).

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())
fill

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

To set the discrete fill palette globally, use:

options(acid.fill.discrete = ggplot2::scale_fill_viridis_d())
flip

logical(1). Flip x and y axes. Recommended for plots containing many samples.

countsAxisLabel

character(1). Counts axis label.

title

character(1). Plot title.

...

Additional arguments.

Value

ggplot.

Examples

data(rse, sce, package = "acidtest") ## SummarizedExperiment ==== plotCountsPerFeature(rse, geom = "boxplot")
#> 499 / 500 features passed minimum rowSums() >= 1 expression cutoff.
plotCountsPerFeature(rse, geom = "density")
#> 499 / 500 features passed minimum rowSums() >= 1 expression cutoff.
## SingleCellExperiment ==== plotCountsPerFeature(sce)
#> Aggregating counts using sum().
#> 230 / 230 features passed minimum rowSums() >= 1 expression cutoff.