diff annotatePeak/annotatePeak.R @ 0:5d70366e7c6f draft

Uploaded
author testtool
date Mon, 06 Feb 2017 10:53:57 -0500
parents
children 92387cb81962
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annotatePeak/annotatePeak.R	Mon Feb 06 10:53:57 2017 -0500
@@ -0,0 +1,26 @@
+require("ChIPseeker", quietly = TRUE)
+require("ChIPpeakAnno", 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 <-
+  as.data.frame(annotatePeak(DMRPeaks, level = "gene", annoDb = "org.Hs.eg.db"))
+
+
+write.csv(annotatePeak, annoPeakTable, row.names = FALSE)