### R code from vignette source 'vignettes/Rsubread/inst/doc/Rsubread.Rnw'

###################################################
### code chunk number 1: Rsubread.Rnw:51-55
###################################################
library(Rsubread)
ref <- system.file("extdata","reference.fa",package="Rsubread")
path <- system.file("extdata",package="Rsubread")
buildindex(basename=file.path(path,"reference_index"),reference=ref)


###################################################
### code chunk number 2: Rsubread.Rnw:75-77
###################################################
reads <- system.file("extdata","reads.txt",package="Rsubread")
align(index=file.path(path,"reference_index"),readfile1=reads,output_file=file.path(path,"alignResults.SAM"))


###################################################
### code chunk number 3: Rsubread.Rnw:108-112
###################################################
library(Rsubread)
reads <- system.file("extdata","reads.txt",package="Rsubread")
x <- qualityScores(filename=reads,nreads=1000)
boxplot(x)


###################################################
### code chunk number 4: Rsubread.Rnw:119-125
###################################################
library(Rsubread)
reads <- system.file("extdata","reads.txt",package="Rsubread")
## Fraction of A,T,G and C in the entire dataset
x <- atgcContent(filename=reads,basewise=FALSE)
## Fraction of A,T,G and C at each base location across all the reads
xb <- atgcContent(filename=reads,basewise=TRUE)


###################################################
### code chunk number 5: Rsubread.Rnw:133-136
###################################################
library(Rsubread)
results <- system.file("extdata","alignResults.SAM",package="Rsubread")
propmapped(results)


