Mercurial > repos > rnateam > chipseeker
comparison 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 |
comparison
equal
deleted
inserted
replaced
5:4c2dbe4dbb4e | 6:b418a1d3585d |
---|---|
15 make_option(c("-G","--gtf"), type="character", help="GTF to create TxDb."), | 15 make_option(c("-G","--gtf"), type="character", help="GTF to create TxDb."), |
16 make_option(c("-u","--upstream"), type="integer", help="TSS upstream region"), | 16 make_option(c("-u","--upstream"), type="integer", help="TSS upstream region"), |
17 make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"), | 17 make_option(c("-d","--downstream"), type="integer", help="TSS downstream region"), |
18 make_option(c("-F","--flankgeneinfo"), type="logical", help="Add flanking gene info"), | 18 make_option(c("-F","--flankgeneinfo"), type="logical", help="Add flanking gene info"), |
19 make_option(c("-D","--flankgenedist"), type="integer", help="Flanking gene distance"), | 19 make_option(c("-D","--flankgenedist"), type="integer", help="Flanking gene distance"), |
20 make_option(c("-j","--ignoreUpstream"), type="logical", help="Ignore upstream"), | |
21 make_option(c("-k","--ignoreDownstream"), type="logical", help="Ignore downstream"), | |
20 make_option(c("-f","--format"), type="character", help="Output format (interval or tabular)."), | 22 make_option(c("-f","--format"), type="character", help="Output format (interval or tabular)."), |
21 make_option(c("-p","--plots"), type="logical", help="PDF of plots."), | 23 make_option(c("-p","--plots"), type="logical", help="PDF of plots."), |
22 make_option(c("-r","--rdata"), type="logical", help="Output RData file.") | 24 make_option(c("-r","--rdata"), type="logical", help="Output RData file.") |
23 ) | 25 ) |
24 | 26 |
29 gtf = args$gtf | 31 gtf = args$gtf |
30 up = args$upstream | 32 up = args$upstream |
31 down = args$downstream | 33 down = args$downstream |
32 format = args$format | 34 format = args$format |
33 | 35 |
36 if (!is.null(args$flankgeneinfo)) { | |
37 flankgeneinfo <- TRUE | |
38 } else { | |
39 flankgeneinfo <- FALSE | |
40 } | |
41 | |
42 if (!is.null(args$ignoreUpstream)) { | |
43 ignoreUpstream <- TRUE | |
44 } else { | |
45 ignoreUpstream <- FALSE | |
46 } | |
47 | |
48 if (!is.null(args$ignoreDownstream)) { | |
49 ignoreDownstream <- TRUE | |
50 } else { | |
51 ignoreDownstream <- FALSE | |
52 } | |
53 | |
34 peaks <- readPeakFile(peaks) | 54 peaks <- readPeakFile(peaks) |
35 | 55 |
36 # Make TxDb from GTF | 56 # Make TxDb from GTF |
37 txdb <- makeTxDbFromGFF(gtf, format="gtf") | 57 txdb <- makeTxDbFromGFF(gtf, format="gtf") |
38 if (!is.null(args$flankgeneinfo)) { | 58 |
39 peakAnno <- annotatePeak(peaks, TxDb=txdb, tssRegion=c(-up, down), addFlankGeneInfo=args$flankgeneinfo, flankDistance=args$flankgenedist) | 59 # Annotate peaks |
40 } else { | 60 peakAnno <- annotatePeak(peaks, TxDb=txdb, |
41 peakAnno <- annotatePeak(peaks, TxDb=txdb, tssRegion=c(-up, down)) | 61 tssRegion=c(-up, down), |
42 } | 62 addFlankGeneInfo=flankgeneinfo, |
63 flankDistance=args$flankgenedist, | |
64 ignoreUpstream=ignoreUpstream, | |
65 ignoreDownstream=ignoreDownstream) | |
43 | 66 |
44 # Add gene name | 67 # Add gene name |
45 features <- import(gtf, format="gtf") | 68 features <- import(gtf, format="gtf") |
46 ann <- unique(mcols(features)[, c("gene_id", "gene_name")]) | 69 ann <- unique(mcols(features)[, c("gene_id", "gene_name")]) |
47 res <- as.data.frame(peakAnno) | 70 res <- as.data.frame(peakAnno) |