view annotatePeak/annotatePeak.R @ 2:be66730c5c3b draft

Uploaded
author testtool
date Sat, 25 Feb 2017 11:29:01 -0500
parents 92387cb81962
children e1c643f600d2
line wrap: on
line source

require("ChIPseeker", quietly = TRUE)
require("ChIPpeakAnno", quietly = TRUE)
require("org.Hs.eg.db", quietly = TRUE)
require("GenomicRanges", quietly = TRUE)
options(warn = -1)

args <- commandArgs(trailingOnly = TRUE)
DMR = args[1]
annoPeakTable = args[2]


DMRInfo = read.table(
  DMR,
  header = FALSE,
  sep = "\t",
  stringsAsFactors = FALSE,
  quote = ""
)

DMRPeaks <- GRanges(seqnames = DMRInfo[, 1],
                    ranges = IRanges
                    (start = DMRInfo[, 2], end = DMRInfo[, 3]))

annotatePeak <- annotatePeak(DMRPeaks, level = "gene", annoDb = "org.Hs.eg.db")


write.csv(as.data.frame(annotatePeak), annoPeakTable, row.names = FALSE)