## 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