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