annotate edger.R @ 14:070900306913 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
author iuc
date Wed, 11 Oct 2023 11:13:07 +0000
parents 0cb907a2a810
children 5bf899c13979
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
14
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
11 # formula", "F", 2, "character". -String containing a formula to override default use of factInput
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
12 # 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
13 # 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
14 # 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
15 # 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
16 # 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
17 # 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
18 # 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
19 # 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
20 # 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
21 # 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
22 # 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
23 # 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
24 # 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
25 #
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
26 # OUT:
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
27 # MDS Plot
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
28 # BCV Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
29 # QL Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
30 # MD Plot
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
31 # Expression Table
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
32 # 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
33 # Optional:
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
34 # Normalised counts Table
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
35 # RData file
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
36 #
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
37 # 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
38 # 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
39
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
40 # 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
41 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
42
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
43 # setup R error handling to go to stderr
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
diff changeset
44 options(show.error.messages = FALSE, error = function() {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
45 cat(geterrmessage(), file = stderr())
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
diff changeset
46 q("no", 1, FALSE)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
47 })
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
48
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
49 # 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
50 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
51
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
52 # 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
53 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
54 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
55 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
56 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
57 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
58 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
59 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
60
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
61 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
62 ### Function Delcaration
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
63 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
64 # 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
65 # 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
66 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
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(" *[*] *", "*", equation)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
71 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
72 return(equation)
0
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
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
75 # 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
76 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
77 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
78 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
79 return(string)
0
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
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
82 # 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
83 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
84 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
85 return(string)
0
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
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
88 # 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
89 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
90 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
91 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
92
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
93 # 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
94 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
95 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
96 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
97
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
98 # 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
99 # 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
100 # defaults)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
101 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
102 append = TRUE) {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
103 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
104 if (file == "") {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
105 file <- stdout()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
106 } 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
107 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
108 on.exit(close(file))
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
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",
14
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
163 "formula", "F", 2, "character",
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
164 "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
165 "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
166 "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
167 "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
168 "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
169 "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
170 "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
171 "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
172 "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
173 "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
174 "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
175 "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
176 "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
177 "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
178 "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
179 ),
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
180 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
181 )
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
182 opt <- getopt(spec)
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
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
diff changeset
185 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
186 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
187 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
188 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
189
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
190 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
191 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
192 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
193 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
194 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
195
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
196 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
197 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
198 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
199 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
200 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
201
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
202 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
203 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
204 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
205 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
206 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
207
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
208 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
209 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
210 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
211 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
212 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
213
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
214 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
215 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
216 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
217 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
218 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
219
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
220 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
221 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
222 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
223 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
224 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
225
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
226 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
227 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
228 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
229 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
230 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
231
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
232 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
233 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
234 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
235 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
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
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
239 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
240 # 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
241 library("rjson")
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
242 parser <- newJSONParser()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
243 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
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251 stringsAsFactors = FALSE
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
252 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
261 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
262 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
263 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
264 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
265 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
266
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
267 # 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
268 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
269 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
270 })
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
271 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
272 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
273 # 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
274 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
275 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
276 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
277 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
278
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
279 # Process factors
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
280 if (is.null(opt$factInput)) {
9
6e53e565fc6a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 8
diff changeset
281 factordata <- read.table(opt$factFile, header = TRUE, sep = "\t", strip.white = TRUE, stringsAsFactors = TRUE)
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
282 # 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
283 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
284 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
285 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
286 # 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
287 factordata <- factordata[match(colnames(counts), factordata[, 1]), ]
13
0cb907a2a810 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 95a36f5b0bd139f161d131b4c2c9c36940e749c6
iuc
parents: 12
diff changeset
288 factors <- data.frame(sapply(factordata[, -1, drop = FALSE], make.names))
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
289 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
290 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
291 factordata <- list()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
292 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
293 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
294 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
295 } # 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
296
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
297 # 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
298 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
299 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
300 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
301 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
302 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
303 # 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
304 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
305 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
306 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
307
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
308 # 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
309 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
310 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
311 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
312
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
313 # 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
314 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
315 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
316
14
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
317 # Check if contrastData is a file or not
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
318 if (file.exists(opt$contrastData)) {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
319 contrast_data <- unlist(read.table(opt$contrastData, sep = "\t", header = TRUE)[[1]])
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
320 } else {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
321 # Split up contrasts separated by comma into a vector then sanitise
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
322 contrast_data <- unlist(strsplit(opt$contrastData, split = ","))
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
323 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
324 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
325 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
326
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
337 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
338 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
339 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
340 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
341 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
342 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
343 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
344 } # 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
345 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
346 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
347 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
348
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
349 # 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
350 # Link
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
351 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
352 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
353
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
354 # 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
355 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
356 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
357 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
358
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
359 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
360 ### Data Processing
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
361 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
362
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
363 # 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
364 data <- list()
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
365 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
366 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
367 # 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
368 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
369 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
370 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
371 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
372 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
373
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
374 # 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
375 # 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
376 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
377
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
378 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
379 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
380 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
381 } 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
382 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
383 } 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
384 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
385 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
386
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
387 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
388 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
389 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
390
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
391 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
392 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
393
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
394 # 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
395 row.names(factors) <- names(data$counts)
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
diff changeset
396 factor_list <- names(factors)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
397
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
398 # 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
399 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
400 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
401 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
402 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
403 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
404 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
405
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
406
14
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
407 if (!is.null(opt$formula)) {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
408 formula <- opt$formula
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
409 # sanitisation can be getting rid of the "~"
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
410 if (!startsWith(formula, "~")) {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
411 formula <- paste0("~", formula)
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
412 }
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
413 } else {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
414 formula <- "~0"
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
415 for (i in seq_along(factor_list)) {
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
416 formula <- paste(formula, factor_list[i], sep = "+")
070900306913 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 0c79416d9612d0ebdcb7c3c0543d510e11bb0774
iuc
parents: 13
diff changeset
417 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
418 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
419
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
420 formula <- formula(formula)
12
a8305cf0c951 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
iuc
parents: 9
diff changeset
421 design <- model.matrix(formula, factors)
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
422
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
423 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
424 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
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 # 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
428 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
429
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
430 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
431 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
432 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
433 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
434 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
435
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
436 # 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
437 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
438
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
439 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
440 ### Data Output
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
441 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
442
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
443 # Plot MDS
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
444 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
445
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
446 # 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
447 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
448 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
449 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
450 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
451 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
452 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
453
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
454 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
455 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
456 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
457 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
458 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
459 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
460
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
461 # 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
471 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
472 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
473 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
474 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
475 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
476 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
477 }
3
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
478 }
d79ed3ec25fe planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit e646be741e315df9332b5206cec1e47c11370ff1
iuc
parents: 2
diff changeset
479
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
480 # 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
481 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
482 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
483 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
484 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
485 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
486 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
487
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
488 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
489 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
490 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
491 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
492 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
493 invisible(dev.off())
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
494
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
495 # 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
496 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
497 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
498 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
499 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
500 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
501 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
502 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
503 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
504
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
505 # 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
506 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
507 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
508 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
509 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
510 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
511 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
512
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
513 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
514 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
515 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
516 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
517 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
518 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
519 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
520
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
521 # 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
522 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
523 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
524 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
525 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
526 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
527 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
528
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 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
531 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
532 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
533 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
534 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
535 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
536
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
537 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
538 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
539 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
540 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
541 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
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 # 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
544 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
545 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
546 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
547
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
548 # 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
549 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
550 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
551
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
552 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
553 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
554 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
555
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
556 # 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
557 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
558 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
559 status = status,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
560 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
561 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
562 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
563 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
564
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
565 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
566
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
567 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
568 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
569 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
570 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
571
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
572 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
573 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
574 status = status,
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
575 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
576 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
577 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
578 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
579
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
580 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
581
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
582 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
583 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
584 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
585 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
586 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
587 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
588 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
589
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
590 # 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
591 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
592 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
593 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
594 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
595 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
596 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
597 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
598 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
599 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
600 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
601 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
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 # 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
605 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
606 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
607
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
608 # 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
609 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
610 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
611 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
612
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
613 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
614 ### HTML Generation
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
615 ################################################################################
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
616
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
617 # 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
618 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
619
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
620 cata("<html>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
621
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
622 cata("<body>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
623 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
624 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
625
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
626 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
627
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 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
629 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
630 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
631
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
632 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
633
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
634 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
635 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
636 table_item()
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
637 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
638 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
639 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
640 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
641 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
642 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
643 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
644 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
645 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
646 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
647 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
648 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
649 cata("</table>")
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 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
652 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
653 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
654 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
655 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
656 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
657
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
658 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
659 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
660 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
661 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
662 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
663 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
664
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
665 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
666 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
667 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
668 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
669 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
670 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
671 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
672 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
673
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
674 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
675 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
676 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
677 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
678
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
679 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
680 cata("<ul>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
681
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
682 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
683 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
684 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
685 "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
686 "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
687 "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
688 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
689 } 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
690 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
691 "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
692 "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
693 "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
694 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
695 } 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
696 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
697 "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
698 "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
699 "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
700 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
701 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
702
8
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(temp_str)
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
704 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
705 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
706 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
707 "%) 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
708 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
709 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
710 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
711 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
712 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
713 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
714 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
715 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
716 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
717 } else {
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
718 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
719 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
720 }
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
721 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
722 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
723 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
724 "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
725 "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
726 "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
727 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
728 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
729 } 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
730 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
731 "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
732 "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
733 "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
734 opt$lfcReq, "."
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
735 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
736 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
737 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
738 } else {
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
739 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
740 "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
741 "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
742 "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
743 )
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
744 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
745 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
746 cata("</ul>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
747
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
748 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
749
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
750 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
751
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
752 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
753 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
754 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
755 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
756
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
757 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
758 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
759 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
760 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
761 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
762 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
763
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
764 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
765 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
766 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
767 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
768 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
769 }
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
770 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
771 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
772 cata("</table>")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
773
8
3d89af8a44f0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 215a0f27f3de87506895ac655f801c40e8c7edbc"
iuc
parents: 6
diff changeset
774 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
775 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
776 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
777 }
0
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
778 }
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
779
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
780 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
781 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
782 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
783 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
784 cata("</tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
785 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
786 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
787 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
788 cata("</tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
789 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
790 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
791 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
792 cata("<tr>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
793 cata("</table>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
794
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
795 cata("</body>\n")
9bdff28ae1b1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit eac022c9c6e51e661c1513306b9fefdad673487d
iuc
parents:
diff changeset
796 cata("</html>")