comparison 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
comparison
equal deleted inserted replaced
6:b418a1d3585d 7:1b9a9409831d
10 library(optparse) 10 library(optparse)
11 }) 11 })
12 12
13 option_list <- list( 13 option_list <- list(
14 make_option(c("-i","--infile"), type="character", help="Peaks file to be annotated"), 14 make_option(c("-i","--infile"), type="character", help="Peaks file to be annotated"),
15 make_option(c("-H","--header"), type="logical", help="Peaks file contains header row"),
15 make_option(c("-G","--gtf"), type="character", help="GTF to create TxDb."), 16 make_option(c("-G","--gtf"), type="character", help="GTF to create TxDb."),
16 make_option(c("-u","--upstream"), type="integer", help="TSS upstream region"), 17 make_option(c("-u","--upstream"), type="integer", help="TSS upstream region"),
17 make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"), 18 make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"),
18 make_option(c("-F","--flankgeneinfo"), type="logical", help="Add flanking gene info"), 19 make_option(c("-F","--flankgeneinfo"), type="logical", help="Add flanking gene info"),
19 make_option(c("-D","--flankgenedist"), type="integer", help="Flanking gene distance"), 20 make_option(c("-D","--flankgenedist"), type="integer", help="Flanking gene distance"),
49 ignoreDownstream <- TRUE 50 ignoreDownstream <- TRUE
50 } else { 51 } else {
51 ignoreDownstream <- FALSE 52 ignoreDownstream <- FALSE
52 } 53 }
53 54
54 peaks <- readPeakFile(peaks) 55 if (!is.null(args$header)) {
56 header <- TRUE
57 } else {
58 header <- FALSE
59 }
60
61 peaks <- readPeakFile(peaks, header=header)
55 62
56 # Make TxDb from GTF 63 # Make TxDb from GTF
57 txdb <- makeTxDbFromGFF(gtf, format="gtf") 64 txdb <- makeTxDbFromGFF(gtf, format="gtf")
58 65
59 # Annotate peaks 66 # Annotate peaks
91 write.table(resout, file="out.tab", sep="\t", row.names=FALSE, quote=FALSE) 98 write.table(resout, file="out.tab", sep="\t", row.names=FALSE, quote=FALSE)
92 99
93 if (!is.null(args$plots)) { 100 if (!is.null(args$plots)) {
94 pdf("out.pdf", width=14) 101 pdf("out.pdf", width=14)
95 plotAnnoPie(peakAnno) 102 plotAnnoPie(peakAnno)
96 plotAnnoBar(peakAnno) 103 p1 <- plotAnnoBar(peakAnno)
104 print(p1)
97 vennpie(peakAnno) 105 vennpie(peakAnno)
98 upsetplot(peakAnno) 106 upsetplot(peakAnno)
99 plotDistToTSS(peakAnno, title="Distribution of transcription factor-binding loci\nrelative to TSS") 107 p2 <- plotDistToTSS(peakAnno, title="Distribution of transcription factor-binding loci\nrelative to TSS")
108 print(p2)
100 dev.off() 109 dev.off()
110 rm(p1, p2)
101 } 111 }
102 112
103 ## Output RData file 113 ## Output RData file
104 114
105 if (!is.null(args$rdata)) { 115 if (!is.null(args$rdata)) {