| 0 | 1 require("ChIPseeker", quietly = TRUE) | 
|  | 2 require("ChIPpeakAnno", quietly = TRUE) | 
| 1 | 3 require("org.Hs.eg.db", quietly = TRUE) | 
| 2 | 4 require("GenomicRanges", quietly = TRUE) | 
| 0 | 5 options(warn = -1) | 
|  | 6 | 
|  | 7 args <- commandArgs(trailingOnly = TRUE) | 
|  | 8 DMR = args[1] | 
|  | 9 annoPeakTable = args[2] | 
|  | 10 | 
|  | 11 | 
|  | 12 DMRInfo = read.table( | 
|  | 13   DMR, | 
|  | 14   header = FALSE, | 
|  | 15   sep = "\t", | 
|  | 16   stringsAsFactors = FALSE, | 
|  | 17   quote = "" | 
|  | 18 ) | 
|  | 19 | 
|  | 20 DMRPeaks <- GRanges(seqnames = DMRInfo[, 1], | 
|  | 21                     ranges = IRanges | 
|  | 22                     (start = DMRInfo[, 2], end = DMRInfo[, 3])) | 
|  | 23 | 
| 2 | 24 annotatePeak <- annotatePeak(DMRPeaks, level = "gene", annoDb = "org.Hs.eg.db") | 
| 0 | 25 | 
| 2 | 26 | 
|  | 27 write.csv(as.data.frame(annotatePeak), annoPeakTable, row.names = FALSE) |