plotPlatePosition {scater}R Documentation

Plot cells in plate positions

Description

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

Usage

plotPlatePosition(object, plate_position = NULL, colour_by = NULL,
  size_by = NULL, shape_by = NULL, by_exprs_values = "logcounts",
  by_show_single = FALSE, add_legend = TRUE, theme_size = 24,
  point_alpha = 0.6, point_size = 24)

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 ?"scater-vis-var" for possible values.

size_by

Specification of a column metadata field or a feature to size by, see ?"scater-vis-var" for possible values.

shape_by

Specification of a column metadata field or a feature to shape by, see ?"scater-vis-var" 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 ?"scater-vis-var" for details.

by_show_single

Logical scalar specifying whether single-level factors should be used for point aesthetics, see ?"scater-vis-var" for details.

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.

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

## prepare data
data("sc_example_counts")
data("sc_example_cell_info")
example_sce <- SingleCellExperiment(
    assays = list(counts = sc_example_counts),
    colData = sc_example_cell_info
)
example_sce <- normalize(example_sce)
example_sce <- calculateQCMetrics(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")


[Package scater version 1.12.2 Index]