plotPlatePosition {scater} | R Documentation

## Plot cells in plate positions

### Description

Plots cells in their position on a plate, coloured by phenotype data or feature expression.

### Usage

    plotPlatePosition(object, plate_position = NULL, colour_by = NULL,
      x_position = NULL, y_position = NULL, exprs_values = "logcounts",
      theme_size = 24, legend = "auto")

### Arguments

`object` | an `SingleCellExperiment` object. If `object$plate_position` is not `NULL`, then this will be used to define each cell's position on the plate, unless the `plate_position` argument is specified.
`plate_position` | optional character vector providing a position on the plate for each cell (e.g. A01, B12, etc, where letter indicates row and number indicates column). Specifying this argument overrides any plate position information extracted from the SingleCellExperiment object.
`colour_by` | character string defining the column of `pData(object)` to be used as a factor by which to colour the points in the plot. Alternatively, a data frame with one column containing values to map to colours for all cells.
`x_position` | numeric vector providing x-axis positions for the cells (ignored if `plate_position` is not `NULL`)
`y_position` | numeric vector providing y-axis positions for the cells (ignored if `plate_position` is not `NULL`)
`exprs_values` | a string specifying the expression values to use for colouring the points, if `colour_by` is set as a feature name.
`theme_size` | numeric scalar giving default font size for plotting theme (default is 10).
`legend` | character, specifying how the legend(s) be shown? Default is `"auto"`, which hides legends that have only one level and shows others. Alternatives are "all" (show all legends) or "none" (hide all legends).

### 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. So 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. If `object$plate_position` or the `plate_position` argument are used to define plate positions, then positions should be provided in this format. Alternatively, numeric values to be used as x- and y-coordinates by supplying both the `x_position` and `y_position` arguments to the function.

### Value

A ggplot object.

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

    ## Must have exprs slot defined in object
    plotPlatePosition(example_sce, colour_by = "Gene_0004")

[Package scater version 1.6.3 Index]