16
|
1 require("ChIPseeker", quietly = TRUE)
|
|
2 require("ChIPpeakAnno", quietly = TRUE)
|
|
3 require("EnsDb.Hsapiens.v75", quietly = TRUE)
|
|
4 require("GenomicRanges", quietly = TRUE)
|
|
5
|
12
|
6 options(warn = -1)
|
|
7 args <- commandArgs(trailingOnly = TRUE)
|
|
8 DMR = args[1]
|
|
9 annoPeakTable = args[2]
|
|
10
|
15
|
11 #DMR <- ("test-data/DMR.bed")
|
12
|
12 DMRInfo = read.table(
|
|
13 DMR,
|
|
14 header = FALSE,
|
|
15 sep = "\t",
|
|
16 stringsAsFactors = FALSE,
|
|
17 quote = ""
|
|
18 )
|
|
19
|
14
|
20 peaks <- GRanges(seqnames = DMRInfo[, 1],
|
12
|
21 ranges = IRanges
|
|
22 (start = DMRInfo[, 2], end = DMRInfo[, 3]))
|
14
|
23 peaks[1:2]
|
|
24 annoData <- toGRanges(EnsDb.Hsapiens.v75)
|
|
25 annoData[1:2]
|
12
|
26
|
14
|
27 ## keep the seqnames in the same style
|
|
28 seqlevelsStyle(peaks) <- seqlevelsStyle(annoData)
|
|
29 ## do annotation by nearest TSS
|
|
30 anno <- annotatePeakInBatch(peaks, AnnotationData=annoData)
|
|
31 anno[1:2]
|
15
|
32 #annoPeakTable <- ('test-data/ChIPPeak.csv')
|
14
|
33 write.csv(anno, annoPeakTable, row.names = FALSE)
|
12
|
34
|
14
|
35
|