#if (interactive()){
## example 1: annotate myPeakList by TxDb or EnsDb.
data(myPeakList)
library(EnsDb.Hsapiens.v75)
annoData <- annoGR(EnsDb.Hsapiens.v75)
annotatePeak = annotatePeakInBatch(myPeakList[1:6], AnnotationData=annoData)
annotatePeak
## example 2: annotate myPeakList (GRanges)
## with TSS.human.NCBI36 (Granges)
data(TSS.human.NCBI36)
annotatedPeak = annotatePeakInBatch(myPeakList[1:6],
AnnotationData=TSS.human.NCBI36)
annotatedPeak
## example 3: you have a list of transcription factor biding sites from
## literature and are interested in determining the extent of the overlap
## to the list of peaks from your experiment. Prior calling the function
## annotatePeakInBatch, need to represent both dataset as RangedData
## where start is the start of the binding site, end is the end of the
## binding site, names is the name of the binding site, space and strand
## are the chromosome name and strand where the binding site is located.
myexp <- GRanges(seqnames=c(6,6,6,6,5,4,4),
IRanges(start=c(1543200,1557200,1563000,1569800,
167889600,100,1000),
end=c(1555199,1560599,1565199,1573799,
167893599,200,1200),
names=c("p1","p2","p3","p4","p5","p6", "p7")),
strand="+")
literature <- GRanges(seqnames=c(6,6,6,6,5,4,4),
IRanges(start=c(1549800,1554400,1565000,1569400,
167888600,120,800),
end=c(1550599,1560799,1565399,1571199,
167888999,140,1400),
names=c("f1","f2","f3","f4","f5","f6","f7")),
strand=rep(c("+", "-"), c(5, 2)))
annotatedPeak1 <- annotatePeakInBatch(myexp,
AnnotationData=literature)
pie(table(annotatedPeak1$insideFeature))
annotatedPeak1
### use toGRanges or rtracklayer::import to convert BED or GFF format
### to GRanges before calling annotatePeakInBatch
test.bed <- data.frame(space=c("4", "6"),
start=c("100", "1000"),
end=c("200", "1100"),
name=c("peak1", "peak2"))
test.GR = toGRanges(test.bed)
annotatePeakInBatch(test.GR, AnnotationData = literature)
#}
Run the code above in your browser using DataLab