Learn R Programming

easyRNASeq (version 2.8.2)

easyRNASeq correction methods: easyRNASeq count table correction to RPKM

Description

Convert a count table obtained from the easyRNASeq function into an RPKM corrected count table.

Usage

## S3 method for class 'matrix,ANY,vector,vector':
RPKM(obj, from = c("exons", "features",
  "transcripts", "bestExons", "geneModels", "islands"), lib.size = numeric(1),
  feature.size = integer(1), simplify = TRUE, ...)

Arguments

obj
An object of class RNAseq or a matrix, see details
from
Determine the kind of coverage to use, choice limited to: exons, features, transcripts, bestExons, geneModels or islands.
lib.size
Precise the library size. It should be a named numeric list, i.e. named after the sample names.
feature.size
Precise the feature (e.g. exons, genes) sizes. It should be a named numeric list, named after the feature names.
simplify
If set to TRUE, whenever a feature (exon, feature, ...) is duplicated in the count table, it is only returned once.
...
additional arguments. See details

Value

  • A matrix containing RPKM corrected read counts.

item

matrix,named vector

Details

RPKM accepts two sets of arguments:
  • RNAseq,character
{ the ...} are additional arguments to be passed to the readCounts method.

See Also

readCounts

Examples

Run this code
## get an RNAseq object
	rnaSeq <- easyRNASeq(filesDirectory=
		    			system.file(
					"extdata",
					package="RnaSeqTutorial"),
					pattern="[A,C,T,G]{6}\\.bam$",
				format="bam",
				readLength=36L,
				organism="Dmelanogaster",
				chr.sizes=as.list(seqlengths(Dmelanogaster)),
				annotationMethod="rda",
				annotationFile=system.file(
				                            "data",
							    "gAnnot.rda",
							    package="RnaSeqTutorial"),
				count="exons",
				outputFormat="RNAseq")

	## get the RPKM
	rpkm <- RPKM(rnaSeq,from="exons")
	
	## the same from a count table
	count.table <- readCounts(rnaSeq,count="exons")

	## get the RPKM
	## verify that the feature are sorted as the count.table
	all(.getName(rnaSeq,"exon") == rownames(count.table))
	feature.size <- unlist(width(ranges(rnaSeq)))

	## verify that the samples are ordered in the same way
	all(names(librarySize(rnaSeq)) == colnames(count.table))

	## get the RPKM
	rpkm <- RPKM(count.table,
			feature.size=feature.size,
			lib.size=librarySize(rnaSeq))

Run the code above in your browser using DataLab