annotate edger.R @ 8:3d89af8a44f0 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
author iuc
date Thu, 03 Jun 2021 19:34:18 +0000
parents 555659de7321
children 6e53e565fc6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
1 # This tool takes in a matrix of feature counts as well as gene annotations and
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
2 # outputs a table of top expressions as well as various plots for differential
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
3 # expression analysis
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
4 #
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
5 # ARGS: htmlPath", "R", 1, "character" -Path to html file linking to other outputs
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
6 # outPath", "o", 1, "character" -Path to folder to write all output to
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
7 # filesPath", "j", 2, "character" -JSON list object if multiple files input
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
8 # matrixPath", "m", 2, "character" -Path to count matrix
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
9 # factFile", "f", 2, "character" -Path to factor information file
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
10 # factInput", "i", 2, "character" -String containing factors if manually input
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
11 # annoPath", "a", 2, "character" -Path to input containing gene annotations
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
12 # contrastData", "C", 1, "character" -String containing contrasts of interest
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
13 # cpmReq", "c", 2, "double" -Float specifying cpm requirement
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
14 # cntReq", "z", 2, "integer" -Integer specifying minimum total count requirement
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
15 # sampleReq", "s", 2, "integer" -Integer specifying cpm requirement
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
16 # normCounts", "x", 0, "logical" -String specifying if normalised counts should be output
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
17 # rdaOpt", "r", 0, "logical" -String specifying if RData should be output
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
18 # lfcReq", "l", 1, "double" -Float specifying the log-fold-change requirement
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
19 # pValReq", "p", 1, "double" -Float specifying the p-value requirement
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
20 # pAdjOpt", "d", 1, "character" -String specifying the p-value adjustment method
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
21 # normOpt", "n", 1, "character" -String specifying type of normalisation used
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
22 # robOpt", "b", 0, "logical" -String specifying if robust options should be used
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
23 # lrtOpt", "t", 0, "logical" -String specifying whether to perform LRT test instead
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
24 #
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
25 # OUT:
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
26 # MDS Plot
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
27 # BCV Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
28 # QL Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
29 # MD Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
30 # Expression Table
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
31 # HTML file linking to the ouputs
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
32 # Optional:
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
33 # Normalised counts Table
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
34 # RData file
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
35 #
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
36 # Author: Shian Su - registertonysu@gmail.com - Jan 2014
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
37 # Modified by: Maria Doyle - Oct 2017 (some code taken from the DESeq2 wrapper)
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
38
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
39 # Record starting time
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
40 time_start <- as.character(Sys.time())
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
41
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
42 # setup R error handling to go to stderr
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
43 options(show.error.messages = F, error = function() {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
44 cat(geterrmessage(), file = stderr())
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
45 q("no", 1, F)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
46 })
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
47
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
48 # we need that to not crash galaxy with an UTF8 error on German LC settings.
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
49 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
50
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
51 # Load all required libraries
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
52 library(methods, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
53 library(statmod, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
54 library(splines, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
55 library(edgeR, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
56 library(limma, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
57 library(scales, quietly = TRUE, warn.conflicts = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
58 library(getopt, quietly = TRUE, warn.conflicts = FALSE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
59
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
60 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
61 ### Function Delcaration
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
62 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
63 # Function to sanitise contrast equations so there are no whitespaces
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
64 # surrounding the arithmetic operators, leading or trailing whitespace
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
65 sanitise_equation <- function(equation) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
66 equation <- gsub(" *[+] *", "+", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
67 equation <- gsub(" *[-] *", "-", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
68 equation <- gsub(" *[/] *", "/", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
69 equation <- gsub(" *[*] *", "*", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
70 equation <- gsub("^\\s+|\\s+$", "", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
71 return(equation)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
72 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
73
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
74 # Function to sanitise group information
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
75 sanitise_groups <- function(string) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
76 string <- gsub(" *[,] *", ",", string)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
77 string <- gsub("^\\s+|\\s+$", "", string)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
78 return(string)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
79 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
80
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
81 # Function to change periods to whitespace in a string
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
82 unmake_names <- function(string) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
83 string <- gsub(".", " ", string, fixed = TRUE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
84 return(string)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
85 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
86
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
87 # Generate output folder and paths
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
88 make_out <- function(filename) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
89 return(paste0(out_path, "/", filename))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
90 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
91
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
92 # Generating design information
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
93 paste_listname <- function(string) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
94 return(paste0("factors$", string))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
95 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
96
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
97 # Create cata function: default path set, default seperator empty and appending
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
98 # true by default (Ripped straight from the cat function with altered argument
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
99 # defaults)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
100 cata <- function(..., file = opt$htmlPath, sep = "", fill = FALSE, labels = NULL,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
101 append = TRUE) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
102 if (is.character(file)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
103 if (file == "") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
104 file <- stdout()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
105 } else if (substring(file, 1L, 1L) == "|") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
106 file <- pipe(substring(file, 2L), "w")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
107 on.exit(close(file))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
108 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
109 else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
110 file <- file(file, ifelse(append, "a", "w"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
111 on.exit(close(file))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
112 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
113 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
114 .Internal(cat(list(...), file, sep, fill, labels, append))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
115 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
116
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
117 # Function to write code for html head and title
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
118 html_head <- function(title) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
119 cata("<head>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
120 cata("<title>", title, "</title>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
121 cata("</head>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
122 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
123
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
124 # Function to write code for html links
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
125 html_link <- function(address, label = address) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
126 cata("<a href=\"", address, "\" target=\"_blank\">", label, "</a><br />\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
127 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
128
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
129 # Function to write code for html images
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
130 html_image <- function(source, label = source, height = 600, width = 600) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
131 cata("<img src=\"", source, "\" alt=\"", label, "\" height=\"", height)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
132 cata("\" width=\"", width, "\"/>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
133 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
134
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
135 # Function to write code for html list items
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
136 list_item <- function(...) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
137 cata("<li>", ..., "</li>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
138 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
139
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
140 table_item <- function(...) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
141 cata("<td>", ..., "</td>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
142 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
143
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
144 table_head_item <- function(...) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
145 cata("<th>", ..., "</th>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
146 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
147
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
148 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
149 ### Input Processing
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
150 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
151
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
152 # Collect arguments from command line
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
153 args <- commandArgs(trailingOnly = TRUE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
154
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
155 # Get options, using the spec as defined by the enclosed list.
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
156 # Read the options from the default: commandArgs(TRUE).
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
157 spec <- matrix(c(
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
158 "htmlPath", "R", 1, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
159 "outPath", "o", 1, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
160 "filesPath", "j", 2, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
161 "matrixPath", "m", 2, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
162 "factFile", "f", 2, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
163 "factInput", "i", 2, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
164 "annoPath", "a", 2, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
165 "contrastData", "C", 1, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
166 "cpmReq", "c", 1, "double",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
167 "totReq", "y", 0, "logical",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
168 "cntReq", "z", 1, "integer",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
169 "sampleReq", "s", 1, "integer",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
170 "normCounts", "x", 0, "logical",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
171 "rdaOpt", "r", 0, "logical",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
172 "lfcReq", "l", 1, "double",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
173 "pValReq", "p", 1, "double",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
174 "pAdjOpt", "d", 1, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
175 "normOpt", "n", 1, "character",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
176 "robOpt", "b", 0, "logical",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
177 "lrtOpt", "t", 0, "logical"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
178 ),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
179 byrow = TRUE, ncol = 4
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
180 )
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
181 opt <- getopt(spec)
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
182
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
183
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
184 if (is.null(opt$matrixPath) & is.null(opt$filesPath)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
185 cat("A counts matrix (or a set of counts files) is required.\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
186 q(status = 1)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
187 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
188
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
189 if (is.null(opt$cpmReq)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
190 filt_cpm <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
191 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
192 filt_cpm <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
193 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
194
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
195 if (is.null(opt$cntReq) || is.null(opt$sampleReq)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
196 filt_smpcount <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
197 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
198 filt_smpcount <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
199 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
200
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
201 if (is.null(opt$totReq)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
202 filt_totcount <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
203 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
204 filt_totcount <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
205 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
206
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
207 if (is.null(opt$lrtOpt)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
208 want_lrt <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
209 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
210 want_lrt <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
211 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
212
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
213 if (is.null(opt$rdaOpt)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
214 want_rda <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
215 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
216 want_rda <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
217 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
218
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
219 if (is.null(opt$annoPath)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
220 have_anno <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
221 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
222 have_anno <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
223 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
224
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
225 if (is.null(opt$normCounts)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
226 want_norm <- FALSE
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
227 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
228 want_norm <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
229 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
230
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
231 if (is.null(opt$robOpt)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
232 want_robust <- FALSE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
233 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
234 want_robust <- TRUE
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
235 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
236
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
237
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
238 if (!is.null(opt$filesPath)) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
239 # Process the separate count files (adapted from DESeq2 wrapper)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
240 library("rjson")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
241 parser <- newJSONParser()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
242 parser$addData(opt$filesPath)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
243 factor_list <- parser$getObject()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
244 factors <- sapply(factor_list, function(x) x[[1]])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
245 filenames_in <- unname(unlist(factor_list[[1]][[2]]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
246 sampletable <- data.frame(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
247 sample = basename(filenames_in),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
248 filename = filenames_in,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
249 row.names = filenames_in,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
250 stringsAsFactors = FALSE
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
251 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
252 for (factor in factor_list) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
253 factorname <- factor[[1]]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
254 sampletable[[factorname]] <- character(nrow(sampletable))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
255 lvls <- sapply(factor[[2]], function(x) names(x))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
256 for (i in seq_along(factor[[2]])) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
257 files <- factor[[2]][[i]][[1]]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
258 sampletable[files, factorname] <- lvls[i]
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
259 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
260 sampletable[[factorname]] <- factor(sampletable[[factorname]], levels = lvls)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
261 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
262 rownames(sampletable) <- sampletable$sample
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
263 rem <- c("sample", "filename")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
264 factors <- sampletable[, !(names(sampletable) %in% rem), drop = FALSE]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
265
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
266 # read in count files and create single table
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
267 countfiles <- lapply(sampletable$filename, function(x) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
268 read.delim(x, row.names = 1)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
269 })
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
270 counts <- do.call("cbind", countfiles)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
271 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
272 # Process the single count matrix
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
273 counts <- read.table(opt$matrixPath, header = TRUE, sep = "\t", strip.white = TRUE, stringsAsFactors = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
274 row.names(counts) <- counts[, 1]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
275 counts <- counts[, -1]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
276 countsrows <- nrow(counts)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
277
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
278 # Process factors
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
279 if (is.null(opt$factInput)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
280 factordata <- read.table(opt$factFile, header = TRUE, sep = "\t", strip.white = TRUE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
281 # check samples names match
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
282 if (!any(factordata[, 1] %in% colnames(counts))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
283 stop("Sample IDs in factors file and count matrix don't match")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
284 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
285 # order samples as in counts matrix
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
286 factordata <- factordata[match(colnames(counts), factordata[, 1]), ]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
287 factors <- factordata[, -1, drop = FALSE]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
288 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
289 factors <- unlist(strsplit(opt$factInput, "|", fixed = TRUE))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
290 factordata <- list()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
291 for (fact in factors) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
292 newfact <- unlist(strsplit(fact, split = "::"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
293 factordata <- rbind(factordata, newfact)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
294 } # Factors have the form: FACT_NAME::LEVEL,LEVEL,LEVEL,LEVEL,... The first factor is the Primary Factor.
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
295
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
296 # Set the row names to be the name of the factor and delete first row
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
297 row.names(factordata) <- factordata[, 1]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
298 factordata <- factordata[, -1]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
299 factordata <- sapply(factordata, sanitise_groups)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
300 factordata <- sapply(factordata, strsplit, split = ",")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
301 factordata <- sapply(factordata, make.names)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
302 # Transform factor data into data frame of R factor objects
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
303 factors <- data.frame(factordata)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
304 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
305 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
306
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
307 # if annotation file provided
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
308 if (have_anno) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
309 geneanno <- read.table(opt$annoPath, header = TRUE, sep = "\t", quote = "", strip.white = TRUE, stringsAsFactors = FALSE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
310 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
311
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
312 # Create output directory
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
313 out_path <- opt$outPath
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
314 dir.create(out_path, showWarnings = FALSE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
315
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
316 # Split up contrasts separated by comma into a vector then sanitise
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
317 contrast_data <- unlist(strsplit(opt$contrastData, split = ","))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
318 contrast_data <- sanitise_equation(contrast_data)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
319 contrast_data <- gsub(" ", ".", contrast_data, fixed = TRUE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
320
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
321 bcv_pdf <- make_out("bcvplot.pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
322 bcv_png <- make_out("bcvplot.png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
323 ql_pdf <- make_out("qlplot.pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
324 ql_png <- make_out("qlplot.png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
325 mds_pdf <- character() # Initialise character vector
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
326 mds_png <- character()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
327 for (i in seq_len(ncol(factors))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
328 mds_pdf[i] <- make_out(paste0("mdsplot_", names(factors)[i], ".pdf"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
329 mds_png[i] <- make_out(paste0("mdsplot_", names(factors)[i], ".png"))
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
330 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
331 md_pdf <- character()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
332 md_png <- character()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
333 top_out <- character()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
334 for (i in seq_along(contrast_data)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
335 md_pdf[i] <- make_out(paste0("mdplot_", contrast_data[i], ".pdf"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
336 md_png[i] <- make_out(paste0("mdplot_", contrast_data[i], ".png"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
337 top_out[i] <- make_out(paste0("edgeR_", contrast_data[i], ".tsv"))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
338 } # Save output paths for each contrast as vectors
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
339 norm_out <- make_out("edgeR_normcounts.tsv")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
340 rda_out <- make_out("edgeR_analysis.RData")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
341 session_out <- make_out("session_info.txt")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
342
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
343 # Initialise data for html links and images, data frame with columns Label and
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
344 # Link
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
345 link_data <- data.frame(Label = character(), Link = character(), stringsAsFactors = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
346 image_data <- data.frame(Label = character(), Link = character(), stringsAsFactors = FALSE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
347
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
348 # Initialise vectors for storage of up/down/neutral regulated counts
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
349 up_count <- numeric()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
350 down_count <- numeric()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
351 flat_count <- numeric()
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
352
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
353 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
354 ### Data Processing
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
355 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
356
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
357 # Extract counts and annotation data
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
358 data <- list()
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
359 data$counts <- counts
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
360 if (have_anno) {
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
361 # order annotation by genes in counts (assumes gene ids are in 1st column of geneanno)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
362 annoord <- geneanno[match(row.names(counts), geneanno[, 1]), ]
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
363 data$genes <- annoord
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
364 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
365 data$genes <- data.frame(GeneID = row.names(counts))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
366 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
367
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
368 # If filter crieteria set, filter out genes that do not have a required cpm/counts in a required number of
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
369 # samples. Default is no filtering
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
370 prefilter_count <- nrow(data$counts)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
371
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
372 if (filt_cpm || filt_smpcount || filt_totcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
373 if (filt_totcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
374 keep <- rowSums(data$counts) >= opt$cntReq
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
375 } else if (filt_smpcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
376 keep <- rowSums(data$counts >= opt$cntReq) >= opt$sampleReq
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
377 } else if (filt_cpm) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
378 keep <- rowSums(cpm(data$counts) >= opt$cpmReq) >= opt$sampleReq
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
379 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
380
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
381 data$counts <- data$counts[keep, ]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
382 data$genes <- data$genes[keep, , drop = FALSE]
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
383 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
384
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
385 postfilter_count <- nrow(data$counts)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
386 filtered_count <- prefilter_count - postfilter_count
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
387
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
388 # Name rows of factors according to their sample
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
389 row.names(factors) <- names(data$counts)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
390 factor_list <- sapply(names(factors), paste_listname)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
391
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
392 # Generating the DGEList object "data"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
393 samplenames <- colnames(data$counts)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
394 genes <- data$genes
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
395 data <- DGEList(data$counts)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
396 colnames(data) <- samplenames
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
397 data$samples <- factors
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
398 data$genes <- genes
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
399
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
400
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
401
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
402 formula <- "~0"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
403 for (i in seq_along(factor_list)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
404 formula <- paste(formula, factor_list[i], sep = "+")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
405 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
406
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
407 formula <- formula(formula)
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
408 design <- model.matrix(formula)
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
409
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
410 for (i in seq_along(factor_list)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
411 colnames(design) <- gsub(factor_list[i], "", colnames(design), fixed = TRUE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
412 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
413
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
414 # Calculating normalising factor, estimating dispersion
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
415 data <- calcNormFactors(data, method = opt$normOpt)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
416
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
417 if (want_robust) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
418 data <- estimateDisp(data, design = design, robust = TRUE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
419 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
420 data <- estimateDisp(data, design = design)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
421 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
422
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
423 # Generate contrasts information
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
424 contrasts <- makeContrasts(contrasts = contrast_data, levels = design)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
425
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
426 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
427 ### Data Output
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
428 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
429
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
430 # Plot MDS
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
431 labels <- names(counts)
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
432
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
433 # MDS plot
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
434 png(mds_png, width = 600, height = 600)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
435 plotMDS(data, labels = labels, col = as.numeric(factors[, 1]), cex = 0.8, main = paste("MDS Plot:", names(factors)[1]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
436 img_name <- paste0("MDS Plot_", names(factors)[1], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
437 img_addr <- paste0("mdsplot_", names(factors)[1], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
438 image_data[1, ] <- c(img_name, img_addr)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
439 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
440
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
441 pdf(mds_pdf)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
442 plotMDS(data, labels = labels, col = as.numeric(factors[, 1]), cex = 0.8, main = paste("MDS Plot:", names(factors)[1]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
443 link_name <- paste0("MDS Plot_", names(factors)[1], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
444 link_addr <- paste0("mdsplot_", names(factors)[1], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
445 link_data[1, ] <- c(link_name, link_addr)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
446 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
447
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
448 # If additional factors create additional MDS plots coloured by factor
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
449 if (ncol(factors) > 1) {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
450 for (i in 2:ncol(factors)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
451 png(mds_png[i], width = 600, height = 600)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
452 plotMDS(data, labels = labels, col = as.numeric(factors[, i]), cex = 0.8, main = paste("MDS Plot:", names(factors)[i]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
453 img_name <- paste0("MDS Plot_", names(factors)[i], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
454 img_addr <- paste0("mdsplot_", names(factors)[i], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
455 image_data <- rbind(image_data, c(img_name, img_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
456 invisible(dev.off())
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
457
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
458 pdf(mds_pdf[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
459 plotMDS(data, labels = labels, col = as.numeric(factors[, i]), cex = 0.8, main = paste("MDS Plot:", names(factors)[i]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
460 link_name <- paste0("MDS Plot_", names(factors)[i], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
461 link_addr <- paste0("mdsplot_", names(factors)[i], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
462 link_data <- rbind(link_data, c(link_name, link_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
463 invisible(dev.off())
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
464 }
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
465 }
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
466
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
467 # BCV Plot
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
468 png(bcv_png, width = 600, height = 600)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
469 plotBCV(data, main = "BCV Plot")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
470 img_name <- "BCV Plot"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
471 img_addr <- "bcvplot.png"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
472 image_data <- rbind(image_data, c(img_name, img_addr))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
473 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
474
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
475 pdf(bcv_pdf)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
476 plotBCV(data, main = "BCV Plot")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
477 link_name <- paste0("BCV Plot.pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
478 link_addr <- paste0("bcvplot.pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
479 link_data <- rbind(link_data, c(link_name, link_addr))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
480 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
481
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
482 # Generate fit
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
483 if (want_lrt) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
484 fit <- glmFit(data, design)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
485 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
486 if (want_robust) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
487 fit <- glmQLFit(data, design, robust = TRUE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
488 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
489 fit <- glmQLFit(data, design)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
490 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
491
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
492 # Plot QL dispersions
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
493 png(ql_png, width = 600, height = 600)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
494 plotQLDisp(fit, main = "QL Plot")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
495 img_name <- "QL Plot"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
496 img_addr <- "qlplot.png"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
497 image_data <- rbind(image_data, c(img_name, img_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
498 invisible(dev.off())
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
499
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
500 pdf(ql_pdf)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
501 plotQLDisp(fit, main = "QL Plot")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
502 link_name <- "QL Plot.pdf"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
503 link_addr <- "qlplot.pdf"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
504 link_data <- rbind(link_data, c(link_name, link_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
505 invisible(dev.off())
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
506 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
507
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
508 # Save normalised counts (log2cpm)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
509 if (want_norm) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
510 normalised_counts <- cpm(data, normalized.lib.sizes = TRUE, log = TRUE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
511 normalised_counts <- data.frame(data$genes, normalised_counts)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
512 write.table(normalised_counts, file = norm_out, row.names = FALSE, sep = "\t", quote = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
513 link_data <- rbind(link_data, c("edgeR_normcounts.tsv", "edgeR_normcounts.tsv"))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
514 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
515
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
516
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
517 for (i in seq_along(contrast_data)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
518 if (want_lrt) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
519 res <- glmLRT(fit, contrast = contrasts[, i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
520 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
521 res <- glmQLFTest(fit, contrast = contrasts[, i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
522 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
523
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
524 status <- decideTestsDGE(res,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
525 adjust.method = opt$pAdjOpt, p.value = opt$pValReq,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
526 lfc = opt$lfcReq
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
527 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
528 sum_status <- summary(status)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
529
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
530 # Collect counts for differential expression
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
531 up_count[i] <- sum_status["Up", ]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
532 down_count[i] <- sum_status["Down", ]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
533 flat_count[i] <- sum_status["NotSig", ]
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
534
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
535 # Write top expressions table
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
536 top <- topTags(res, adjust.method = opt$pAdjOpt, n = Inf, sort.by = "PValue")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
537 write.table(top, file = top_out[i], row.names = FALSE, sep = "\t", quote = FALSE)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
538
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
539 link_name <- paste0("edgeR_", contrast_data[i], ".tsv")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
540 link_addr <- paste0("edgeR_", contrast_data[i], ".tsv")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
541 link_data <- rbind(link_data, c(link_name, link_addr))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
542
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
543 # Plot MD (log ratios vs mean difference) using limma package
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
544 pdf(md_pdf[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
545 limma::plotMD(res,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
546 status = status,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
547 main = paste("MD Plot:", unmake_names(contrast_data[i])),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
548 hl.col = alpha(c("firebrick", "blue"), 0.4), values = c(1, -1),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
549 xlab = "Average Expression", ylab = "logFC"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
550 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
551
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
552 abline(h = 0, col = "grey", lty = 2)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
553
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
554 link_name <- paste0("MD Plot_", contrast_data[i], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
555 link_addr <- paste0("mdplot_", contrast_data[i], ".pdf")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
556 link_data <- rbind(link_data, c(link_name, link_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
557 invisible(dev.off())
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
558
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
559 png(md_png[i], height = 600, width = 600)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
560 limma::plotMD(res,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
561 status = status,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
562 main = paste("MD Plot:", unmake_names(contrast_data[i])),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
563 hl.col = alpha(c("firebrick", "blue"), 0.4), values = c(1, -1),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
564 xlab = "Average Expression", ylab = "logFC"
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
565 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
566
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
567 abline(h = 0, col = "grey", lty = 2)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
568
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
569 img_name <- paste0("MD Plot_", contrast_data[i], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
570 img_addr <- paste0("mdplot_", contrast_data[i], ".png")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
571 image_data <- rbind(image_data, c(img_name, img_addr))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
572 invisible(dev.off())
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
573 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
574 sig_diff <- data.frame(Up = up_count, Flat = flat_count, Down = down_count)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
575 row.names(sig_diff) <- contrast_data
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
576
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
577 # Save relevant items as rda object
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
578 if (want_rda) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
579 if (want_norm) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
580 save(counts, data, status, normalised_counts, labels, factors, fit, res, top, contrasts, design,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
581 file = rda_out, ascii = TRUE
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
582 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
583 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
584 save(counts, data, status, labels, factors, fit, res, top, contrasts, design,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
585 file = rda_out, ascii = TRUE
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
586 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
587 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
588 link_data <- rbind(link_data, c("edgeR_analysis.RData", "edgeR_analysis.RData"))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
589 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
590
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
591 # Record session info
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
592 writeLines(capture.output(sessionInfo()), session_out)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
593 link_data <- rbind(link_data, c("Session Info", "session_info.txt"))
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
594
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
595 # Record ending time and calculate total run time
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
596 time_end <- as.character(Sys.time())
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
597 time_taken <- capture.output(round(difftime(time_end, time_start), digits = 3))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
598 time_taken <- gsub("Time difference of ", "", time_taken, fixed = TRUE)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
599
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
600 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
601 ### HTML Generation
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
602 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
603
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
604 # Clear file
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
605 cat("", file = opt$htmlPath)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
606
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
607 cata("<html>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
608
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
609 cata("<body>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
610 cata("<h3>edgeR Analysis Output:</h3>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
611 cata("Links to PDF copies of plots are in 'Plots' section below.<br />\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
612
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
613 html_image(image_data$Link[1], image_data$Label[1])
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
614
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
615 for (i in 2:nrow(image_data)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
616 html_image(image_data$Link[i], image_data$Label[i])
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
617 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
618
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
619 cata("<h4>Differential Expression Counts:</h4>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
620
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
621 cata("<table border=\"1\" cellpadding=\"4\">\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
622 cata("<tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
623 table_item()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
624 for (i in colnames(sig_diff)) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
625 table_head_item(i)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
626 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
627 cata("</tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
628 for (i in seq_len(nrow(sig_diff))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
629 cata("<tr>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
630 table_head_item(unmake_names(row.names(sig_diff)[i]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
631 for (j in seq_len(ncol(sig_diff))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
632 table_item(as.character(sig_diff[i, j]))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
633 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
634 cata("</tr>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
635 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
636 cata("</table>")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
637
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
638 cata("<h4>Plots:</h4>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
639 for (i in seq_len(nrow(link_data))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
640 if (grepl(".pdf", link_data$Link[i])) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
641 html_link(link_data$Link[i], link_data$Label[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
642 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
643 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
644
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
645 cata("<h4>Tables:</h4>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
646 for (i in seq_len(nrow(link_data))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
647 if (grepl(".tsv", link_data$Link[i])) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
648 html_link(link_data$Link[i], link_data$Label[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
649 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
650 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
651
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
652 if (want_rda) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
653 cata("<h4>R Data Objects:</h4>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
654 for (i in seq_len(nrow(link_data))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
655 if (grepl(".RData", link_data$Link[i])) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
656 html_link(link_data$Link[i], link_data$Label[i])
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
657 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
658 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
659 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
660
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
661 cata("<p>Alt-click links to download file.</p>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
662 cata("<p>Click floppy disc icon associated history item to download ")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
663 cata("all files.</p>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
664 cata("<p>.tsv files can be viewed in Excel or any spreadsheet program.</p>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
665
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
666 cata("<h4>Additional Information</h4>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
667 cata("<ul>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
668
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
669 if (filt_cpm || filt_smpcount || filt_totcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
670 if (filt_cpm) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
671 temp_str <- paste(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
672 "Genes without more than", opt$cpmReq,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
673 "CPM in at least", opt$sampleReq, "samples are insignificant",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
674 "and filtered out."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
675 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
676 } else if (filt_smpcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
677 temp_str <- paste(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
678 "Genes without more than", opt$cntReq,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
679 "counts in at least", opt$sampleReq, "samples are insignificant",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
680 "and filtered out."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
681 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
682 } else if (filt_totcount) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
683 temp_str <- paste(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
684 "Genes without more than", opt$cntReq,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
685 "counts, after summing counts for all samples, are insignificant",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
686 "and filtered out."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
687 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
688 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
689
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
690 list_item(temp_str)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
691 filter_prop <- round(filtered_count / prefilter_count * 100, digits = 2)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
692 temp_str <- paste0(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
693 filtered_count, " of ", prefilter_count, " (", filter_prop,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
694 "%) genes were filtered out for low expression."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
695 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
696 list_item(temp_str)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
697 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
698 list_item(opt$normOpt, " was the method used to normalise library sizes.")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
699 if (want_lrt) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
700 list_item("The edgeR likelihood ratio test was used.")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
701 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
702 if (want_robust) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
703 list_item("The edgeR quasi-likelihood test was used with robust settings (robust=TRUE with estimateDisp and glmQLFit).")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
704 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
705 list_item("The edgeR quasi-likelihood test was used.")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
706 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
707 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
708 if (opt$pAdjOpt != "none") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
709 if (opt$pAdjOpt == "BH" || opt$pAdjOpt == "BY") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
710 temp_str <- paste0(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
711 "MD-Plot highlighted genes are significant at FDR ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
712 "of ", opt$pValReq, " and exhibit log2-fold-change of at ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
713 "least ", opt$lfcReq, "."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
714 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
715 list_item(temp_str)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
716 } else if (opt$pAdjOpt == "holm") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
717 temp_str <- paste0(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
718 "MD-Plot highlighted genes are significant at adjusted ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
719 "p-value of ", opt$pValReq, " by the Holm(1979) ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
720 "method, and exhibit log2-fold-change of at least ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
721 opt$lfcReq, "."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
722 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
723 list_item(temp_str)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
724 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
725 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
726 temp_str <- paste0(
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
727 "MD-Plot highlighted genes are significant at p-value ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
728 "of ", opt$pValReq, " and exhibit log2-fold-change of at ",
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
729 "least ", opt$lfcReq, "."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
730 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
731 list_item(temp_str)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
732 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
733 cata("</ul>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
734
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
735 cata("<h4>Summary of experimental data:</h4>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
736
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
737 cata("<p>*CHECK THAT SAMPLES ARE ASSOCIATED WITH CORRECT GROUP(S)*</p>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
738
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
739 cata("<table border=\"1\" cellpadding=\"3\">\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
740 cata("<tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
741 table_head_item("SampleID")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
742 table_head_item(names(factors)[1], " (Primary Factor)")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
743
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
744 if (ncol(factors) > 1) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
745 for (i in names(factors)[2:length(names(factors))]) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
746 table_head_item(i)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
747 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
748 cata("</tr>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
749 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
750
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
751 for (i in seq_len(nrow((factors)))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
752 cata("<tr>\n")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
753 table_head_item(row.names(factors)[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
754 for (j in seq_len(ncol(factors))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
755 table_item(as.character(unmake_names(factors[i, j])))
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
756 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
757 cata("</tr>\n")
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
758 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
759 cata("</table>")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
760
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
761 for (i in seq_len(nrow(link_data))) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
762 if (grepl("session_info", link_data$Link[i])) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
763 html_link(link_data$Link[i], link_data$Label[i])
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
764 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
765 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
766
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
767 cata("<table border=\"0\">\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
768 cata("<tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
769 table_item("Task started at:")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
770 table_item(time_start)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
771 cata("</tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
772 cata("<tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
773 table_item("Task ended at:")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
774 table_item(time_end)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
775 cata("</tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
776 cata("<tr>\n")
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
777 table_item("Task run time:")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
778 table_item(time_taken)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
779 cata("<tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
780 cata("</table>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
781
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
782 cata("</body>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
783 cata("</html>")