Learn R Programming

scater (version 1.0.4)

calculateTPM: Calculate transcripts-per-million (TPM)

Description

Calculate transcripts-per-million (TPM) values for expression from counts for a set of features.

Usage

calculateTPM(object, effective_length = NULL, calc_from = "counts")

Arguments

object
an SCESet object
effective_length
vector of class "numeric" providing the effective length for each feature in the SCESet object
calc_from
character string indicating whether to compute TPM from "counts", "norm_counts", "fpkm" or "norm_fpkm". Default is to use "counts", in which case the effective_length argument must be supplied.

Value

Matrix of TPM values.

Examples

Run this code
data("sc_example_counts")
data("sc_example_cell_info")
pd <- new("AnnotatedDataFrame", data = sc_example_cell_info)
example_sceset <- newSCESet(countData = sc_example_counts, phenoData = pd)
effective_length <- rep(1000, 2000)
tpm(example_sceset) <- calculateTPM(example_sceset, effective_length, 
    calc_from = "counts")
    
## calculate from FPKM
fpkm(example_sceset) <- calculateFPKM(example_sceset, effective_length)
tpm(example_sceset) <- calculateTPM(example_sceset, effective_length, 
                                    calc_from = "fpkm")

Run the code above in your browser using DataLab