diff chipseeker.R @ 7:1b9a9409831d draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chipseeker commit e07ee851144e07fde91877727d6a39a1906f7639
author rnateam
date Sat, 27 Apr 2019 11:04:35 -0400
parents b418a1d3585d
children 8bd92f2404dd
line wrap: on
line diff
--- a/chipseeker.R	Wed Mar 13 03:05:16 2019 -0400
+++ b/chipseeker.R	Sat Apr 27 11:04:35 2019 -0400
@@ -12,6 +12,7 @@
 
 option_list <- list(
     make_option(c("-i","--infile"), type="character", help="Peaks file to be annotated"),
+    make_option(c("-H","--header"), type="logical", help="Peaks file contains header row"),
     make_option(c("-G","--gtf"), type="character", help="GTF to create TxDb."),
     make_option(c("-u","--upstream"), type="integer", help="TSS upstream region"),
     make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"),
@@ -51,7 +52,13 @@
     ignoreDownstream <- FALSE
 }
 
-peaks <- readPeakFile(peaks)
+if (!is.null(args$header)) {
+    header <- TRUE
+} else {
+    header <- FALSE
+}
+
+peaks <- readPeakFile(peaks, header=header)
 
 # Make TxDb from GTF
 txdb <- makeTxDbFromGFF(gtf, format="gtf")
@@ -93,11 +100,14 @@
 if (!is.null(args$plots)) {
     pdf("out.pdf", width=14)
     plotAnnoPie(peakAnno)
-    plotAnnoBar(peakAnno)
+    p1 <- plotAnnoBar(peakAnno)
+    print(p1)
     vennpie(peakAnno)
     upsetplot(peakAnno)
-    plotDistToTSS(peakAnno, title="Distribution of transcription factor-binding loci\nrelative to TSS")
+    p2 <- plotDistToTSS(peakAnno, title="Distribution of transcription factor-binding loci\nrelative to TSS")
+    print(p2)
     dev.off()
+    rm(p1, p2)
 }
 
 ## Output RData file