Mercurial > repos > testtool > annotate_peak
diff annotate_peak/annotatePeak.R @ 14:4a489b0d247f draft
Uploaded
author | testtool |
---|---|
date | Thu, 16 Mar 2017 10:59:08 -0400 |
parents | 77c0aee75ac6 |
children | 53df7871db21 |
line wrap: on
line diff
--- a/annotate_peak/annotatePeak.R Thu Mar 16 07:28:01 2017 -0400 +++ b/annotate_peak/annotatePeak.R Thu Mar 16 10:59:08 2017 -0400 @@ -1,9 +1,4 @@ -require("ChIPseeker", quietly = TRUE) -require("ChIPpeakAnno", quietly = TRUE) - options(warn = -1) -options("download.file.method"="wget") - args <- commandArgs(trailingOnly = TRUE) DMR = args[1] annoPeakTable = args[2] @@ -17,12 +12,23 @@ quote = "" ) -DMRPeaks <- GRanges(seqnames = DMRInfo[, 1], +peaks <- GRanges(seqnames = DMRInfo[, 1], ranges = IRanges (start = DMRInfo[, 2], end = DMRInfo[, 3])) +peaks[1:2] +## try http:// if https:// URLs are not supported +source("https://bioconductor.org/biocLite.R") +biocLite("EnsDb.Hsapiens.v75") +library(EnsDb.Hsapiens.v75) +annoData <- toGRanges(EnsDb.Hsapiens.v75) +annoData[1:2] -annotatePeak <- - as.data.frame(annotatePeak(DMRPeaks, level = "gene", annoDb = "org.Hs.eg.db")) +## keep the seqnames in the same style +seqlevelsStyle(peaks) <- seqlevelsStyle(annoData) +## do annotation by nearest TSS +anno <- annotatePeakInBatch(peaks, AnnotationData=annoData) +anno[1:2] +annoPeakTable <- ('test-data/ChIPPeak.csv') +write.csv(anno, annoPeakTable, row.names = FALSE) -annoPeakTable <- ('test-data/annoPeakTable.csv') -write.csv(annotatePeak, annoPeakTable, row.names = FALSE) +