Mercurial > repos > iuc > dexseq
comparison plotdexseq.R @ 11:577d1c8baab4 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
| author | iuc |
|---|---|
| date | Mon, 14 Jan 2019 05:01:42 -0500 |
| parents | |
| children | 3762d6644ec4 |
comparison
equal
deleted
inserted
replaced
| 10:6f684b3b0a6d | 11:577d1c8baab4 |
|---|---|
| 1 ## Setup R error handling to go to stderr | |
| 2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) | |
| 3 # we need that to not crash galaxy with an UTF8 error on German LC settings. | |
| 4 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") | |
| 5 | |
| 6 suppressPackageStartupMessages({ | |
| 7 library("DEXSeq") | |
| 8 library('getopt') | |
| 9 }) | |
| 10 | |
| 11 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) | |
| 12 args <- commandArgs(trailingOnly = TRUE) | |
| 13 | |
| 14 #get options, using the spec as defined by the enclosed list. | |
| 15 #we read the options from the default: commandArgs(TRUE). | |
| 16 spec = matrix(c( | |
| 17 'rdata', 'r', 1, "character", | |
| 18 'primaryfactor', 'p', 1, "character", | |
| 19 'geneid', 'g', 1, "character", | |
| 20 'genefile', 'f', 1, "character", | |
| 21 'fdr', 'c', 1, "double", | |
| 22 'transcripts', 't', 1, "logical", | |
| 23 'names', 'a', 1, "logical", | |
| 24 'normcounts', 'n', 1, "logical", | |
| 25 'splicing', 's', 1, "logical" | |
| 26 ), byrow=TRUE, ncol=4); | |
| 27 opt = getopt(spec); | |
| 28 | |
| 29 res <- readRDS(opt$rdata) | |
| 30 | |
| 31 if (!is.null(opt$genefile)) { | |
| 32 genes <- read.delim(opt$genefile, header=FALSE) | |
| 33 genes <- genes[, 1] | |
| 34 } else { | |
| 35 genes <- opt$geneid | |
| 36 } | |
| 37 | |
| 38 pdf("plot.pdf") | |
| 39 for (i in genes){ | |
| 40 plotDEXSeq(res, i, FDR=opt$fdr, fitExpToVar=opt$primaryfactor, | |
| 41 norCounts=opt$normcounts, expression=TRUE, splicing=opt$splicing, | |
| 42 displayTranscripts=opt$transcripts, names=opt$names, legend=TRUE, | |
| 43 color=NULL, color.samples=NULL, transcriptDb=NULL) | |
| 44 } | |
| 45 dev.off() | |
| 46 | |
| 47 sessionInfo() |
