counts2fpkm: Fragments per kilobase per million

View source: R/geneexpression.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

## Not run: 
library(readr)
library(dplyr)
countdata <- read_csv("http://files.figshare.com/2439061/GSE37704_featurecounts.csv") 
counts <- countdata %>% select(countdata, starts_with("SRR")) %>% as.matrix
counts2fpkm(counts, countdata$length)

## End(Not run)
  

Tmisc documentation built on Aug. 23, 2023, 1:07 a.m.