plotMarker: Plot Cell-Type-Specific Gene Markers

Description Usage Arguments Value Plot top markers Author(s) See Also Examples

View source: R/deprecated.R

Description

Plot gene expression per cell in multiple formats:

  1. plotMarkerTSNE(): t-SNE gene expression plot.

  2. plotDot(): Dot plot.

  3. plotViolin(): Violin plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
plotKnownMarkersDetected(object, ...)

plotMarkerTSNE(object, ...)

plotMarkerUMAP(object, ...)

plotTopMarkers(object, ...)

## S4 method for signature 'SingleCellExperiment'
plotMarkerTSNE(object, genes,
  expression = c("mean", "median", "sum"), color = NULL,
  pointsAsNumbers = FALSE, pointSize = 0.75, pointAlpha = 0.8,
  label = TRUE, labelSize = 6L, dark = FALSE, grid = FALSE,
  legend = TRUE, aspectRatio = 1L, title = TRUE)

## S4 method for signature 'seurat'
plotMarkerTSNE(object, genes, expression = c("mean",
  "median", "sum"), color = NULL, pointsAsNumbers = FALSE,
  pointSize = 0.75, pointAlpha = 0.8, label = TRUE, labelSize = 6L,
  dark = FALSE, grid = FALSE, legend = TRUE, aspectRatio = 1L,
  title = TRUE)

## S4 method for signature 'SingleCellExperiment'
plotMarkerUMAP(object, genes,
  expression = c("mean", "median", "sum"), color = NULL,
  pointsAsNumbers = FALSE, pointSize = 0.75, pointAlpha = 0.8,
  label = TRUE, labelSize = 6L, dark = FALSE, grid = FALSE,
  legend = TRUE, aspectRatio = 1L, title = TRUE)

## S4 method for signature 'seurat'
plotMarkerUMAP(object, genes, expression = c("mean",
  "median", "sum"), color = NULL, pointsAsNumbers = FALSE,
  pointSize = 0.75, pointAlpha = 0.8, label = TRUE, labelSize = 6L,
  dark = FALSE, grid = FALSE, legend = TRUE, aspectRatio = 1L,
  title = TRUE)

## S4 method for signature 'SingleCellExperiment'
plotTopMarkers(object, markers,
  reduction = c("TSNE", "UMAP"), headerLevel = 2L, ...)

## S4 method for signature 'seurat'
plotTopMarkers(object, markers, reduction = c("TSNE",
  "UMAP"), headerLevel = 2L, ...)

## S4 method for signature 'SingleCellExperiment'
plotKnownMarkersDetected(object, markers,
  reduction = c("TSNE", "UMAP"), headerLevel = 2L, ...)

## S4 method for signature 'seurat'
plotKnownMarkersDetected(object, markers,
  reduction = c("TSNE", "UMAP"), headerLevel = 2L, ...)

Arguments

object

Object.

...

Additional arguments.

genes

Gene identifiers. Must match the rownames of the object.

expression

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

color

Desired ggplot color 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_color_manual().

pointsAsNumbers

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

pointSize

Cell point size.

pointAlpha

Alpha transparency level. Useful when there many cells in the dataset, and some cells can be masked.

label

Overlay a cluster identitiy label on the plot.

labelSize

Size of the text label.

dark

Plot against a dark background using basejump::theme_midnight().

grid

Show major grid lines but hide axis lines.

legend

Include plot legend.

aspectRatio

Aspect ratio.

title

Plot title.

markers

grouped_df of marker genes.

  • plotTopMarkers(): must be grouped by "cluster".

  • plotKnownMarkersDetected(): must be grouped by "cellType".

reduction

Dimensional reduction method to apply. Defaults to t-SNE ("TSNE") but UMAP is also supported ("UMAP").

headerLevel

R Markdown header level.

Value

Show graphical output. Invisibly return ggplot list.

Plot top markers

The number of markers to plot is determined by the output of the topMarkers() function. If you want to reduce the number of genes to plot, simply reassign first using that function. If necessary, we can add support for the number of genes to plot here in a future update.

Author(s)

Michael Steinbaugh, Rory Kirchner

See Also

Other Clustering Functions: cellTypesPerCluster, knownMarkersDetected, plotCellTypesPerCluster, plotFeatureTSNE, plotPCElbow, plotTSNE, sanitizeMarkers, topMarkers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
object <- seurat_small
title <- "mito genes"
genes <- grep("^MT-", rownames(object), value = TRUE)
print(genes)

# t-SNE
plotMarkerTSNE(
    object = object,
    genes = genes,
    title = title
)

# Dark mode
plotMarkerTSNE(
    object = object,
    genes = genes,
    dark = TRUE,
    title = title
)

# Number cloud
plotMarkerTSNE(
    object = object,
    genes = genes,
    pointsAsNumbers = TRUE,
    title = title
)

# UMAP
plotMarkerUMAP(
    object = object,
    genes = genes,
    title = title
)

# Top markers
markers <- topMarkers(all_markers_small, n = 1)
markers
plotTopMarkers(object, markers = tail(markers, 1))

# Known markers detected
markers <- head(known_markers_small, n = 1)
markers
plotKnownMarkersDetected(object, markers = head(markers, 1))

roryk/bcbioSinglecell documentation built on May 27, 2019, 10:44 p.m.