This function is a wrapper function around QFeatures::aggregateFeatures. It allows the user to provide multiple assays for which aggregateFeatures will be applied sequentially.

aggregateFeaturesOverAssays(object, i, fcol, name, fun, ...)

## Arguments

object

A QFeatures object

i

A numeric(1) or character(1) indicating which assay to transfer the colData to.

fcol

The feature variables for each assays i defining how to summarise the QFeatures. If fcol has length 1, the variable name is assumed to be the same for all assays

name

A character() naming the new assay. name must have the same length as i. Note that the function will fail if of the names in name is already present.

fun

A function used for quantitative feature aggregation.

...

Additional parameters passed the fun.

## Value

A QFeatures object

QFeatures::aggregateFeatures

## Examples

data("scp1")
scp1 <- aggregateFeaturesOverAssays(scp1,
i = 1:3,
fcol = "peptide",
name = paste0("peptides", 1:3),
fun = colMeans,
na.rm = TRUE)
#>
Aggregated: 1/3
#>
Aggregated: 2/3
#>
Aggregated: 3/3
scp1
#> An instance of class QFeatures containing 8 assays:
#>  [1] 190321S_LCA10_X_FP97AG: SingleCellExperiment with 166 rows and 11 columns
#>  [2] 190222S_LCA9_X_FP94BM: SingleCellExperiment with 176 rows and 11 columns
#>  [3] 190914S_LCB3_X_16plex_Set_21: SingleCellExperiment with 215 rows and 16 columns
#>  ...
#>  [6] peptides1: SingleCellExperiment with 164 rows and 11 columns
#>  [7] peptides2: SingleCellExperiment with 172 rows and 11 columns
#>  [8] peptides3: SingleCellExperiment with 214 rows and 16 columns