In these exercises we will review some of the Rsubread packages functionality in alignment.
For these exercises we will be using some of the example data available from the BodyMap consortium.
We have already reviewed this data when looking at IGV in an earlier session.
The example data can be found in the data directory
library(Rsubread)
library(ShortRead)
library(ggplot2)
library(Rsamtools)
<- readFastq("data/heart.bodyMap.fq")
heartQ <- readFastq("data/liver.bodyMap.fq")
liverQ length(heartQ)
## [1] 132604
length(liverQ)
## [1] 48401
<- alphabetScore(quality(heartQ))
heartQualities <- alphabetScore(quality(liverQ))
LiverQualities <- data.frame(Sample="Heart",Qualities=heartQualities)
HFrame <- data.frame(Sample="Liver",Qualities=LiverQualities)
LFrame <- rbind(HFrame,LFrame)
toPlot ggplot(toPlot,aes(x=Sample,y=Qualities,fill=Sample))+geom_violin()+theme_minimal()
<- colSums(alphabetFrequency(sread(heartQ)))
myFreqHeart <- colSums(alphabetFrequency(sread(liverQ)))
myFreqLiver <- myFreqHeart[c("A","C","G","T","N")]
myFreqHeartFilt <- myFreqLiver[c("A","C","G","T","N")]
myFreqLiverFilt <- data.frame(Sample="Heart",Bases=names(myFreqHeartFilt),Frequency=myFreqHeartFilt)
myFreqHeartDF <- data.frame(Sample="Liver",Bases=names(myFreqLiverFilt),Frequency=myFreqLiverFilt)
myFreqLiverDF <- rbind(myFreqHeartDF,myFreqLiverDF)
toPlot ggplot(toPlot,aes(x=Bases,y=Frequency,fill=Bases))+geom_bar(stat="identity")+theme_minimal()+facet_grid(~Sample)
library(Rsubread)
library(BSgenome.Hsapiens.UCSC.hg38)
<- BSgenome.Hsapiens.UCSC.hg38[["chr12"]]
chr12hg38 <- DNAStringSet(list(chr12=chr12hg38))
chr12hg38Set writeXStringSet(chr12hg38Set,file="chr12.fa")
buildindex("chr12","chr12.fa")
<- c("data/heart.bodyMap.fq","data/liver.bodyMap.fq")
FileName <- c("data/heart.bodyMap.bam","data/liver.bodyMap.bam")
OutputName
subjunc("chr12",FileName,
output_format = "BAM",
output_file = OutputName)
sortBam("data/heart.bodyMap.bam","Heart")
sortBam("data/liver.bodyMap.bam","Liver")
indexBam("Heart.bam")
indexBam("Liver.bam")
quickBamFlagSummary("Heart.bam")
quickBamFlagSummary("Liver.bam")
[HINT: Check Gene SLC25A3]