plotColData {scater}R Documentation

Plot column metadata

Description

Plot column-level (i.e., cell) metadata in an SingleCellExperiment object.

Usage

plotColData(object, y, x = NULL, colour_by = NULL, shape_by = NULL,
  size_by = NULL, by_exprs_values = "logcounts",
  by_show_single = FALSE, ...)

plotPhenoData(...)

plotCellData(...)

Arguments

object

A SingleCellExperiment object containing expression values and experimental information.

y

Specification of the column-level metadata to show on the y-axis, see ?"scater-vis-var" for possible values. Note that only metadata fields will be searched, assays will not be used.

x

Specification of the column-level metadata to show on the x-axis, see ?"scater-vis-var" for possible values. Again, only metadata fields will be searched, assays will not be used.

colour_by

Specification of a column metadata field or a feature to colour 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.

size_by

Specification of a column metadata field or a feature to size 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.

...

Additional arguments for visualization, see ?"scater-plot-args" for details.

Details

If y is continuous and x=NULL, a violin plot is generated. If x is categorical, a grouped violin plot will be generated, with one violin for each level of x. If x is continuous, a scatter plot will be generated.

If y is categorical and x is continuous, horizontal violin plots will be generated. If x is missing or categorical, rectangule plots will be generated where the area of a rectangle is proportional to the number of points for a combination of factors.

Note that plotPhenoData and plotCellData are synonyms for plotColData. These are artifacts of the transition from the old SCESet class, and will be deprecated in future releases.

Value

A ggplot object.

Author(s)

Davis McCarthy, with modifications by Aaron Lun

Examples

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 <- calculateQCMetrics(example_sce)
example_sce <- normalize(example_sce)

plotColData(example_sce, y = "total_features_by_counts", 
   x = "log10_total_counts", colour_by = "Mutation_Status")

plotColData(example_sce, y = "total_features_by_counts", 
   x = "log10_total_counts", colour_by = "Mutation_Status",
   size_by = "Gene_0001", shape_by = "Treatment")

plotColData(example_sce, y = "Treatment", 
   x = "log10_total_counts", colour_by = "Mutation_Status")

plotColData(example_sce, y = "total_features_by_counts", 
   x = "Cell_Cycle", colour_by = "Mutation_Status")


[Package scater version 1.10.1 Index]