Calculates relative contribution of each feature to each cell for given set of features.

MetaFeature(
  object,
  features,
  meta.name = "metafeature",
  cells = NULL,
  assay = NULL,
  slot = "data"
)

Arguments

object

A Seurat object

features

List of features to aggregate

meta.name

Name of column in metadata to store metafeature

cells

List of cells to use (default all cells)

assay

Which assay to use

slot

Which slot to take data from (default data)

Value

Returns a Seurat object with metafeature stored in objct metadata

Examples

data("pbmc_small")
pbmc_small <- MetaFeature(
  object = pbmc_small,
  features = c("LTB", "EAF2"),
  meta.name = 'var.aggregate'
)
head(pbmc_small[[]])
#>                   orig.ident nCount_RNA nFeature_RNA RNA_snn_res.0.8
#> ATGCCAGAACGACT SeuratProject         70           47               0
#> CATGGCCTGTGCAT SeuratProject         85           52               0
#> GAACCTGATGAACC SeuratProject         87           50               1
#> TGACTGGATTCTCA SeuratProject        127           56               0
#> AGTCAGACTGCACA SeuratProject        173           53               0
#> TCTGATACACGTGT SeuratProject         70           48               0
#>                letter.idents groups RNA_snn_res.1 var.aggregate
#> ATGCCAGAACGACT             A     g2             0    0.01322615
#> CATGGCCTGTGCAT             A     g1             0    0.01464857
#> GAACCTGATGAACC             B     g2             0    0.01558293
#> TGACTGGATTCTCA             A     g2             0    0.01512254
#> AGTCAGACTGCACA             A     g2             0    0.01125977
#> TCTGATACACGTGT             A     g1             0    0.01385247