Mercurial > repos > bgruening > diffbind
comparison diffbind.R @ 7:fa67bcb732f6 draft
Uploaded
| author | bgruening |
|---|---|
| date | Tue, 14 Jan 2014 05:04:34 -0500 |
| parents | 8d48d5591389 |
| children | 20c431b4cf74 |
comparison
equal
deleted
inserted
replaced
| 6:da65ae70e2e1 | 7:fa67bcb732f6 |
|---|---|
| 8 args <- commandArgs(trailingOnly = TRUE) | 8 args <- commandArgs(trailingOnly = TRUE) |
| 9 | 9 |
| 10 #get options, using the spec as defined by the enclosed list. | 10 #get options, using the spec as defined by the enclosed list. |
| 11 #we read the options from the default: commandArgs(TRUE). | 11 #we read the options from the default: commandArgs(TRUE). |
| 12 spec = matrix(c( | 12 spec = matrix(c( |
| 13 'verbose', 'v', 2, "integer", | 13 'verbose', 'v', 2, "integer", |
| 14 'help' , 'h', 0, "logical", | 14 'help' , 'h', 0, "logical", |
| 15 'outfile' , 'o', 1, "character", | 15 'outfile' , 'o', 1, "character", |
| 16 'plots' , 'p', 2, "character", | 16 'plots' , 'p', 2, "character", |
| 17 'infile' , 'i', 1, "character", | 17 'infile' , 'i', 1, "character", |
| 18 'format', 'f', 1, 'character', | 18 'format', 'f', 1, 'character' |
| 19 ), byrow=TRUE, ncol=4); | 19 ), byrow=TRUE, ncol=4); |
| 20 | |
| 20 opt = getopt(spec); | 21 opt = getopt(spec); |
| 21 | 22 |
| 22 # if help was asked for print a friendly message | 23 # if help was asked for print a friendly message |
| 23 # and exit with a non-zero error code | 24 # and exit with a non-zero error code |
| 24 if ( !is.null(opt$help) ) { | 25 if ( !is.null(opt$help) ) { |
| 25 cat(getopt(spec, usage=TRUE)); | 26 cat(getopt(spec, usage=TRUE)); |
| 26 q(status=1); | 27 q(status=1); |
| 27 } | 28 } |
| 28 | 29 |
| 29 | 30 |
| 30 library(DiffBind) | 31 library('DiffBind') |
| 31 # used to save to BED, GFF or WIG format | 32 # used to save to BED, GFF or WIG format |
| 32 library(rtracklayer) | 33 library('rtracklayer') |
| 33 | 34 |
| 34 if ( !is.null(opt$plots) ) { | 35 if ( !is.null(opt$plots) ) { |
| 35 pdf(opt$plots) | 36 pdf(opt$plots) |
| 36 } | 37 } |
| 37 | 38 |
