Skip to content
Convert Counts to Fragments per Kilobase of Transcript per Million (FPKM)
Branch: master
Clone or download
Latest commit 76fdfb1 Apr 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Add files via upload Mar 30, 2019
inst/extdata Add files via upload Mar 30, 2019
man Update fpkmheatmap.Rd Apr 10, 2019
.Rbuildignore initial commit Mar 23, 2019
.gitignore
.travis.yml
DESCRIPTION Update DESCRIPTION Apr 9, 2019
LICENSE
NAMESPACE
README.md Update README.md Apr 10, 2019
countToFPKM.Rproj Add files via upload Apr 9, 2019

README.md

countToFPKM

Build Status CRAN_Status_Badge CRAN_Downloads_Badge Rdoc

Overview

The 'countToFPKM' package provides a robust function to convert the feature counts of paired-end RNA-Seq into FPKM normalised values by library size and feature effective length. Implements the algorithm described in Trapnell,C. et al. (2010). This package includes two functions:

  • fpkm()
  • fpkmheatmap()

The fpkm() function converts the feature counts into FPKM values, it requires three arguments to return FPKM as numeric matrix normalized by library size and feature length:

  • counts a numeric matrix of raw feature counts.
  • featureLength a numeric vector with feature lengths that can be obtained using
    biomaRt package.
  • meanFragmentLength a numeric vector with mean fragment lengths, which can be calculated using the
    CollectInsertSizeMetrics(Picard) tool.

The fpkmheatmap() function provides users with a robust method to generate a FPKM heatmap plot of the highly variable features in RNA-Seq dataset. It takes an FPKM numeric matrix which can be obtained using fpkm() function as input. By default using Pearson correlation - 1 to measure the distance between features, and Spearman correlation -1 for clustering of samples. By default log10 transformation of (FPKM+1) is applied to make variation similar across orders of magnitude. It uses the var() function to identify the highly variable features. It then uses Heatmap() function from the 'ComplexHeatmap' package to generate a heatmap plot.

Installation

## Install dependances
source("http://bioconductor.org/biocLite.R")
biocLite("ComplexHeatmap")

## Install countToFPKM from CRAN
install.packages("countToFPKM")

## Alternatively, install countToFPKM from GitHub
if(!require(devtools)) install.packages("devtools")
devtools::install_github("AAlhendi1707/countToFPKM")

Usage example

library(countToFPKM)

file.readcounts <- system.file("extdata", "RNA-seq.read.counts.csv", package="countToFPKM")
file.annotations <- system.file("extdata", "Biomart.annotations.hg38.txt", package="countToFPKM")
file.sample.metrics <- system.file("extdata", "RNA-seq.samples.metrics.txt", package="countToFPKM")

# Import the read count matrix data into R.
counts <- as.matrix(read.csv(file.readcounts))

# Import feature annotations. 
# Assign feature lenght into a numeric vector.
gene.annotations <- read.table(file.annotations, sep="\t", header=TRUE)
featureLength <- gene.annotations$length

# Import sample metrics. 
# Assign mean fragment length into a numeric vector.
samples.metrics <- read.table(file.sample.metrics, sep="\t", header=TRUE)
meanFragmentLength <- samples.metrics$meanFragmentLength

# Return FPKM into a numeric matrix.
fpkm_matrix <- fpkm (counts, featureLength, meanFragmentLength)

# Plot log10(FPKM+1) heatmap of top 30 highly variable features
fpkmheatmap(fpkm_matrix, topvar=30, showfeaturenames=TRUE, return_log = TRUE)

Contributing

Please submit an issue to report bugs or ask questions.

Please contribute bug fixes or new features with a pull request to this repository.

You can’t perform that action at this time.