view annoPeakFigure/annoPeakFigure.R @ 1:6278004aa9b2 draft

Uploaded
author testtool
date Tue, 28 Feb 2017 05:42:05 -0500
parents 88964c4b12a0
children a23d604eb17b
line wrap: on
line source

require("ChIPseeker", quietly = TRUE)
require("ChIPpeakAnno", quietly = TRUE)

options(warn = -1)

args <- commandArgs(trailingOnly = TRUE)
DMR = args[1]
annoPeakFigure1 = args[2]
annoPeakFigure2 = args[3]

#DMR <- ("test-data/DMR.bed")
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"))

#annoPeakFigure1 <- ('test-data/annoPeakUpset.png')
#annoPeakFigure2 <- ('test-data/annoPeakAnnoBar.png')

png(file = annoPeakFigure1,
    width = 1200,
    height = 600)

plotAnnoBar(annotatePeak)

dev.off()

png(file = annoPeakFigure2,
    width = 1200,
    height = 600)

upsetplot(annotatePeak, vennpie = TRUE)

dev.off()