annotate plotdexseq.R @ 11:9a7c5b6d8f1e draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
author iuc
date Tue, 02 Apr 2024 12:59:54 +0000
parents df929f257179
children
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
10
df929f257179 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents: 7
diff changeset
2 options(show.error.messages = FALSE, error = function() {
df929f257179 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents: 7
diff changeset
3 cat(geterrmessage(), file = stderr())
df929f257179 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents: 7
diff changeset
4 q("no", 1, FALSE)
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
5 })
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
6 # 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
7 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
8
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
9 suppressPackageStartupMessages({
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
10 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
11 library("getopt")
5
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
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
14 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
15 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
16
11
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
17 # get options, using the spec as defined by the enclosed list.
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
18 # 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
19 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
20 "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
21 "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
22 "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
23 "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
24 "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
25 "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
26 "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
27 "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
28 "splicing", "s", 1, "logical"
10
df929f257179 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents: 7
diff changeset
29 ), byrow = TRUE, ncol = 4)
df929f257179 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents: 7
diff changeset
30 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
31
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
32 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
33
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
34 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
35 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
36 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
37 } else {
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
38 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
39 }
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
40
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
41 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
42 for (i in genes) {
11
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
43 plotDEXSeq(res, i,
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
44 FDR = opt$fdr, fitExpToVar = opt$primaryfactor,
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
45 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
46 displayTranscripts = opt$transcripts, names = opt$names, legend = TRUE,
11
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
47 color = NULL, color.samples = NULL, transcriptDb = NULL
9a7c5b6d8f1e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents: 10
diff changeset
48 )
5
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
49 }
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
50 dev.off()
278b189248cd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
diff changeset
51
7
62adf13b86ea "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents: 5
diff changeset
52 sessionInfo()