In this practical we will be reviewing some of methods in the GViz package to plot genomics data. In the belows sections we review axis creation, simple data plotting and visualization of annotation and gene models.
In todays session we will continue to review the Myc ChIPseq we were working on in our last sessions.
This include Myc ChIP-seq for MEL and Ch12 celllines.
Information and files for the Myc ChIPseq in MEL cell line can be found here
Information and files for the Myc ChIPseq in Ch12 cell line can be found here
Preprocessed data for this practical session can be found in the Data directory.
For later exercises we will be using data from Activated and naive T-regulatory cells from Christina Leslie’s lab.
Naive Treg cell data information can be found here and the Bam file found here
Activated Treg cell data information can be found here and the Bam file found here
suppressPackageStartupMessages(library(Gviz))
library(Gviz)
GenomeAxisTrack()
myAxisTrack <-plotTracks(myAxisTrack,from=100000,to=1000000)
plotTracks(myAxisTrack,from=100000,to=1000000,scale=450000)
plotTracks(myAxisTrack,from=100000,to=1000000,
add53=T,
littleTicks=T)
*Load in the peak data and plot peaks for both samples over the region chr2:135,522,235-135,531,066
library(rtracklayer)
import.bed("data/myc_mel.bed")
myc_melPeaks <- DataTrack(myc_melPeaks,chromosome="chr2",
mycmelpeaksDT <-from=135522235,
to=135531066,
name="Mel_peaks",
type="b")
import.bed("data/myc_ch12.bed")
myc_ch12Peaks <- DataTrack(myc_ch12Peaks,chromosome="chr2",
mycch12peaksDT <-from=135522235,
to=135531066,
name="ch12_peaks",
type="b")
plotTracks(c(mycmelpeaksDT,mycch12peaksDT),
chromosome="chr2",
from=135522235,
to=135531066,
type="b",pch=15,cex=2)
library(rtracklayer)
import.bw("data/myc_mel.bw",as="GRanges")
myc_melSignal <- DataTrack(myc_melSignal,chromosome="chr2",
mycmelsigDT <-from=135522235,
to=135531066,
name="Mel_Coverage",
type=("hist"))
import.bw("data/myc_ch12.bw",as="GRanges")
myc_ch12Signal <- DataTrack(myc_ch12Signal,chromosome="chr2",
mycch12sigDT <-from=135522235,
to=135531066,
name="CH12_Coverage",
type=("hist"))
plotTracks(c(mycmelsigDT,mycch12sigDT),
chromosome="chr2",
from=135522235,
to=135531066,
ylim=c(0,40),
type=("hist"))
plotTracks(c(mycmelpeaksDT,mycmelsigDT,mycch12peaksDT,mycch12sigDT),
chromosome="chr2",
from=135522235,
to=135531066,
ylim=c(0,40),cex=2)
GenomeAxisTrack()
myAxisTrack <-
plotTracks(c(myAxisTrack,mycmelpeaksDT,mycmelsigDT,mycch12peaksDT,mycch12sigDT),
chromosome="chr2",
from=135522235,
to=135531066,
ylim=c(0,40),cex=1,scale=0.5)
suppressPackageStartupMessages(library(GenomicRanges))
suppressPackageStartupMessages(library(Gviz))
library(GenomicRanges)
library(Gviz)
GRanges(seqnames=c("chr1"),IRanges(
regions <-start=c(10,80,110),end=c(50,90,220)))
names(regions) <- c("1","2","3")
strand(regions) <- c("+","*","+")
AnnotationTrack(regions,
annoT <-group = c("Ann1",
"Ann2",
"Ann1"))
plotTracks(annoT,groupAnnotation="group")
plotTracks(annoT,groupAnnotation="group",stacking="dense",col="red",fill="red")
suppressPackageStartupMessages(library(TxDb.Mmusculus.UCSC.mm9.knownGene))
library(TxDb.Mmusculus.UCSC.mm9.knownGene)
GeneRegionTrack(TxDb.Mmusculus.UCSC.mm9.knownGene,
gtTrack <-chromosome="chr16",
start=16858904,
end=16895526)
plotTracks(gtTrack,transcriptAnnotation="name")
plotTracks(gtTrack,collapseTranscripts="meta",
transcriptAnnotation="name")
You will need to run this command at beginning of script to avoid issues with chromosomes names. It will tell you this in warning
options(ucscChromosomeNames=FALSE)
library(Rsamtools)
library(GenomicAlignments)
library(TxDb.Mmusculus.UCSC.mm10.knownGene)
library(org.Mm.eg.db)
genes(TxDb.Mmusculus.UCSC.mm10.knownGene)
myGenes <- select(org.Mm.eg.db,keys="Ccnd3",columns = "ENTREZID",keytype = "SYMBOL")
ccdn3AsEntrez <- myGenes[myGenes$gene_id %in% ccdn3AsEntrez$ENTREZID]
ccdn3Pos <-start(ccdn3Pos) <- start(ccdn3Pos)-1000
end(ccdn3Pos) <- end(ccdn3Pos)+1000
indexBam("ENCFF726OCP.bam")
indexBam("ENCFF906UTB.bam")
readGAlignments("ENCFF726OCP.bam",param=ScanBamParam(which = ccdn3Pos))
activatedReads <- readGAlignments("ENCFF906UTB.bam",param=ScanBamParam(which = ccdn3Pos))
naiveReads <-
coverage(naiveReads)
naiveCov <- coverage(activatedReads)
actCov <-
GRanges(naiveCov)
naiveCov <- GRanges(actCov) actCov <-
library(Gviz)
DataTrack(naiveCov,chromosome=as.vector(seqnames(ccdn3Pos)),
naivePlot <-from=start(ccdn3Pos),
to=end(ccdn3Pos),
name="naive",
type=("hist"))
DataTrack(actCov,chromosome=as.vector(seqnames(ccdn3Pos)),
actPlot <-from=start(ccdn3Pos),
to=end(ccdn3Pos),
name="activated",
type=("hist"))
GeneRegionTrack(TxDb.Mmusculus.UCSC.mm10.knownGene,
gtTrack <-chromosome=as.vector(seqnames(ccdn3Pos)),
from=start(ccdn3Pos),
to=end(ccdn3Pos))
plotTracks(c(naivePlot,actPlot,gtTrack),
chromosome=as.vector(seqnames(ccdn3Pos)),
from=start(ccdn3Pos),
to=end(ccdn3Pos),
type=("hist"),
transcriptAnnotation="Name")