counts2fpkm: Fragments per kilobase per million

View source: R/stats.R

counts2fpkmR Documentation

Fragments per kilobase per million

Description

Takes a count matrix and a vector of gene lengths and returns an optionally log2-transformed FPKM matrix. Modified from edgeR.

Usage

counts2fpkm(x, length, log = FALSE, prior.count = 0.25)

Arguments

x

a matrix of counts.

length

a vector of length nrow(x) giving length in bases.

log

logical, if TRUE, then log2 values are returned.

prior.count

average count to be added to each observation to avoid taking log of zero. Used only if log=TRUE.

Value

A matrix of FPKM values.

Examples

set.seed(123)
genecounts <- matrix(sample(c(rep(0, 50), 1:100), 30), nrow=10)
lengths <- sample(1000:10000, 10)
counts2fpkm(genecounts, lengths)
  

stephenturner/Tmisc documentation built on April 21, 2024, 8:31 a.m.