calculateTPM | R Documentation |
Calculate transcripts-per-million (TPM) values for expression from feature-level counts.
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, ...)
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 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 |
assay.type |
A string specifying the assay of |
exprs_values |
Soft-deprecated equivalents to the arguments above. |
size.factors |
A numeric vector containing size factors to adjust the library sizes.
If |
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.
A numeric matrix of TPM values with the same dimensions as x
(unless subset.row
is specified).
Aaron Lun, based on code by Davis McCarthy
calculateCPM
, on which this function is based.
example_sce <- mockSCE()
eff_len <- runif(nrow(example_sce), 500, 2000)
tout <- calculateTPM(example_sce, lengths = eff_len)
str(tout)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.