calculateTPM {scuttle} | R Documentation

## Calculate TPMs

### Description

Calculate transcripts-per-million (TPM) values for expression from feature-level counts.

### Usage

    calculateTPM(x, ...)

    ## S4 method for signature 'ANY'
    calculateTPM(x, lengths = NULL, ...)

    ## S4 method for signature 'SummarizedExperiment'
    calculateTPM(x, ..., assay.type = "counts", exprs_values = NULL)

    ## S4 method for signature 'SingleCellExperiment'
    calculateTPM(x, lengths = NULL, size.factors = NULL, ...)

### Arguments

`x` | A numeric matrix of counts where features are rows and cells are columns. Alternatively, a SummarizedExperiment or a SingleCellExperiment containing such counts.
`...` | For the generic, arguments to pass to specific methods. For the ANY method, further arguments to pass to `calculateCPM`. For the SummarizedExperiment method, further arguments to pass to the ANY method. For the SingleCellExperiment method, further arguments to pass to the SummarizedExperiment method.
`lengths` | Numeric vector providing the effective length for each feature in `x`. Alternatively `NULL`, see Details.
`assay.type` | A string specifying the assay of `x` containing the count matrix.
`exprs_values` | Soft-deprecated equivalents to the arguments above.
`size.factors` | A numeric vector containing size factors to adjust the library sizes. If `NULL`, the library sizes are used directly.

### Details

For read count data, this function assumes uniform coverage along the (effective) length of the transcript. Thus, the number of transcripts for a gene is proportional to the read count divided by the transcript length. Here, the division is done before calculation of the library size to compute per-million values, where `calculateFPKM` will only divide by the length after library size normalization.

For UMI count data, this function should be run with `lengths=NULL`, i.e., no division by the effective length. This is because the number of UMIs is a direct (albeit biased) estimate of the number of transcripts.

### Value

A numeric matrix of TPM values with the same dimensions as `x` (unless `subset.row` is specified).

### Author(s)

Aaron Lun, based on code by Davis McCarthy

### See Also

`calculateCPM`, on which this function is based.

### Examples

    example_sce <- mockSCE()
    eff_len <- runif(nrow(example_sce), 500, 2000)
    tout <- calculateTPM(example_sce, lengths = eff_len)
    str(tout)

[Package scuttle version 1.2.1 Index]