Plot counts

plotCounts(object, ...)

# S4 method for SummarizedExperiment
plotCounts(object, genes, assay = 1L,
  interestingGroups = NULL, trans = c("identity", "log2", "log10"),
  countsAxisLabel = "counts", 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.

assay

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

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")
countsAxisLabel

character(1). Label to use for the counts axis.

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(rse, package = "acidtest") rownames <- head(rownames(rse)) print(rownames)
#> [1] "gene001" "gene002" "gene003" "gene004" "gene005" "gene006"
g2s <- basejump::Gene2Symbol(rse) geneIDs <- head(g2s[["geneID"]]) print(geneIDs)
#> [1] "ENSG00000000003" "ENSG00000000005" "ENSG00000000419" "ENSG00000000457" #> [5] "ENSG00000000460" "ENSG00000000938"
geneNames <- head(g2s[["geneName"]]) print(geneNames)
#> [1] "TSPAN6" "TNMD" "DPM1" "SCYL3" "C1orf112" "FGR"
## Rownames, gene IDs, and gene names (symbols) are supported. plotCounts(rse, genes = geneIDs, style = "facet")
plotCounts(rse, genes = geneNames, style = "wide")