Learn R Programming

Tmisc (version 1.0.1)

counts2fpkm: 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)

Value

A matrix of FPKM values.

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.

Examples

Run this code
if (FALSE) {
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)
}
  

Run the code above in your browser using DataLab