Mercurial > repos > testtool > annotate_peak
diff annotate_peak/annotatePeak.R @ 12:54e19bceff70 draft
Uploaded
author | testtool |
---|---|
date | Thu, 16 Mar 2017 07:21:37 -0400 |
parents | |
children | 77c0aee75ac6 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/annotate_peak/annotatePeak.R Thu Mar 16 07:21:37 2017 -0400 @@ -0,0 +1,26 @@ +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 <- as.data.frame(annotatePeak(DMRPeaks, level = "gene", annoDb = "org.Hs.eg.db")) + +write.csv(annotatePeak, annoPeakTable, row.names = FALSE)