Visualize gene markers on a reduced dimension plot (e.g. t-SNE, UMAP).

plotMarker(object, ...)

# S4 method for SingleCellExperiment
plotMarker(object, genes,
  reduction = "UMAP", expression = c("mean", "sum"),
  color = getOption("acid.continuous.color", default =
  ggplot2::scale_colour_gradient(low = "gray75", high = "purple")),
  pointSize = getOption("acid.pointSize", default = 0.75),
  pointAlpha = getOption("acid.pointAlpha", default = 0.85),
  pointsAsNumbers = getOption("acid.pointsAsNumbers", default = FALSE),
  label = getOption("acid.label", default = TRUE),
  labelSize = getOption("acid.labelSize", default = 6L),
  dark = getOption("acid.dark", default = FALSE),
  legend = getOption("acid.legend", default = TRUE), title = TRUE)

# S4 method for Seurat
plotMarker(object, genes, reduction = "UMAP",
  expression = c("mean", "sum"),
  color = getOption("acid.continuous.color", default =
  ggplot2::scale_colour_gradient(low = "gray75", high = "purple")),
  pointSize = getOption("acid.pointSize", default = 0.75),
  pointAlpha = getOption("acid.pointAlpha", default = 0.85),
  pointsAsNumbers = getOption("acid.pointsAsNumbers", default = FALSE),
  label = getOption("acid.label", default = TRUE),
  labelSize = getOption("acid.labelSize", default = 6L),
  dark = getOption("acid.dark", default = FALSE),
  legend = getOption("acid.legend", default = TRUE), title = TRUE)

Arguments

object

Object.

genes

character. Gene identifiers.

reduction

vector(1). Dimension reduction name or index position.

expression

character(1). Calculation to apply. Uses match.arg() internally and defaults to the first argument in the character vector.

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

numeric(1). Point size for dots in the plot. In the range of 1-3 is generally recommended.

pointAlpha

numeric(1) (0-1). Alpha transparency level.

pointsAsNumbers

logical(1). Plot the points as numbers (TRUE) or dots (FALSE).

label

logical(1). Superimpose sample text labels on the plot.

labelSize

integer(1). Size of the text label.

dark

logical(1). Plot against a dark background using the acid_theme_light() ggplot2 theme.

legend

logical(1). Include plot legend.

title

character(1). Title.

...

Additional arguments.

Value

Show graphical output. Invisibly return a ggplot list.

Note

Updated 2019-08-02.

Examples

data( Seurat, cell_data_set, package = "acidtest" ) ## Seurat ==== object <- Seurat genes <- counts(object) %>% Matrix::rowSums(.) %>% sort(decreasing = TRUE) %>% head(n = 4L) %>% names() print(genes)
#> [1] "LYZ" "HLA-DRA" "CST3" "HLA-DPB1"
plotMarker( object = object, genes = genes, reduction = "UMAP" )
## cell_data_set ==== object = cell_data_set genes <- counts(object) %>% Matrix::rowSums(.) %>% sort(decreasing = TRUE) %>% head(n = 4L) %>% names() print(genes)
#> [1] "WBGene00006789" "WBGene00006436" "WBGene00001168" "WBGene00006754"
plotMarker( object = object, genes = genes, reduction = "UMAP" )