aggregateAcrossFeatures: Aggregate feature sets in a SummarizedExperiment

View source: R/aggregateAcrossFeatures.R

aggregateAcrossFeaturesR Documentation

Aggregate feature sets in a SummarizedExperiment

Description

Sum together expression values (by default, counts) for each feature set in each cell of a SummarizedExperiment object.

Usage

aggregateAcrossFeatures(
  x,
  ids,
  ...,
  use.assay.type = "counts",
  use_exprs_values = NULL
)

Arguments

x

A SummarizedExperiment containing an expression matrix.

ids

A factor of length nrow(x), specifying the set to which each feature in x belongs.

Alternatively, a list of integer or character vectors, where each vector specifies the indices or names of features in a set. Logical vectors are also supported.

...

Further arguments to be passed to sumCountsAcrossFeatures.

use.assay.type

A character or integer vector specifying the assay(s) of x containing expression matrices.

use_exprs_values

Soft-deprecated equivalent of use.assay.type.

Value

A SummarizedExperiment of the same class as x is returned, containing summed matrices generated by sumCountsAcrossFeatures on all assays in use.assay.type.

If ids is a factor, row metadata is retained for the first instance of a feature from each set in ids. This behavior assumes that ids specifies duplicates of the same gene, such that the first instance is a reasonable choice.

If ids is a list, row metadata is simply discarded. This behavior assumes that ids specifies gene sets such that any existing gene-level metadata is meaningless.

Author(s)

Aaron Lun

See Also

sumCountsAcrossFeatures, which does the heavy lifting.

Examples

example_sce <- mockSCE()
ids <- sample(LETTERS, nrow(example_sce), replace=TRUE)
aggr <- aggregateAcrossFeatures(example_sce, ids)
aggr


LTLA/scuttle documentation built on March 9, 2024, 11:16 a.m.