view chipeakanno_annopeaks.R @ 11:8a91d82803a9 draft

planemo upload for repository https://github.com/kpbioteam/chipeakanno_annopeaks commit 1d355e9a8d667b026e22e5f8956f19199c5af880
author kpbioteam
date Sat, 23 Jun 2018 06:15:12 -0400
parents b1274d30071e
children
line wrap: on
line source

require("ChIPpeakAnno", quietly = TRUE)
require("EnsDb.Hsapiens.v75", quietly = TRUE)
require("rtracklayer", quietly = TRUE)

options(warn = -1)
options("download.file.method"="wget")

args <- commandArgs(trailingOnly = TRUE)

input1 = args[1]
input2 = args[2]
input3  = as.numeric(args[3])
input4 = as.numeric(args[4])
input5 = as.numeric(args[5])
output1  = args[6]

DMRInfo <-  read.table(input1)
peaks <- GRanges(seqnames = DMRInfo[, 1],
                    ranges = IRanges
                    (start = DMRInfo[, 2], end = DMRInfo[, 3]),score=DMRInfo[, input5])

annoData <- toGRanges(EnsDb.Hsapiens.v75)
seqlevelsStyle(peaks) <- seqlevelsStyle(annoData)

 anno <- annoPeaks(peaks, annoData=annoData, bindingType =c(input2), bindingRegion=c(input3, input4))
 
 write.table(anno, file= output1, quote = FALSE, row.names = FALSE, sep = "\t")