easyRNASeq correction methods {easyRNASeq} | R Documentation

## easyRNASeq count table correction to RPKM

### Description

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

### Usage

    ## S4 method for signature '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

### Details

RPKM accepts two sets of arguments:

- RNAseq,character the ... are additional arguments to be passed to the `readCounts` method.

- matrix,named vectornormalize a count matrix by providing the feature sizes (e.g. gene sizes) as a named vector where the names match the row names of the count matrix and the lib sizes as a named vector where the names match the column names of the count matrix.

### Value

A `matrix` containing RPKM corrected read counts.

### Author(s)

Nicolas Delhomme

### See Also

`readCounts`

### Examples

    	## Not run:
    	## 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))

    ## End(Not run)

[Package easyRNASeq version 2.24.1 Index]