AverageExpression: Averaged feature expression by identity class

View source: R/utilities.R

AverageExpressionR Documentation

Averaged feature expression by identity class

Description

Returns averaged expression values for each identity class.

Usage

AverageExpression(
  object,
  assays = NULL,
  features = NULL,
  return.seurat = FALSE,
  group.by = "ident",
  add.ident = NULL,
  layer = "data",
  slot = deprecated(),
  verbose = TRUE,
  ...
)

Arguments

object

Seurat object

assays

Which assays to use. Default is all assays

features

Features to analyze. Default is all features in the assay

return.seurat

Whether to return the data as a Seurat object. Default is FALSE

group.by

Category (or vector of categories) for grouping (e.g, ident, replicate, celltype); 'ident' by default To use multiple categories, specify a vector, such as c('ident', 'replicate', 'celltype')

add.ident

(Deprecated). Place an additional label on each cell prior to pseudobulking

layer

Layer(s) to use; if multiple layers are given, assumed to follow the order of 'assays' (if specified) or object's assays

slot

(Deprecated). Slots(s) to use

verbose

Print messages and show progress bar

...

Arguments to be passed to methods such as CreateSeuratObject

Details

If layer is set to 'data', this function assumes that the data has been log normalized and therefore feature values are exponentiated prior to averaging so that averaging is done in non-log space. Otherwise, if layer is set to either 'counts' or 'scale.data', no exponentiation is performed prior to averaging. If return.seurat = TRUE and layer is not 'scale.data', averaged values are placed in the 'counts' layer of the returned object and 'log1p' is run on the averaged counts and placed in the 'data' layer ScaleData is then run on the default assay before returning the object. If return.seurat = TRUE and layer is 'scale.data', the 'counts' layer contains average counts and 'scale.data' is set to the averaged values of 'scale.data'.

Value

Returns a matrix with genes as rows, identity classes as columns. If return.seurat is TRUE, returns an object of class Seurat.

Examples

data("pbmc_small")
head(AverageExpression(object = pbmc_small)$RNA)
head(AverageExpression(object = pbmc_small, group.by = c('ident', 'groups'))$RNA)


Seurat documentation built on May 29, 2024, 4:20 a.m.