View source: R/convertCounts.R
tpm.direct | R Documentation |
Takes a countsMatrix and geneLength as input and converts to TPM units using the equation from Harold Pimental.
tpm.direct(countsMatrix, geneLength, collapse = FALSE)
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. |
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.
A matrix of TPM values
dgeObj <- readRDS(system.file("exampleObj.RDS", package = "DGEobj")) counts <- DGEobj::getItem(dgeObj, "counts") exonLength <- dgeObj$geneData$ExonLength tpm <- tpm.direct(counts, geneLength = exonLength)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.