tpm.direct: Convert countsMatrix and geneLength to TPM units

Description Usage Arguments Details Value Examples

View source: R/convertCounts.R

Description

Takes a countsMatrix and geneLength as input and converts to TPM units using the equation from Harold Pimental.

Usage

1
tpm.direct(countsMatrix, geneLength, collapse = FALSE)

Arguments

countsMatrix

A numeric matrix of N genes x M samples. All columns must be numeric.

geneLength

Numeric matrix of gene lengths. Often the ExonLength item of a DGEobj.

collapse

Default = FALSE. TRUE or FALSE determines whether to use rowMeans on the geneLength matrix.

Details

The result should be the same as using convertCounts with normalize = 'tpm' and log = FALSE.

geneLength can be a vector (length == nrow(countsMatrix)) or a matrix (same dim as countsMatrix). The geneLength is used as is, or optionally collapsed to a vector by rowMeans.

Value

A matrix of TPM values

Examples

1
2
3
4
5
   dgeObj <- readRDS(system.file("exampleObj.RDS", package = "DGEobj"))

   counts <- DGEobj::getItem(dgeObj, "counts")
   exonLength <- dgeObj$geneData$ExonLength
   tpm <- tpm.direct(counts, geneLength = exonLength)

DGEobj.utils documentation built on April 28, 2021, 9:06 a.m.