Features are min-max normalized per feature, and the range of each feature is annotated per facet to consolidate multiple features into one color scale.

plot_reduced_dimensions(
  sce_list,
  type,
  features,
  label = NULL,
  shape = NULL,
  alpha = 1,
  point_size = 0.05,
  text_size = 3,
  lower_quantile = 0,
  upper_quantile = 1,
  min_value = NULL,
  facet_rows = c(),
  facet_columns = c(),
  facet_type = "grid",
  assay = "logcounts",
  alt_exp = NULL,
  ...
)

Arguments

sce_list

list of SingleCellExperiment objects to plot

type

name of reducedDim attribute to plot

features

features to plot - can be from reducedDims, colData, or assay data, but note that all must be either numeric or categorical for one plot

label

feature to add text for annotation

shape

feature to shape points by

alpha

alpha for points

point_size

size of points

text_size

size of font for text annotation

lower_quantile

quantile which should be used to determine the lower limit of the color bar

upper_quantile

quantile which should be used to determine the upper limit of the color bar

min_value

minimum feature value, below which to set to this value

facet_rows

variables from colData to facet on, can also include ".sample" or ".feature" as described below

facet_columns

variables from colData to facet on, can also include ".sample" or ".feature" as described below

facet_type

either "wrap" or "grid", same as ggplot

assay

assay to obtain data from (ex: counts, logcounts)

alt_exp

alternate experiment to obtain data from

...

other params passed into either facet_wrap or facet_grid, depending on facet_type parameter

Value

ggplot object

Details

If multiple SingleCellExperiments are provided in the sce_list, and you want to facet by this, you can add ".sample" to one of the faceting variables, as this is implicitly added into the data frame being plotted.

In almost all cases, you would want to facet by feature, so be sure to also include ".feature" in either facet_columns or facet_rows

Examples

library(scanalysis) sce = scater::mockSCE() %>% scater::logNormCounts() %>% scater::runPCA() plot_reduced_dimensions(sce_list = list(sample_1 = sce, sample_2 = sce), features = c("Gene_0001", "Gene_0002", "Gene_0003"), facet_columns = ".sample", facet_rows = ".feature", switch = "y")
#> Error in data.frame(dim1 = reducedDims(sce)@listData[[type]][, 1], dim2 = reducedDims(sce)@listData[[type]][, 2]): argument "type" is missing, with no default