Mercurial > repos > iuc > dexseq
annotate dexseq.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 |
rev | line source |
---|---|
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
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 }) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
6 # we need that to not crash galaxy with an UTF8 error on German LC settings. |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
7 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
8 |
2
6e8b61c54ff3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents:
0
diff
changeset
|
9 suppressPackageStartupMessages({ |
6e8b61c54ff3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents:
0
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") |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
12 library("rjson") |
2
6e8b61c54ff3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents:
0
diff
changeset
|
13 }) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
14 |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
15 |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
16 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
17 args <- commandArgs(trailingOnly = TRUE) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
18 |
11
9a7c5b6d8f1e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents:
10
diff
changeset
|
19 # 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
|
20 # 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
|
21 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
|
22 "verbose", "v", 2, "integer", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
23 "help", "h", 0, "logical", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
24 "gtf", "a", 1, "character", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
25 "outfile", "o", 1, "character", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
26 "reportdir", "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
|
27 "rds", "d", 1, "character", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
28 "factors", "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
|
29 "threads", "p", 1, "integer", |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
30 "fdr", "c", 1, "double" |
10
df929f257179
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents:
7
diff
changeset
|
31 ), 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
|
32 opt <- getopt(spec) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
33 |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
34 # if help was asked for print a friendly message |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
35 # and exit with a non-zero error code |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
36 if (!is.null(opt$help)) { |
10
df929f257179
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents:
7
diff
changeset
|
37 cat(getopt(spec, usage = TRUE)) |
df929f257179
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents:
7
diff
changeset
|
38 q(status = 1) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
39 } |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
40 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
41 trim <- function(x) gsub("^\\s+|\\s+$", "", x) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
42 opt$samples <- trim(opt$samples) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
43 opt$factors <- trim(opt$factors) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
44 |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
45 parser <- newJSONParser() |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
46 parser$addData(opt$factors) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
47 factors_list <- parser$getObject() |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
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 sample_table <- data.frame() |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
50 count_files <- c() |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
51 factor_names <- c() |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
52 primary_factor <- "" |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
53 for (factor in factors_list) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
54 factor_name <- factor[[1]] |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
55 factor_names <- append(factor_names, paste(factor_name, "exon", sep = ":")) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
56 factor_values_map_list <- factor[[2]] |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
57 c <- length(factor_values_map_list) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
58 for (factorValuesMap in factor_values_map_list) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
59 for (files in factorValuesMap) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
60 for (file in files) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
61 if (primary_factor == "") { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
62 count_files <- append(count_files, file) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
63 } |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
64 sample_table[basename(file), factor_name] <- paste(c, names(factorValuesMap), sep = "_") |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
65 } |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
66 } |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
67 c <- c - 1 |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
68 } |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
69 if (primary_factor == "") { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
70 primary_factor <- factor_name |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
71 } |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
72 } |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
73 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
74 factor_names <- append(factor_names, "exon") |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
75 factor_names <- append(factor_names, "sample") |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
76 factor_names <- rev(factor_names) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
77 formula_full_model <- as.formula(paste("", paste(factor_names, collapse = " + "), sep = " ~ ")) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
78 factor_names <- head(factor_names, -1) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
79 formula_reduced_model <- as.formula(paste("", paste(factor_names, collapse = " + "), sep = " ~ ")) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
80 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
81 sample_table |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
82 formula_full_model |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
83 formula_reduced_model |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
84 primary_factor |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
85 count_files |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
86 opt$reportdir |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
87 opt$threads |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
88 getwd() |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
89 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
90 dxd <- DEXSeqDataSetFromHTSeq(count_files, sampleData = sample_table, design = formula_full_model, flattenedfile = opt$gtf) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
91 |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
92 colData(dxd) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
93 dxd <- estimateSizeFactors(dxd) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
94 print("Estimated size factors") |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
95 sizeFactors(dxd) |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
96 bpparam <- MulticoreParam(workers = opt$threads) |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
97 dxd <- estimateDispersions(dxd, formula = formula_full_model, BPPARAM = bpparam) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
98 print("Estimated dispersions") |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
99 dxd <- testForDEU(dxd, reducedModel = formula_reduced_model, fullModel = formula_full_model, BPPARAM = bpparam) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
100 print("tested for DEU") |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
101 dxd <- estimateExonFoldChanges(dxd, fitExpToVar = primary_factor, BPPARAM = bpparam) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
102 print("Estimated fold changes") |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
103 res <- DEXSeqResults(dxd) |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
104 print("Results") |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
105 table(res$padj <= opt$fdr) |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
106 res_sorted <- res[order(res$padj), ] |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
107 head(res_sorted) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
108 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
109 export_table <- as.data.frame(res_sorted) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
110 last_column <- ncol(export_table) |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
111 for (i in seq_len(nrow(export_table))) { |
11
9a7c5b6d8f1e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0ccfadf8ac4bc6514836c4efe6f605973a08d1ed
iuc
parents:
10
diff
changeset
|
112 export_table[i, last_column] <- paste(export_table[i, last_column][[1]], collapse = ", ") |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
113 } |
10
df929f257179
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents:
7
diff
changeset
|
114 export_table[, c(last_column)] <- sapply(export_table[, c(last_column)], as.character) |
df929f257179
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 2ea27822b171dbf519509dc1da150c8ccee2a140
iuc
parents:
7
diff
changeset
|
115 write.table(export_table, file = opt$outfile, sep = "\t", quote = FALSE, row.names = FALSE, col.names = FALSE) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
116 print("Written Results") |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
117 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
118 if (!is.null(opt$rds)) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
119 saveRDS(res, file = "DEXSeqResults.rds") |
5
278b189248cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
2
diff
changeset
|
120 } |
278b189248cd
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit c027cb925607cda29bb1e78fe76716af49a276ca
iuc
parents:
2
diff
changeset
|
121 |
7
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
122 if (!is.null(opt$reportdir)) { |
62adf13b86ea
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 06f2c57b523aab7c997d82e1345fd23f178de598"
iuc
parents:
5
diff
changeset
|
123 DEXSeqHTML(res, fitExpToVar = primary_factor, path = opt$reportdir, FDR = opt$fdr, color = c("#B7FEA0", "#FF8F43", "#637EE9", "#FF0000", "#F1E7A1", "#C3EEE7", "#CEAEFF", "#EDC3C5", "#AAA8AA")) |
0
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
124 } |
4ca0e679f21e
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff
changeset
|
125 sessionInfo() |