diff chipseeker.R @ 6:b418a1d3585d draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/chipseeker commit d83142dbe2432fcb0f56dcd6311a05c061628ecc
author rnateam
date Wed, 13 Mar 2019 03:05:16 -0400
parents 90fe78a19b55
children 1b9a9409831d
line wrap: on
line diff
--- a/chipseeker.R	Tue Dec 04 10:01:20 2018 -0500
+++ b/chipseeker.R	Wed Mar 13 03:05:16 2019 -0400
@@ -17,6 +17,8 @@
     make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"),
     make_option(c("-F","--flankgeneinfo"), type="logical", help="Add flanking gene info"),
     make_option(c("-D","--flankgenedist"), type="integer", help="Flanking gene distance"),
+    make_option(c("-j","--ignoreUpstream"), type="logical", help="Ignore upstream"),
+    make_option(c("-k","--ignoreDownstream"), type="logical", help="Ignore downstream"),
     make_option(c("-f","--format"), type="character", help="Output format (interval or tabular)."),
     make_option(c("-p","--plots"), type="logical", help="PDF of plots."),
     make_option(c("-r","--rdata"), type="logical", help="Output RData file.")
@@ -31,15 +33,36 @@
 down = args$downstream
 format = args$format
 
+if (!is.null(args$flankgeneinfo)) {
+    flankgeneinfo <- TRUE
+} else {
+    flankgeneinfo <- FALSE
+}
+
+if (!is.null(args$ignoreUpstream)) {
+    ignoreUpstream <- TRUE
+} else {
+    ignoreUpstream <- FALSE
+}
+
+if (!is.null(args$ignoreDownstream)) {
+    ignoreDownstream <- TRUE
+} else {
+    ignoreDownstream <- FALSE
+}
+
 peaks <- readPeakFile(peaks)
 
 # Make TxDb from GTF
 txdb <- makeTxDbFromGFF(gtf, format="gtf")
-if (!is.null(args$flankgeneinfo)) {
-    peakAnno <-  annotatePeak(peaks, TxDb=txdb, tssRegion=c(-up, down), addFlankGeneInfo=args$flankgeneinfo, flankDistance=args$flankgenedist)
-} else {
-    peakAnno <-  annotatePeak(peaks, TxDb=txdb, tssRegion=c(-up, down))
-}
+
+# Annotate peaks
+peakAnno <-  annotatePeak(peaks, TxDb=txdb,
+    tssRegion=c(-up, down),
+    addFlankGeneInfo=flankgeneinfo,
+    flankDistance=args$flankgenedist,
+    ignoreUpstream=ignoreUpstream,
+    ignoreDownstream=ignoreDownstream)
 
 # Add gene name
 features <- import(gtf, format="gtf")