sumCountsAcrossCells {scater} | R Documentation |
Create a count matrix where counts for all cells in a set are summed together.
sumCountsAcrossCells(object, ids, exprs_values = "counts", BPPARAM = SerialParam())
object |
A SingleCellExperiment object or a count matrix. |
ids |
A factor specifying the set to which each cell in |
exprs_values |
A string or integer scalar specifying the assay of |
BPPARAM |
A BiocParallelParam object specifying how summation should be parallelized. |
This function provides a convenient method for aggregating counts across multiple columns for each feature. A typical application would be to sum counts across all cells in each cluster to obtain “pseudo-bulk” samples for further analysis.
Any NA
values in ids
are implicitly ignored and will not be considered or reported.
This may be useful, e.g., to remove undesirable cells by setting their entries in ids
to NA
.
A count matrix where counts for all cells in the same set are summed together for each feature.
Aaron Lun
data("sc_example_counts") data("sc_example_cell_info") example_sce <- SingleCellExperiment( assays = list(counts = sc_example_counts), colData = sc_example_cell_info) ids <- sample(LETTERS[1:5], ncol(example_sce), replace=TRUE) out <- sumCountsAcrossCells(example_sce, ids) dimnames(out)