annotate sleuth.R @ 2:d6b5fc94062c draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 10e44e324ee754d81a1b9d990ee0932b37e7a9bc
author iuc
date Thu, 08 Jun 2023 19:57:53 +0000
parents d3e447dd52c8
children
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")
2
d6b5fc94062c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 10e44e324ee754d81a1b9d990ee0932b37e7a9bc
iuc
parents: 1
diff changeset
54
d6b5fc94062c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 10e44e324ee754d81a1b9d990ee0932b37e7a9bc
iuc
parents: 1
diff changeset
55 s2c$path <- file.path("./kallisto_outputs/", paste(s2c$path, ".h5", sep = ""))
d6b5fc94062c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 10e44e324ee754d81a1b9d990ee0932b37e7a9bc
iuc
parents: 1
diff changeset
56 for (f in args$factorLevel_counts) {
d6b5fc94062c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 10e44e324ee754d81a1b9d990ee0932b37e7a9bc
iuc
parents: 1
diff changeset
57 file.rename(f, paste(f, ".h5", sep = ""))
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
58 }
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
59
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
60 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
61 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
62
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
63 } else {
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
64 ## 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
65 ###########################
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
66
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
67 conditions <- c()
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
68 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
69 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
70 conditions <- temp
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
71 }
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
72
1
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
73 sample_names <-
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
74 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
75
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
76 design <-
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
77 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
78 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
79 condition = conditions,
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
80 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
81 ))
d3e447dd52c8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6fbf73689708cfbdf3d9d783af4988bad7137f93
iuc
parents: 0
diff changeset
82 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
83 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
84 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
85 }
0
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
86
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
87 so <- sleuth_fit(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
88 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
89 ~ condition,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
90 "full",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
91 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
92 lwr = args$lwr,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
93 upr = args$upr
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
94 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
95
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
96 so <- sleuth_fit(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
97 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
98 ~ 1,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
99 "reduced",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
100 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
101 lwr = args$lwr,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
102 upr = args$upr
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
103 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
104
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
105 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
106
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
107 sleuth_table <-
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
108 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
109
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
110 write.table(
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 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
113 quote = FALSE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
114 sep = "\t",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
115 col.names = TRUE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
116 row.names = FALSE
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
117 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
118
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
119
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
120 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
121 pdf(file = outputFile,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
122 height = 6,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
123 width = 9)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
124 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
125 dev.off()
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
126
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
127 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
128 pdf(file = outputFile,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
129 height = 6,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
130 width = 9)
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
131 plot_group_density(
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
132 so,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
133 use_filtered = TRUE,
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
134 units = "est_counts",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
135 trans = "log",
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
136 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
137 "sample"),
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
138 offset = 1
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
139 )
5f1cb4c28d73 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sleuth commit 6b943159b4d68812dc6911309f23d54ec659282f
iuc
parents:
diff changeset
140 dev.off()