annotate plotdexseq.R @ 8:2872c633f07e draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit d6fb005b0dbf26037aab1748d9b5df12876c674d"
author iuc
date Sun, 19 Dec 2021 23:02:46 +0000
parents 62adf13b86ea
children df929f257179
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
2 options(show.error.messages = F, error = function() {
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
3 cat(geterrmessage(), file = stderr()); q("no", 1, F)
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
4 })
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
5 # 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
6 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
7
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
8 suppressPackageStartupMessages({
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
9 library("DEXSeq")
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
10 library("getopt")
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
11 })
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
12
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
13 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
14 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
15
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
16 #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
17 #we read the options from the default: commandArgs(TRUE).
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
18 spec <- matrix(c(
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
19 "rdata", "r", 1, "character",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
20 "primaryfactor", "p", 1, "character",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
21 "geneid", "g", 1, "character",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
22 "genefile", "f", 1, "character",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
23 "fdr", "c", 1, "double",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
24 "transcripts", "t", 1, "logical",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
25 "names", "a", 1, "logical",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
26 "normcounts", "n", 1, "logical",
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
27 "splicing", "s", 1, "logical"
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
28 ), byrow = TRUE, ncol = 4);
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
29 opt <- getopt(spec);
5
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 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
32
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
33 if (!is.null(opt$genefile)) {
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
34 genes <- read.delim(opt$genefile, header = FALSE)
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
35 genes <- genes[, 1]
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
36 } else {
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
37 genes <- opt$geneid
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
38 }
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
39
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
40 pdf("plot.pdf")
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
41 for (i in genes) {
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
42 plotDEXSeq(res, i, FDR = opt$fdr, fitExpToVar = opt$primaryfactor,
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
43 norCounts = opt$normcounts, expression = TRUE, splicing = opt$splicing,
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
44 displayTranscripts = opt$transcripts, names = opt$names, legend = TRUE,
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
45 color = NULL, color.samples = NULL, transcriptDb = NULL)
5
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 dev.off()
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
48
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
49 sessionInfo()