summariseExprsAcrossFeatures {scater} | R Documentation

## Summarise expression values across feature

### Description

Create a new `SingleCellExperiment` with counts summarised at a different feature level. A typical use would be to summarise transcript-level counts at gene level.

### Usage

    summariseExprsAcrossFeatures(object, exprs_values = "tpm",
      summarise_by = "feature_id", scaled_tpm_counts = TRUE, lib_size = NULL)

### Arguments

`object` | an `SingleCellExperiment` object.
`exprs_values` | character string indicating which slot of the assayData from the `SingleCellExperiment` object should be used as expression values. Valid options are `'counts'` the counts slot, `'tpm'` the transcripts-per-million slot or `'fpkm'` the FPKM slot.
`summarise_by` | character string giving the column of `rowData(object)` that will be used as the features for which summarised expression levels are to be produced. Default is `'feature_id'`.
`scaled_tpm_counts` | logical, should feature-summarised counts be computed from summed TPM values scaled by total library size? This approach is recommended (see https://f1000research.com/articles/4-1521/v2), so the default is `TRUE` and it is applied if TPM values are available in the object.
`lib_size` | optional vector of numeric values of same length as the number of columns in the `SingleCellExperiment` object providing the total library size (e.g. "count of mapped reads") for each cell/sample.

### Details

Only transcripts-per-million (TPM) and fragments per kilobase of exon per million reads mapped (FPKM) expression values should be aggregated across features. Since counts are not scaled by the length of the feature, expression in counts units are not comparable within a sample without adjusting for feature length. Thus, we cannot sum counts over a set of features to get the expression of that set (for example, we cannot sum counts over transcripts to get accurate expression estimates for a gene). See the following link for a discussion of RNA-seq expression units by Harold Pimentel: https://haroldpimentel.wordpress.com/2014/05/08/what-the-fpkm-a-review-rna-seq-expression-units/. For more details about the effects of summarising transcript expression values at the gene level see Sonesen et al, 2016 (https://f1000research.com/articles/4-1521/v2).

### Value

an SingleCellExperiment object

### Examples

    data("sc_example_counts")
    data("sc_example_cell_info")
    example_sce <- SingleCellExperiment(
    assays = list(counts = sc_example_counts), colData = sc_example_cell_info)
    rd <- data.frame(gene_id = rownames(example_sce),
    feature_id = paste("feature", rep(1:500, each = 4), sep = "_"))
    rownames(rd) <- rownames(example_sce)
    rowData(example_sce) <- rd
    effective_length <- rep(c(1000, 2000), times = 1000)
    tpm(example_sce) <- calculateTPM(example_sce, effective_length, calc_from = "counts")

    example_sceset_summarised <-
    summariseExprsAcrossFeatures(example_sce, exprs_values = "tpm")
    example_sceset_summarised <-
    summariseExprsAcrossFeatures(example_sce, exprs_values = "counts")

[Package scater version 1.6.3 Index]