plotPlatePosition: Plot cells in plate positions

Description Usage Arguments Details Value Author(s) Examples

View source: R/plotPlatePosition.R

Description

Plots cells in their position on a plate, coloured by metadata variables or feature expression values from a SingleCellExperiment object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotPlatePosition(
  object,
  plate_position = NULL,
  colour_by = NULL,
  size_by = NULL,
  shape_by = NULL,
  by_exprs_values = "logcounts",
  add_legend = TRUE,
  theme_size = 24,
  point_alpha = 0.6,
  point_size = 24,
  other_fields = list(),
  swap_rownames = NULL
)

Arguments

object

A SingleCellExperiment object.

plate_position

A character vector specifying the plate position for each cell (e.g., A01, B12, and so on, where letter indicates row and number indicates column). If NULL, the function will attempt to extract this from object$plate_position. Alternatively, a list of two factors ("row" and "column") can be supplied, specifying the row (capital letters) and column (integer) for each cell in object.

colour_by

Specification of a column metadata field or a feature to colour by, see the by argument in ?retrieveCellInfo for possible values.

size_by

Specification of a column metadata field or a feature to size by, see the by argument in ?retrieveCellInfo for possible values.

shape_by

Specification of a column metadata field or a feature to shape by, see the by argument in ?retrieveCellInfo for possible values.

by_exprs_values

A string or integer scalar specifying which assay to obtain expression values from, for use in point aesthetics - see the exprs_values argument in ?retrieveCellInfo.

add_legend

Logical scalar specifying whether a legend should be shown.

theme_size

Numeric scalar, see ?"scater-plot-args" for details.

point_alpha

Numeric scalar specifying the transparency of the points, see ?"scater-plot-args" for details.

point_size

Numeric scalar specifying the size of the points, see ?"scater-plot-args" for details.

other_fields

Additional cell-based fields to include in the data.frame, see ?"scater-plot-args" for details.

swap_rownames

Column name of rowData(object) to be used to identify features instead of rownames(object) when labelling plot elements.

Details

This function expects plate positions to be given in a charcter format where a letter indicates the row on the plate and a numeric value indicates the column. Each cell has a plate position such as "A01", "B12", "K24" and so on. From these plate positions, the row is extracted as the letter, and the column as the numeric part. Alternatively, the row and column identities can be directly supplied by setting plate_position as a list of two factors.

Value

A ggplot object.

Author(s)

Davis McCarthy, with modifications by Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)

## define plate positions
example_sce$plate_position <- paste0(
    rep(LETTERS[1:5], each = 8), 
    rep(formatC(1:8, width = 2, flag = "0"), 5)
)

## plot plate positions
plotPlatePosition(example_sce, colour_by = "Mutation_Status")

plotPlatePosition(example_sce, shape_by = "Treatment", 
    colour_by = "Gene_0004")

plotPlatePosition(example_sce, shape_by = "Treatment", size_by = "Gene_0001",
    colour_by = "Cell_Cycle")

scater documentation built on Feb. 28, 2021, 2:01 a.m.