annotate sleuth.R @ 1:d3e447dd52c8 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
author iuc
date Wed, 07 Jun 2023 11:47:30 +0000
parents 5f1cb4c28d73
children d6b5fc94062c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
1 library(sleuth,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
2 quietly = TRUE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
3 warn.conflicts = FALSE)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
4 library(annotables, quietly = TRUE, warn.conflicts = FALSE)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
5 library(argparse, quietly = TRUE, warn.conflicts = FALSE)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
6 library(tidyverse)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
7
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
8
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
9 # setup R error handling to go to stderr
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
10 options(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
11 show.error.messages = FALSE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
12 error = function() {
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
13 cat(geterrmessage(), file = stderr())
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
14 q("no", 1, FALSE)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
15 }
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
16 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
17
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
18 # we need that to not crash galaxy with an UTF8 error on German LC settings.
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
19 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
20
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
21 ################################################################################
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
22 ### Input Processing
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
23 ################################################################################
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
24
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
25
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
26 # Collect arguments from command line
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
27 parser <- ArgumentParser(description = "Sleuth R script")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
28
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
29 parser$add_argument("--factorLevel", action = "append", required = FALSE)
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
30 parser$add_argument("--factorLevel_counts",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
31 action = "append",
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
32 required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
33 parser$add_argument("--factorLevel_n", action = "append", required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
34 parser$add_argument("--cores", type = "integer", required = FALSE)
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
35 parser$add_argument("--normalize", action = "store_true", required = FALSE)
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
36 parser$add_argument("--nbins", type = "integer", required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
37 parser$add_argument("--lwr", type = "numeric", required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
38 parser$add_argument("--upr", type = "numeric", required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
39 parser$add_argument("--metadata_file",
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
40 action = "append",
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
41 required = FALSE)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
42 parser$add_argument("--experiment_design", required = FALSE)
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
43
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
44 args <- parser$parse_args()
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
45
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
46 if (args$experiment_design == "complex") {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
47 ## Complex experiment design
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
48 ############################
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
49
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
50 s2c <-
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
51 read.table(file = args$metadata_file,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
52 header = TRUE,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
53 sep = "\t")
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
54 paths <- c()
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
55 for (x in s2c$data_filename) {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
56 paths <- c(paths, paste("./kallisto_outputs/", x, sep = ""))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
57 }
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
58 for (f in paths) {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
59 file.rename(f, gsub(".fastq.*", "", f))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
60 file.rename(f, paste(gsub(".fastq.*", "", f), ".h5", sep = ""))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
61 }
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
62 s2c$path <- paste(gsub(".fastq.*", ".h5", paths), ".h5", sep = "")
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
63
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
64 so <- sleuth_prep(s2c, full_model = ~ condition, num_cores = 1)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
65 so <- sleuth_fit(so)
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
66
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
67 } else {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
68 ## Simple experiment design
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
69 ###########################
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
70
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
71 conditions <- c()
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
72 for (x in seq_along(args$factorLevel)) {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
73 temp <- append(conditions, rep(args$factorLevel[[x]]))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
74 conditions <- temp
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
75 }
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
76
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
77 sample_names <-
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
78 gsub(".fastq.+", "", basename(args$factorLevel_counts))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
79
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
80 design <-
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
81 data.frame(list(
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
82 sample = sample_names,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
83 condition = conditions,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
84 path = args$factorLevel_counts
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
85 ))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
86 so <- sleuth_prep(design,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
87 cores = args$cores,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
88 normalize = args$normalize)
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
89 }
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
90
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
91 so <- sleuth_fit(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
92 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
93 ~ condition,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
94 "full",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
95 n_bins = args$nbins,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
96 lwr = args$lwr,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
97 upr = args$upr
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
98 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
99
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
100 so <- sleuth_fit(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
101 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
102 ~ 1,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
103 "reduced",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
104 n_bins = args$nbins,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
105 lwr = args$lwr,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
106 upr = args$upr
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
107 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
108
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
109 so <- sleuth_lrt(so, "reduced", "full")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
110
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
111 sleuth_table <-
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
112 sleuth_results(so, "reduced:full", "lrt", show_all = FALSE)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
113
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
114 write.table(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
115 sleuth_table,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
116 file = "sleuth_table.tab",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
117 quote = FALSE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
118 sep = "\t",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
119 col.names = TRUE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
120 row.names = FALSE
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
121 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
122
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
123
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
124 outputFile <- file.path(getwd(), "pca_plot.pdf")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
125 pdf(file = outputFile,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
126 height = 6,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
127 width = 9)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
128 plot_pca(so, color_by = "condition")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
129 dev.off()
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
130
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
131 outputFile <- file.path(getwd(), "group_density.pdf")
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
132 pdf(file = outputFile,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
133 height = 6,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
134 width = 9)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
135 plot_group_density(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
136 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
137 use_filtered = TRUE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
138 units = "est_counts",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
139 trans = "log",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
140 grouping = setdiff(colnames(so$sample_to_covariates),
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
141 "sample"),
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
142 offset = 1
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
143 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
144 dev.off()