Plot Densities for any assay within a SummarizedExperiment

plotAssayDensities(x, ...)

# S4 method for class 'SummarizedExperiment'
plotAssayDensities(
  x,
  assay = "counts",
  colour,
  linetype,
  group,
  trans = NULL,
  n_max = Inf,
  ...
)

Arguments

x

A SummarizedExperiment object

...

Passed to density

assay

An assay within x

colour

Optional column in colData to colour lines by. To remove any colours, set this argument to NULL

linetype

Any optional column in colData used to determine linetype

group

Used by geom_line. Defaults to the sample names but setting to NULL will over-write this and only groups specified by colour or linetype will be drawn

trans

character(1). Any transformative function to be applied to the data before calculating the density, e.g. trans = "log2"

n_max

Maximum number of points to use when calculating densities

Value

A ggplot2 object. Scales and labels can be added using conventional ggplot2 syntax.

Details

Uses ggplot2 to create a density plot for all samples within the selected assay

Examples

data("se")
se$treatment <- c("E2", "E2", "E2", "E2DHT", "E2DHT", "E2DHT")
## Plot individual samples
plotAssayDensities(se, colour = "treatment")

## Plot combined within treatment groups
plotAssayDensities(se, colour = "treatment", group = "treatment")

## Use a data transformation
plotAssayDensities(se, trans = "log1p", colour = "treat")