Plot counts

plotCounts(object, ...)

# S4 method for DESeqAnalysis
plotCounts(object, genes, transform = FALSE,
  interestingGroups = NULL, trans = c("identity", "log2", "log10"),
  medianLine = TRUE, color = getOption(x = "acid.color.discrete",
  default = acidplots::scale_colour_synesthesia_d()),
  legend = getOption(x = "acid.legend", default = TRUE),
  style = c("facet", "wide"))

Arguments

object

Object.

genes

character. Gene identifiers. It is considered better practice to input the stable gene identifiers from Ensembl (e.g. "ENSG00000000003") and not the (HGNC) gene symbols (e.g. "TSPN6"), if possible.

transform

logical(1). Visualize using DESeqTransform log2 variance-stabilized counts, rather than DESeqDataSet size-factor normalized counts.

interestingGroups

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

trans

character(1). Name of the axis scale transformation to apply.

For more information:

help(topic = "scale_x_continuous", package = "ggplot2")
medianLine

logical(1). Include median line for each group. Disabled if samples are colored by sample name.

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

logical(1). Show plot legend.

style

character(1). Plot style.

...

Additional arguments.

Value

  • style = "facet": ggplot grouped by sampleName, with ggplot2::facet_wrap() applied to panel the samples.

  • style = "wide": ggplot in wide format, with genes on the x-axis.

See also

Examples

data(deseq) ## Get genes from DESeqDataSet. dds <- as(deseq, "DESeqDataSet") genes <- head(rownames(dds)) print(genes)
#> [1] "gene001" "gene002" "gene003" "gene004" "gene005" "gene006"
## DESeqAnalysis ==== plotCounts(deseq, genes = genes, style = "facet")
#> DESeqDataSet detected. Using normalized counts.
plotCounts(deseq, genes = genes, style = "wide")
#> DESeqDataSet detected. Using normalized counts.