plotScater {scater} | R Documentation

## Plot an overview of expression for each cell

### Description

Plot the relative proportion of the library size that is accounted for by the most highly expressed features for each cell in a SingleCellExperiment object.

### Usage

    plotScater(x, nfeatures = 500, exprs_values = "counts",
      colour_by = NULL, by_exprs_values = exprs_values,
      by_show_single = FALSE, block1 = NULL, block2 = NULL, ncol = 3,
      line_width = 1.5, theme_size = 10)

### Arguments

`x` | A SingleCellExperiment object.
`nfeatures` | Numeric scalar indicating the number of top-expressed features to show n the plot.
`exprs_values` | String or integer scalar indicating which assay of `object` should be used to obtain the expression values for this plot.
`colour_by` | Specification of a column metadata field or a feature to colour by, see `?"scater-vis-var"` for possible values. The curve for each cell will be coloured according to this specification.
`by_exprs_values` | A string or integer scalar specifying which assay to obtain expression values from, for use in line colouring - see `?"scater-vis-var"` for details.
`by_show_single` | Logical scalar specifying whether single-level factors should be used for line colouring, see `?"scater-vis-var"` for details.
`block1` | Specification of a factor by which to separate the cells into blocks (separate panels) in the plot. This can be any type of value described in `?"scater-vis-var"` for column-level metadata. Default is `NULL`, in which case there is no blocking.
`block2` | Same as `block1`, providing another level of blocking.
`ncol` | Number of columns to use for `facet_wrap` if only one block is defined.
`line_width` | Numeric scalar specifying the line width.
`theme_size` | Numeric scalar specifying the font size to use for the plotting theme.

### Details

For each cell, the features are ordered from most-expressed to least-expressed. The cumulative proportion of the total expression for the cell is computed across the top `nfeatures` features. These plots can flag cells with a very high proportion of the library coming from a small number of features; such cells are likely to be problematic for downstream analyses.

Using the colour and blocking arguments can flag overall differences in cells under different experimental conditions or affected by different batch and other variables. If only one of `block1` and `block2` are specified, each panel corresponds to a separate level of the specified blocking factor. If both are specified, each panel corresponds to a combination of levels.

### Value

a ggplot plot object

### Author(s)

Davis McCarthy, with modifications by Aaron Lun

### Examples

    ## Set up an example SingleCellExperiment
    data("sc_example_counts")
    data("sc_example_cell_info")
    example_sce <- SingleCellExperiment(
        assays = list(counts = sc_example_counts),
        colData = sc_example_cell_info
    )

    plotScater(example_sce)
    plotScater(example_sce, exprs_values = "counts", colour_by = "Cell_Cycle")
    plotScater(example_sce, block1 = "Treatment", colour_by = "Cell_Cycle")

    cpm(example_sce) <- calculateCPM(example_sce, use_size_factors = FALSE)
    plotScater(example_sce, exprs_values = "cpm", block1 = "Treatment",
        block2 = "Mutation_Status", colour_by = "Cell_Cycle")

[Package scater version 1.12.2 Index]