annotate limma_voom.R @ 26:119b069fc845 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
author iuc
date Fri, 09 Feb 2024 17:06:25 +0000
parents 708348a17fa1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1 # This tool takes in a matrix of feature counts as well as gene annotations and
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
2 # outputs a table of top expressions as well as various plots for differential
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
3 # expression analysis
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
4 #
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
5 # ARGS: htmlPath", "R", 1, "character" -Path to html file linking to other outputs
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
6 # outPath", "o", 1, "character" -Path to folder to write all output to
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
7 # filesPath", "j", 2, "character" -JSON list object if multiple files input
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
8 # matrixPath", "m", 2, "character" -Path to count matrix
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
9 # factFile", "f", 2, "character" -Path to factor information file
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
10 # factInput", "i", 2, "character" -String containing factors if manually input
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
11 # annoPath", "a", 2, "character" -Path to input containing gene annotations
19
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
12 # contrastFile", "C", 1, "character" -Path to contrasts information file
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
13 # contrastInput", "D", 1, "character" -String containing contrasts of interest
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
14 # cpmReq", "c", 2, "double" -Float specifying cpm requirement
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
15 # cntReq", "z", 2, "integer" -Integer specifying minimum total count requirement
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
16 # sampleReq", "s", 2, "integer" -Integer specifying cpm requirement
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
17 # normCounts", "x", 0, "logical" -String specifying if normalised counts should be output
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
18 # rdaOpt", "r", 0, "logical" -String specifying if RData should be output
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
19 # lfcReq", "l", 1, "double" -Float specifying the log-fold-change requirement
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
20 # pValReq", "p", 1, "double" -Float specifying the p-value requirement
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
21 # pAdjOpt", "d", 1, "character" -String specifying the p-value adjustment method
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
22 # normOpt", "n", 1, "character" -String specifying type of normalisation used
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
23 # robOpt", "b", 0, "logical" -String specifying if robust options should be used
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
24 # trend", "t", 1, "double" -Float for prior.count if limma-trend is used instead of voom
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
25 # weightOpt", "w", 0, "logical" -String specifying if voomWithQualityWeights should be used
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
26 # topgenes", "G", 1, "integer" -Integer specifying no. of genes to highlight in volcano and heatmap
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
27 # treatOpt", "T", 0, "logical" -String specifying if TREAT function should be used
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
28 # plots, "P", 1, "character" -String specifying additional plots to be created
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
29 #
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
30 # OUT:
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
31 # Density Plots (if filtering)
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
32 # Box Plots (if normalising)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
33 # MDS Plot
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
34 # Voom/SA plot
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
35 # MD Plot
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
36 # Volcano Plot
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
37 # Heatmap
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
38 # Expression Table
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
39 # HTML file linking to the ouputs
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
40 # Optional:
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
41 # Normalised counts Table
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
42 # RData file
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
43 #
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
44 #
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
45 # Author: Shian Su - registertonysu@gmail.com - Jan 2014
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
46 # Modified by: Maria Doyle - Jun 2017, Jan 2018, May 2018
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
47
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
48 # Record starting time
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
49 time_start <- Sys.time()
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
50
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
51 # Setup R error handling to go to stderr
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
52 options(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
53 show.error.messages = FALSE,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
54 error = function() {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
55 cat(geterrmessage(), file = stderr())
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
56 q("no", 1, FALSE)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
57 }
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
58 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
59
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
60 # Unify locale settings
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
61 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
62
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
63 warnings()
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
64
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
65 # Load all required libraries
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
66 library(methods, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
67 library(statmod, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
68 library(splines, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
69 library(edgeR, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
70 library(limma, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
71 library(scales, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
72 library(getopt, quietly = TRUE, warn.conflicts = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
73 library(gplots, quietly = TRUE, warn.conflicts = FALSE)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
74
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
75 ################################################################################
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
76 ### Function Declaration
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
77 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
78 # Function to sanitise contrast equations so there are no whitespaces
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
79 # surrounding the arithmetic operators, leading or trailing whitespace
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
80 sanitise_equation <- function(equation) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
81 equation <- gsub(" *[+] *", "+", equation)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
82 equation <- gsub(" *[-] *", "-", equation)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
83 equation <- gsub(" *[/] *", "/", equation)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
84 equation <- gsub(" *[*] *", "*", equation)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
85 equation <- gsub("^\\s+|\\s+$", "", equation)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
86 return(equation)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
87 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
88
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
89 # Function to sanitise group information
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
90 sanitise_groups <- function(string) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
91 string <- gsub(" *[,] *", ",", string)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
92 string <- gsub("^\\s+|\\s+$", "", string)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
93 return(string)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
94 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
95
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
96 # Function to make contrast contain valid R names
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
97 sanitise_contrast <- function(string) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
98 string <- strsplit(string, split = "-")
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
99 string <- lapply(string, make.names)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
100 string <- lapply(string, paste, collapse = "-")
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
101 return(string)
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
102 }
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
103
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
104 # Function to change periods to whitespace in a string
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
105 unmake_names <- function(string) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
106 string <- gsub(".", " ", string, fixed = TRUE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
107 return(string)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
108 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
109
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
110 # Generate output folder and paths
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
111 make_out <- function(filename) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
112 return(paste0(opt$outPath, "/", filename))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
113 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
114
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
115 # Generating design information
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
116 paste_listname <- function(string) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
117 return(paste0("factors$", string))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
118 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
119
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
120 # Create cata function: default path set, default seperator empty and appending
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
121 # true by default (Ripped straight from the cat function with altered argument
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
122 # defaults)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
123 cata <- function(..., file = opt$htmlPath, sep = "", fill = FALSE,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
124 labels = NULL, append = TRUE) {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
125 if (is.character(file)) {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
126 if (file == "") {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
127 file <- stdout()
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
128 } else if (substring(file, 1L, 1L) == "|") {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
129 file <- pipe(substring(file, 2L), "w")
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
130 on.exit(close(file))
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
131 } else {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
132 file <- file(file, ifelse(append, "a", "w"))
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
133 on.exit(close(file))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
134 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
135 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
136 .Internal(cat(list(...), file, sep, fill, labels, append))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
137 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
138
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
139 # Function to write code for html head and title
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
140 html_head <- function(title) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
141 cata("<head>\n")
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
142 cata("<title>", title, "</title>\n")
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
143 cata("</head>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
144 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
145
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
146 # Function to write code for html links
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
147 html_link <- function(address, label = address) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
148 cata("<a href=\"", address, "\" target=\"_blank\">", label, "</a><br />\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
149 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
150
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
151 # Function to write code for html images
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
152 html_image <- function(source, label = source, height = 500, width = 500) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
153 cata("<img src=\"", source, "\" alt=\"", label, "\" height=\"", height)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
154 cata("\" width=\"", width, "\"/>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
155 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
156
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
157 # Function to write code for html list items
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
158 list_item <- function(...) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
159 cata("<li>", ..., "</li>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
160 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
161
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
162 table_item <- function(...) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
163 cata("<td>", ..., "</td>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
164 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
165
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
166 table_head_item <- function(...) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
167 cata("<th>", ..., "</th>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
168 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
169
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
170 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
171 ### Input Processing
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
172 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
173
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
174 # Collect arguments from command line
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
175 args <- commandArgs(trailingOnly = TRUE)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
176
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
177 # Get options, using the spec as defined by the enclosed list.
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
178 # Read the options from the default: commandArgs(TRUE).
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
179 spec <- matrix(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
180 c(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
181 "htmlPath", "R", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
182 "outPath", "o", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
183 "filesPath", "j", 2, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
184 "matrixPath", "m", 2, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
185 "factFile", "f", 2, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
186 "factInput", "i", 2, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
187 "annoPath", "a", 2, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
188 "contrastFile", "C", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
189 "contrastInput", "D", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
190 "cpmReq", "c", 1, "double",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
191 "totReq", "y", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
192 "cntReq", "z", 1, "integer",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
193 "sampleReq", "s", 1, "integer",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
194 "filtCounts", "F", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
195 "normCounts", "x", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
196 "rdaOpt", "r", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
197 "lfcReq", "l", 1, "double",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
198 "pValReq", "p", 1, "double",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
199 "pAdjOpt", "d", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
200 "normOpt", "n", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
201 "robOpt", "b", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
202 "trend", "t", 1, "double",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
203 "weightOpt", "w", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
204 "topgenes", "G", 1, "integer",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
205 "treatOpt", "T", 0, "logical",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
206 "plots", "P", 1, "character",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
207 "libinfoOpt", "L", 0, "logical"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
208 ),
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
209 byrow = TRUE, ncol = 4
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
210 )
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
211 opt <- getopt(spec)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
212
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
213
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
214 if (is.null(opt$matrixPath) && is.null(opt$filesPath)) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
215 cat("A counts matrix (or a set of counts files) is required.\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
216 q(status = 1)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
217 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
218
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
219 if (is.null(opt$cpmReq)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
220 filt_cpm <- FALSE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
221 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
222 filt_cpm <- TRUE
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
223 }
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
224
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
225 if (is.null(opt$cntReq) || is.null(opt$sampleReq)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
226 filt_smpcount <- FALSE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
227 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
228 filt_smpcount <- TRUE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
229 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
230
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
231 if (is.null(opt$totReq)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
232 filt_totcount <- FALSE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
233 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
234 filt_totcount <- TRUE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
235 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
236
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
237 if (is.null(opt$rdaOpt)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
238 want_rda <- FALSE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
239 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
240 want_rda <- TRUE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
241 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
242
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
243 if (is.null(opt$annoPath)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
244 have_anno <- FALSE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
245 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
246 have_anno <- TRUE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
247 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
248
12
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
249 if (is.null(opt$filtCounts)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
250 want_filt <- FALSE
12
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
251 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
252 want_filt <- TRUE
12
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
253 }
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
254
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
255 if (is.null(opt$normCounts)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
256 want_norm <- FALSE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
257 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
258 want_norm <- TRUE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
259 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
260
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
261 if (is.null(opt$robOpt)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
262 want_robust <- FALSE
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
263 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
264 want_robust <- TRUE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
265 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
266
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
267 if (is.null(opt$weightOpt)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
268 want_weight <- FALSE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
269 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
270 want_weight <- TRUE
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
271 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
272
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
273 if (is.null(opt$trend)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
274 want_trend <- FALSE
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
275 de_method <- "limma-voom"
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
276 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
277 want_trend <- TRUE
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
278 de_method <- "limma-trend"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
279 prior_count <- opt$trend
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
280 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
281
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
282 if (is.null(opt$treatOpt)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
283 want_treat <- FALSE
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
284 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
285 want_treat <- TRUE
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
286 }
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
287
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
288 if (is.null(opt$libinfoOpt)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
289 want_libinfo <- FALSE
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
290 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
291 want_libinfo <- TRUE
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
292 }
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
293
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
294
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
295 if (!is.null(opt$filesPath)) {
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
296 # Process the separate count files (adapted from DESeq2 wrapper)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
297 library("rjson")
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
298 parser <- newJSONParser()
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
299 parser$addData(opt$filesPath)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
300 factor_list <- parser$getObject()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
301 factors <- sapply(factor_list, function(x) x[[1]])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
302 filenames_in <- unname(unlist(factor_list[[1]][[2]]))
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
303 sampletable <- data.frame(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
304 sample = basename(filenames_in),
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
305 filename = filenames_in,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
306 row.names = filenames_in,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
307 stringsAsFactors = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
308 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
309 for (factor in factor_list) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
310 factorname <- factor[[1]]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
311 sampletable[[factorname]] <- character(nrow(sampletable))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
312 lvls <- sapply(factor[[2]], function(x) names(x))
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
313 for (i in seq_along(factor[[2]])) {
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
314 files <- factor[[2]][[i]][[1]]
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
315 sampletable[files, factorname] <- lvls[i]
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
316 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
317 sampletable[[factorname]] <- factor(sampletable[[factorname]], levels = lvls)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
318 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
319 rownames(sampletable) <- sampletable$sample
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
320 rem <- c("sample", "filename")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
321 factors <- sampletable[, !(names(sampletable) %in% rem), drop = FALSE]
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
322
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
323 # read in count files and create single table
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
324 countfiles <- lapply(sampletable$filename, function(x) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
325 read.delim(x, row.names = 1)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
326 })
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
327 counts <- do.call("cbind", countfiles)
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
328 } else {
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
329 # Process the single count matrix
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
330 counts <- read.table(opt$matrixPath, header = TRUE, sep = "\t", strip.white = TRUE, stringsAsFactors = FALSE, check.names = FALSE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
331 row.names(counts) <- counts[, 1]
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
332 counts <- counts[, -1]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
333 countsrows <- nrow(counts)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
334
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
335 # Process factors
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
336 if (is.null(opt$factInput)) {
22
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
337 factordata <- read.table(opt$factFile, header = TRUE, sep = "\t", strip.white = TRUE, stringsAsFactors = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
338 if (!setequal(factordata[, 1], colnames(counts))) {
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
339 stop("Sample IDs in counts and factors files don't match")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
340 }
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
341 # order samples as in counts matrix
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
342 factordata <- factordata[match(colnames(counts), factordata[, 1]), ]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
343 factors <- factordata[, -1, drop = FALSE]
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
344 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
345 factors <- unlist(strsplit(opt$factInput, "|", fixed = TRUE))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
346 factordata <- list()
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
347 for (fact in factors) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
348 newfact <- unlist(strsplit(fact, split = "::"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
349 factordata <- rbind(factordata, newfact)
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
350 } # Factors have the form: FACT_NAME::LEVEL,LEVEL,LEVEL,LEVEL,... The first factor is the Primary Factor.
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
351
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
352 # Set the row names to be the name of the factor and delete first row
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
353 row.names(factordata) <- factordata[, 1]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
354 factordata <- factordata[, -1]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
355 factordata <- sapply(factordata, sanitise_groups)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
356 factordata <- sapply(factordata, strsplit, split = ",")
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
357 # Transform factor data into data frame of R factor objects
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
358 factors <- data.frame(factordata)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
359 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
360 }
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
361 # check there are the same number of samples in counts and factors
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
362 if (nrow(factors) != ncol(counts)) {
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
363 stop("There are a different number of samples in the counts files and factors")
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
364 }
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
365 # make groups valid R names, required for makeContrasts
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
366 factors <- sapply(factors, make.names)
22
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
367 factors <- data.frame(factors, stringsAsFactors = TRUE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
368
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
369 # if annotation file provided
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
370 if (have_anno) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
371 geneanno <- read.table(opt$annoPath, header = TRUE, sep = "\t", quote = "", strip.white = TRUE, stringsAsFactors = FALSE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
372 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
373
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
374 # Create output directory
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
375 dir.create(opt$outPath, showWarnings = FALSE)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
376
19
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
377 # Process contrasts
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
378 if (is.null(opt$contrastInput)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
379 contrast_data <- read.table(opt$contrastFile, header = TRUE, sep = "\t", quote = "", strip.white = TRUE, stringsAsFactors = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
380 contrast_data <- contrast_data[, 1, drop = TRUE]
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
381 } else {
19
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
382 # Split up contrasts seperated by comma into a vector then sanitise
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
383 contrast_data <- unlist(strsplit(opt$contrastInput, split = ","))
19
c9c6427edfe9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
iuc
parents: 18
diff changeset
384 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
385 contrast_data <- sanitise_equation(contrast_data)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
386 contrast_data <- gsub(" ", ".", contrast_data, fixed = TRUE)
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
387
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
388 # in case input groups start with numbers make the names valid R names, required for makeContrasts
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
389 cons <- NULL
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
390 cons_d <- NULL
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
391 for (i in contrast_data) {
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
392 # if the contrast is a difference of differences e.g. (A-B)-(X-Y)
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
393 if (grepl("\\)-\\(", i)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
394 i <- unlist(strsplit(i, split = "\\)-\\("))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
395 i <- gsub("\\(|\\)", "", i)
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
396 for (j in i) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
397 j <- sanitise_contrast(j)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
398 j <- paste0("(", j, ")")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
399 cons_d <- append(cons_d, unlist(j))
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
400 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
401 cons_d <- paste(cons_d, collapse = "-")
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
402 cons <- append(cons, unlist(cons_d))
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
403 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
404 i <- sanitise_contrast(i)
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
405 cons <- append(cons, unlist(i))
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
406 }
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
407 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
408
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
409 plots <- character()
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
410 if (!is.null(opt$plots)) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
411 plots <- unlist(strsplit(opt$plots, split = ","))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
412 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
413
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
414 den_png <- make_out("densityplots.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
415 den_pdf <- make_out("densityplots.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
416 cpm_pdf <- make_out("cpmplots.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
417 box_png <- make_out("boxplots.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
418 box_pdf <- make_out("boxplots.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
419 mdsscree_png <- make_out("mdsscree.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
420 mdsscree_pdf <- make_out("mdsscree.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
421 mdsx_pdf <- make_out("mdsplot_extra.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
422 mdsx_png <- make_out("mdsplot_extra.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
423 mdsam_pdf <- make_out("mdplots_samples.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
424 md_pdf <- character() # Initialise character vector
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
425 vol_pdf <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
426 heat_pdf <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
427 strip_pdf <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
428 mdvol_png <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
429 top_out <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
430 glimma_out <- character()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
431 for (i in seq_along(cons)) {
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
432 con <- cons[i]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
433 con <- gsub("\\(|\\)", "", con)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
434 md_pdf[i] <- make_out(paste0("mdplot_", con, ".pdf"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
435 vol_pdf[i] <- make_out(paste0("volplot_", con, ".pdf"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
436 heat_pdf[i] <- make_out(paste0("heatmap_", con, ".pdf"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
437 strip_pdf[i] <- make_out(paste0("stripcharts_", con, ".pdf"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
438 mdvol_png[i] <- make_out(paste0("mdvolplot_", con, ".png"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
439 top_out[i] <- make_out(paste0(de_method, "_", con, ".tsv"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
440 glimma_out[i] <- make_out(paste0("glimma_", con, "/MD-Plot.html"))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
441 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
442 filt_out <- make_out(paste0(de_method, "_", "filtcounts"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
443 norm_out <- make_out(paste0(de_method, "_", "normcounts"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
444 rda_out <- make_out(paste0(de_method, "_analysis.RData"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
445 session_out <- make_out("session_info.txt")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
446
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
447 # Initialise data for html links and images, data frame with columns Label and
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
448 # Link
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
449 link_data <- data.frame(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
450 Label = character(), Link = character(),
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
451 stringsAsFactors = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
452 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
453 image_data <- data.frame(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
454 Label = character(), Link = character(),
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
455 stringsAsFactors = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
456 )
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
457
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
458 # Initialise vectors for storage of up/down/neutral regulated counts
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
459 up_count <- numeric()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
460 down_count <- numeric()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
461 flat_count <- numeric()
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
462
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
463 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
464 ### Data Processing
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
465 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
466
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
467 # Extract counts and annotation data
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
468 print("Extracting counts")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
469 data <- list()
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
470 data$counts <- counts
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
471 if (have_anno) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
472 # order annotation by genes in counts (assumes gene ids are in 1st column of geneanno)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
473 annoord <- geneanno[match(row.names(counts), geneanno[, 1]), ]
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
474 data$genes <- annoord
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
475 } else {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
476 data$genes <- data.frame(GeneID = row.names(counts))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
477 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
478
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
479 # Creating naming data
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
480 samplenames <- colnames(data$counts)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
481 sampleanno <- data.frame("sampleID" = samplenames, factors)
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
482 row.names(factors) <- samplenames # for "Summary of experimental data" table
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
483
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
484 # Creating colours for the groups
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
485 cols <- as.numeric(factors[, 1])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
486 col_group <- palette()[cols]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
487
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
488 # If filter crieteria set, filter out genes that do not have a required cpm/counts in a required number of
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
489 # samples. Default is no filtering
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
490 prefilter_count <- nrow(data$counts)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
491 nsamples <- ncol(data$counts)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
492
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
493 if (filt_cpm || filt_smpcount || filt_totcount) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
494 if (filt_totcount) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
495 keep <- rowSums(data$counts) >= opt$cntReq
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
496 } else if (filt_smpcount) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
497 keep <- rowSums(data$counts >= opt$cntReq) >= opt$sampleReq
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
498 } else if (filt_cpm) {
22
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
499 cpms <- cpm(data$counts)
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
500 thresh <- cpms >= opt$cpmReq
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
501 keep <- rowSums(thresh) >= opt$sampleReq
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
502
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
503 if ("c" %in% plots) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
504 # Plot CPM vs raw counts (to check threshold)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
505 pdf(cpm_pdf, width = 6.5, height = 10)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
506 par(mfrow = c(3, 2))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
507 for (i in seq_len(nsamples)) {
22
708348a17fa1 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 8c4b8f8711df0a4d6fa98fa8a6f91b977395d62c"
iuc
parents: 21
diff changeset
508 plot(data$counts[, i], cpms[, i], xlim = c(0, 50), ylim = c(0, 3), main = samplenames[i], xlab = "Raw counts", ylab = "CPM")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
509 abline(v = 10, col = "red", lty = 2, lwd = 2)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
510 abline(h = opt$cpmReq, col = 4)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
511 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
512 link_name <- "CpmPlots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
513 link_addr <- "cpmplots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
514 link_data <- rbind(link_data, data.frame(Label = link_name, Link = link_addr, stringsAsFactors = FALSE))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
515 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
516 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
517 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
518
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
519 data$counts <- data$counts[keep, ]
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
520 data$genes <- data$genes[keep, , drop = FALSE]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
521
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
522 if (want_filt) {
12
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
523 print("Outputting filtered counts")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
524 filt_counts <- data.frame(data$genes, data$counts, check.names = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
525 write.table(filt_counts, file = filt_out, row.names = FALSE, sep = "\t", quote = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
526 link_data <- rbind(link_data, data.frame(Label = paste0(de_method, "_", "filtcounts.tsv"), Link = paste0(de_method, "_", "filtcounts"), stringsAsFactors = FALSE))
12
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
527 }
81796eb60bd0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 33651907e4d5d6672537b80142c022d2b4951e8c
iuc
parents: 11
diff changeset
528
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
529 # Plot Density
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
530 if ("d" %in% plots) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
531 # PNG
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
532 png(den_png, width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
533 par(mfrow = c(1, 2), cex.axis = 0.8)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
534
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
535 # before filtering
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
536 lcpm1 <- cpm(counts, log = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
537 plot(density(lcpm1[, 1]), col = col_group[1], lwd = 2, las = 2, main = "", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
538 title(main = "Density Plot: Raw counts", xlab = "Log-cpm")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
539 for (i in 2:nsamples) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
540 den <- density(lcpm1[, i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
541 lines(den$x, den$y, col = col_group[i], lwd = 2)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
542 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
543
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
544 # after filtering
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
545 lcpm2 <- cpm(data$counts, log = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
546 plot(density(lcpm2[, 1]), col = col_group[1], lwd = 2, las = 2, main = "", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
547 title(main = "Density Plot: Filtered counts", xlab = "Log-cpm")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
548 for (i in 2:nsamples) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
549 den <- density(lcpm2[, i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
550 lines(den$x, den$y, col = col_group[i], lwd = 2)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
551 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
552 legend("topright", samplenames, text.col = col_group, bty = "n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
553 img_name <- "Densityplots.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
554 img_addr <- "densityplots.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
555 image_data <- rbind(image_data, data.frame(Label = img_name, Link = img_addr, stringsAsFactors = FALSE))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
556 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
557
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
558 # PDF
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
559 pdf(den_pdf, width = 14)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
560 par(mfrow = c(1, 2), cex.axis = 0.8)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
561 plot(density(lcpm1[, 1]), col = col_group[1], lwd = 2, las = 2, main = "", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
562 title(main = "Density Plot: Raw counts", xlab = "Log-cpm")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
563 for (i in 2:nsamples) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
564 den <- density(lcpm1[, i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
565 lines(den$x, den$y, col = col_group[i], lwd = 2)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
566 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
567 plot(density(lcpm2[, 1]), col = col_group[1], lwd = 2, las = 2, main = "", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
568 title(main = "Density Plot: Filtered counts", xlab = "Log-cpm")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
569 for (i in 2:nsamples) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
570 den <- density(lcpm2[, i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
571 lines(den$x, den$y, col = col_group[i], lwd = 2)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
572 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
573 legend("topright", samplenames, text.col = col_group, bty = "n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
574 link_name <- "DensityPlots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
575 link_addr <- "densityplots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
576 link_data <- rbind(link_data, data.frame(Label = link_name, Link = link_addr, stringsAsFactors = FALSE))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
577 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
578 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
579 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
580
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
581 postfilter_count <- nrow(data$counts)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
582 filtered_count <- prefilter_count - postfilter_count
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
583
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
584 # Generating the DGEList object "y"
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
585 print("Generating DGEList object")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
586 data$samples <- sampleanno
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
587 data$samples$lib.size <- colSums(data$counts) # nolint
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
588 data$samples$norm.factors <- 1
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
589 row.names(data$samples) <- colnames(data$counts)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
590 y <- new("DGEList", data)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
591
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
592 print("Generating Design")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
593 factor_list <- sapply(names(factors), paste_listname)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
594 formula <- "~0"
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
595 for (i in seq_along(factor_list)) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
596 formula <- paste(formula, factor_list[i], sep = "+")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
597 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
598 formula <- formula(formula)
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
599 design <- model.matrix(formula)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
600 for (i in seq_along(factor_list)) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
601 colnames(design) <- gsub(factor_list[i], "", colnames(design), fixed = TRUE)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
602 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
603
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
604 # Calculating normalising factors
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
605 print("Calculating Normalisation Factors")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
606 logcounts <- y # store for plots
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
607 y <- calcNormFactors(y, method = opt$normOpt)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
608
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
609 # Generate contrasts information
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
610 print("Generating Contrasts")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
611 contrasts <- makeContrasts(contrasts = cons, levels = design)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
612
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
613 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
614 ### Data Output
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
615 ################################################################################
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
616
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
617 # Plot Box plots (before and after normalisation)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
618 if (opt$normOpt != "none" && "b" %in% plots) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
619 png(box_png, width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
620 par(mfrow = c(1, 2), mar = c(6, 4, 2, 2) + 0.1)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
621 labels <- colnames(counts)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
622
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
623 lcpm1 <- cpm(y$counts, log = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
624 boxplot(lcpm1, las = 2, col = col_group, xaxt = "n", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
625 axis(1, at = seq_along(labels), labels = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
626 abline(h = median(lcpm1), col = 4)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
627 text(x = seq_along(labels), y = par("usr")[3] - 1, srt = 45, adj = 1, labels = labels, xpd = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
628 title(main = "Box Plot: Unnormalised counts", ylab = "Log-cpm")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
629
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
630 lcpm2 <- cpm(y, log = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
631 boxplot(lcpm2, las = 2, col = col_group, xaxt = "n", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
632 axis(1, at = seq_along(labels), labels = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
633 text(x = seq_along(labels), y = par("usr")[3] - 1, srt = 45, adj = 1, labels = labels, xpd = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
634 abline(h = median(lcpm2), col = 4)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
635 title(main = "Box Plot: Normalised counts", ylab = "Log-cpm")
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
636
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
637 img_name <- "Boxplots.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
638 img_addr <- "boxplots.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
639 image_data <- rbind(image_data, data.frame(Label = img_name, Link = img_addr, stringsAsFactors = FALSE))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
640 invisible(dev.off())
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
641
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
642 pdf(box_pdf, width = 14)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
643 par(mfrow = c(1, 2), mar = c(6, 4, 2, 2) + 0.1)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
644 boxplot(lcpm1, las = 2, col = col_group, xaxt = "n", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
645 axis(1, at = seq_along(labels), labels = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
646 abline(h = median(lcpm1), col = 4)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
647 text(x = seq_along(labels), y = par("usr")[3] - 1, srt = 45, adj = 1, labels = labels, xpd = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
648 title(main = "Box Plot: Unnormalised counts", ylab = "Log-cpm")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
649 boxplot(lcpm2, las = 2, col = col_group, xaxt = "n", xlab = "")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
650 axis(1, at = seq_along(labels), labels = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
651 text(x = seq_along(labels), y = par("usr")[3] - 1, srt = 45, adj = 1, labels = labels, xpd = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
652 abline(h = median(lcpm2), col = 4)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
653 title(main = "Box Plot: Normalised counts", ylab = "Log-cpm")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
654 link_name <- "BoxPlots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
655 link_addr <- "boxplots.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
656 link_data <- rbind(link_data, data.frame(Label = link_name, Link = link_addr, stringsAsFactors = FALSE))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
657 invisible(dev.off())
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
658 }
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
659
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
660 # Plot MDS
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
661 print("Generating MDS plot")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
662 labels <- names(counts)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
663
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
664 # Scree plot (Variance Explained) code copied from Glimma
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
665
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
666 # get column of matrix
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
667 get_cols <- function(x, inds) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
668 x[, inds, drop = FALSE]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
669 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
670
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
671 x <- cpm(y, log = TRUE)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
672 ndim <- nsamples - 1
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
673 nprobes <- nrow(x)
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
674 top <- 500
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
675 top <- min(top, nprobes)
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
676 cn <- colnames(x)
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
677 bad <- rowSums(is.finite(x)) < nsamples
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
678
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
679 if (any(bad)) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
680 warning("Rows containing infinite values have been removed")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
681 x <- x[!bad, , drop = FALSE]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
682 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
683
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
684 dd <- matrix(0, nrow = nsamples, ncol = nsamples, dimnames = list(cn, cn))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
685 topindex <- nprobes - top + 1L
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
686 for (i in 2L:(nsamples)) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
687 for (j in 1L:(i - 1L)) {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
688 dists <- (get_cols(x, i) - get_cols(x, j))^2
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
689 dists <- sort.int(dists, partial = topindex)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
690 topdist <- dists[topindex:nprobes]
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
691 dd[i, j] <- sqrt(mean(topdist))
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
692 }
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
693 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
694
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
695 a1 <- suppressWarnings(cmdscale(as.dist(dd), k = min(ndim, 8), eig = TRUE))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
696 eigen <- data.frame(name = 1:min(ndim, 8), eigen = round(a1$eig[1:min(ndim, 8)] / sum(a1$eig), 2))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
697 png(mdsscree_png, width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
698 par(mfrow = c(1, 2))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
699 plotMDS(y, labels = samplenames, col = as.numeric(factors[, 1]), main = "MDS Plot: Dims 1 and 2")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
700 barplot(eigen$eigen, names.arg = eigen$name, main = "Scree Plot: Variance Explained", xlab = "Dimension", ylab = "Proportion", las = 1)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
701 img_name <- paste0("MDSPlot_", names(factors)[1], ".png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
702 img_addr <- "mdsscree.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
703 image_data <- rbind(image_data, data.frame(Label = img_name, Link = img_addr, stringsAsFactors = FALSE))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
704 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
705
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
706 pdf(mdsscree_pdf, width = 14)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
707 par(mfrow = c(1, 2))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
708 plotMDS(y, labels = samplenames, col = as.numeric(factors[, 1]), main = "MDS Plot: Dims 1 and 2")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
709 barplot(eigen$eigen, names.arg = eigen$name, main = "Scree Plot: Variance Explained", xlab = "Dimension", ylab = "Proportion", las = 1)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
710 link_name <- paste0("MDSPlot_", names(factors)[1], ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
711 link_addr <- "mdsscree.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
712 link_data <- rbind(link_data, data.frame(Label = link_name, Link = link_addr, stringsAsFactors = FALSE))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
713 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
714
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
715 # generate Glimma interactive MDS Plot
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
716 if ("i" %in% plots) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
717 Glimma::glMDSPlot(y,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
718 labels = samplenames, groups = factors[, 1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
719 folder = "glimma_MDS", launch = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
720 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
721 link_name <- "Glimma_MDSPlot.html"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
722 link_addr <- "glimma_MDS/MDS-Plot.html"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
723 link_data <- rbind(link_data, c(link_name, link_addr))
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
724 }
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
725
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
726 if ("x" %in% plots) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
727 png(mdsx_png, width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
728 par(mfrow = c(1, 2))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
729 for (i in 2:3) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
730 dim1 <- i
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
731 dim2 <- i + 1
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
732 plotMDS(y, dim = c(dim1, dim2), labels = samplenames, col = as.numeric(factors[, 1]), main = paste("MDS Plot: Dims", dim1, "and", dim2))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
733 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
734 img_name <- paste0("MDSPlot_extra.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
735 img_addr <- paste0("mdsplot_extra.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
736 image_data <- rbind(image_data, data.frame(Label = img_name, Link = img_addr, stringsAsFactors = FALSE))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
737 invisible(dev.off())
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
738
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
739 pdf(mdsx_pdf, width = 14)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
740 par(mfrow = c(1, 2))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
741 for (i in 2:3) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
742 dim1 <- i
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
743 dim2 <- i + 1
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
744 plotMDS(y, dim = c(dim1, dim2), labels = samplenames, col = as.numeric(factors[, 1]), main = paste("MDS Plot: Dims", dim1, "and", dim2))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
745 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
746 link_name <- "MDSPlot_extra.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
747 link_addr <- "mdsplot_extra.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
748 link_data <- rbind(link_data, data.frame(Label = link_name, Link = link_addr, stringsAsFactors = FALSE))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
749 invisible(dev.off())
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
750 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
751
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
752 if ("m" %in% plots) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
753 # Plot MD plots for individual samples
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
754 print("Generating MD plots for samples")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
755 pdf(mdsam_pdf, width = 6.5, height = 10)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
756 par(mfrow = c(3, 2))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
757 for (i in 1:nsamples) {
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
758 if (opt$normOpt != "none") {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
759 plotMD(logcounts, column = i, main = paste(colnames(logcounts)[i], "(before)"))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
760 abline(h = 0, col = "red", lty = 2, lwd = 2)
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
761 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
762 plotMD(y, column = i)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
763 abline(h = 0, col = "red", lty = 2, lwd = 2)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
764 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
765 link_name <- "MDPlots_Samples.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
766 link_addr <- "mdplots_samples.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
767 link_data <- rbind(link_data, c(link_name, link_addr))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
768 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
769 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
770
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
771
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
772 if (want_trend) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
773 # limma-trend approach
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
774 logcpm <- cpm(y, log = TRUE, prior.count = opt$trend)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
775 fit <- lmFit(logcpm, design)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
776 fit$genes <- y$genes
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
777 fit <- contrasts.fit(fit, contrasts)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
778 if (want_robust) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
779 fit <- eBayes(fit, trend = TRUE, robust = TRUE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
780 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
781 fit <- eBayes(fit, trend = TRUE, robust = FALSE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
782 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
783
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
784 plot_data <- logcpm
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
785
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
786 # Save normalised counts (log2cpm)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
787 if (want_norm) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
788 write.table(logcpm, file = norm_out, row.names = TRUE, sep = "\t", quote = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
789 link_data <- rbind(link_data, c((paste0(de_method, "_", "normcounts.tsv")), (paste0(de_method, "_", "normcounts"))))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
790 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
791 } else {
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
792 # limma-voom approach
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
793
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
794 if (want_weight) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
795 voomwts_pdf <- make_out("voomwtsplot.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
796 voomwts_png <- make_out("voomwtsplot.png")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
797 # Creating voom data object and plot
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
798 png(voomwts_png, width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
799 vdata <- voomWithQualityWeights(y, design = design, plot = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
800 img_name <- "VoomWithQualityWeightsPlot.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
801 img_addr <- "voomwtsplot.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
802 image_data <- rbind(image_data, c(img_name, img_addr))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
803 invisible(dev.off())
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
804
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
805 pdf(voomwts_pdf, width = 14)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
806 vdata <- voomWithQualityWeights(y, design = design, plot = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
807 link_name <- "VoomWithQualityWeightsPlot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
808 link_addr <- "voomwtsplot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
809 link_data <- rbind(link_data, c(link_name, link_addr))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
810 invisible(dev.off())
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
811
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
812 # Generating fit data and top table with weights
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
813 wts <- vdata$weights
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
814 voomfit <- lmFit(vdata, design, weights = wts)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
815 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
816 voom_pdf <- make_out("voomplot.pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
817 voom_png <- make_out("voomplot.png")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
818 # Creating voom data object and plot
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
819 png(voom_png, width = 500, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
820 vdata <- voom(y, design = design, plot = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
821 img_name <- "VoomPlot"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
822 img_addr <- "voomplot.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
823 image_data <- rbind(image_data, c(img_name, img_addr))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
824 invisible(dev.off())
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
825
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
826 pdf(voom_pdf)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
827 vdata <- voom(y, design = design, plot = TRUE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
828 link_name <- "VoomPlot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
829 link_addr <- "voomplot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
830 link_data <- rbind(link_data, c(link_name, link_addr))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
831 invisible(dev.off())
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
832
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
833 # Generate voom fit
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
834 voomfit <- lmFit(vdata, design)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
835 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
836
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
837 # Save normalised counts (log2cpm)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
838 if (want_norm) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
839 norm_counts <- data.frame(vdata$genes, vdata$E, check.names = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
840 write.table(norm_counts, file = norm_out, row.names = FALSE, sep = "\t", quote = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
841 link_data <- rbind(link_data, c((paste0(de_method, "_", "normcounts.tsv")), (paste0(de_method, "_", "normcounts"))))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
842 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
843
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
844 # Fit linear model and estimate dispersion with eBayes
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
845 voomfit <- contrasts.fit(voomfit, contrasts)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
846 if (want_robust) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
847 fit <- eBayes(voomfit, robust = TRUE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
848 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
849 fit <- eBayes(voomfit, robust = FALSE)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
850 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
851 plot_data <- vdata
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
852 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
853
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
854 # plot final model mean-variance trend with plotSA
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
855 sa_png <- make_out("saplot.png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
856 sa_pdf <- make_out("saplot.pdf")
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
857
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
858 png(sa_png, width = 500, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
859 plotSA(fit, main = "Final model: Mean-variance trend (SA Plot)")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
860 img_name <- "SAPlot.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
861 img_addr <- "saplot.png"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
862 image_data <- rbind(image_data, c(img_name, img_addr))
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
863 invisible(dev.off())
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
864
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
865 pdf(sa_pdf)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
866 plotSA(fit, main = "Final model: Mean-variance trend (SA Plot)")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
867 link_name <- "SAPlot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
868 link_addr <- "saplot.pdf"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
869 link_data <- rbind(link_data, c(link_name, link_addr))
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
870 invisible(dev.off())
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
871
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
872 # Save library size info
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
873 if (want_libinfo) {
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
874 efflibsize <- round(y$samples$lib.size * y$samples$norm.factors)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
875 libsizeinfo <- cbind(y$samples, EffectiveLibrarySize = efflibsize)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
876 libsizeinfo$lib.size <- round(libsizeinfo$lib.size) # nolint
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
877 names(libsizeinfo)[names(libsizeinfo) == "sampleID"] <- "SampleID"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
878 names(libsizeinfo)[names(libsizeinfo) == "lib.size"] <- "LibrarySize"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
879 names(libsizeinfo)[names(libsizeinfo) == "norm.factors"] <- "NormalisationFactor"
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
880 write.table(libsizeinfo, file = "libsizeinfo", row.names = FALSE, sep = "\t", quote = FALSE)
11
7e8af58c8052 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
iuc
parents: 10
diff changeset
881 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
882
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
883 print("Generating DE results")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
884
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
885 if (want_treat) {
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
886 print("Applying TREAT method")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
887 if (want_robust) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
888 fit <- treat(fit, lfc = opt$lfcReq, robust = TRUE)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
889 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
890 fit <- treat(fit, lfc = opt$lfcReq, robust = FALSE)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
891 }
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
892 }
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
893
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
894 status <- decideTests(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
895 adjust.method = opt$pAdjOpt, p.value = opt$pValReq,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
896 lfc = opt$lfcReq
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
897 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
898 sum_status <- summary(status)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
899
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
900 for (i in seq_along(cons)) {
20
0921444c832d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 0cc16fe170b5c8d3b9441177bf2749aa7bddca7b
iuc
parents: 19
diff changeset
901 con_name <- cons[i]
17
86b3df7db58b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 42b1160a549a85c87ed5226a83b55c4e44648597
iuc
parents: 16
diff changeset
902 con <- cons[i]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
903 con <- gsub("\\(|\\)", "", con)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
904 # Collect counts for differential expression
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
905 up_count[i] <- sum_status["Up", i]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
906 down_count[i] <- sum_status["Down", i]
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
907 flat_count[i] <- sum_status["NotSig", i]
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
908
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
909 # Write top expressions table
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
910 if (want_treat) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
911 top <- topTreat(fit, coef = i, adjust.method = opt$pAdjOpt, number = Inf, sort.by = "P")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
912 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
913 top <- topTable(fit, coef = i, adjust.method = opt$pAdjOpt, number = Inf, sort.by = "P")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
914 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
915 write.table(top, file = top_out[i], row.names = FALSE, sep = "\t", quote = FALSE)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
916 link_name <- paste0(de_method, "_", con, ".tsv")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
917 link_addr <- paste0(de_method, "_", con, ".tsv")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
918 link_data <- rbind(link_data, c(link_name, link_addr))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
919
5
d8a55b5f0de0 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f0db9544002b02d3ccffb8c983b5c8baef6bacd
iuc
parents: 4
diff changeset
920 # Plot MD (log ratios vs mean average) using limma package on weighted
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
921 pdf(md_pdf[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
922 limma::plotMD(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
923 status = status[, i], coef = i,
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
924 main = paste("MD Plot:", unmake_names(con)),
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
925 hl.col = alpha(c("firebrick", "blue"), 0.4), values = c(1, -1),
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
926 xlab = "Average Expression", ylab = "logFC"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
927 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
928 abline(h = 0, col = "grey", lty = 2)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
929 link_name <- paste0("MDPlot_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
930 link_addr <- paste0("mdplot_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
931 link_data <- rbind(link_data, c(link_name, link_addr))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
932 invisible(dev.off())
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
933
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
934 # Generate Glimma interactive Volcano, MD plot and tables, requires annotation file (assumes gene labels/symbols in 2nd column)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
935 if ("i" %in% plots && have_anno) {
10
e26047c4562d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c31767d02eeeda7346bb33ba71ebde9189d7e4a3
iuc
parents: 9
diff changeset
936 # make gene labels unique to handle NAs
e26047c4562d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c31767d02eeeda7346bb33ba71ebde9189d7e4a3
iuc
parents: 9
diff changeset
937 geneanno <- y$genes
e26047c4562d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c31767d02eeeda7346bb33ba71ebde9189d7e4a3
iuc
parents: 9
diff changeset
938 geneanno[, 2] <- make.unique(geneanno[, 2])
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
939
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
940 # use the logcpms for the counts
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
941 if (want_trend) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
942 cnts <- logcpm
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
943 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
944 cnts <- vdata$E
18
97e06a4c7c75 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f5e2ad38bf004b33fc5da5d9d4e75cf1130f666
iuc
parents: 17
diff changeset
945 }
97e06a4c7c75 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f5e2ad38bf004b33fc5da5d9d4e75cf1130f666
iuc
parents: 17
diff changeset
946
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
947 # MD plot
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
948 Glimma::glMDPlot(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
949 coef = i, counts = cnts, anno = geneanno, groups = factors[, 1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
950 status = status[, i], sample.cols = col_group,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
951 main = paste("MD Plot:", unmake_names(con)), side.main = colnames(y$genes)[2],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
952 folder = paste0("glimma_", unmake_names(con)), launch = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
953 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
954 link_name <- paste0("Glimma_MDPlot_", con, ".html")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
955 link_addr <- paste0("glimma_", con, "/MD-Plot.html")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
956 link_data <- rbind(link_data, c(link_name, link_addr))
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
957
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
958 # Volcano plot
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
959 Glimma::glXYPlot(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
960 x = fit$coefficients[, i], y = -log10(fit$p.value[, i]), counts = cnts, anno = geneanno, groups = factors[, 1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
961 status = status[, i], sample.cols = col_group,
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
962 main = paste("Volcano Plot:", unmake_names(con)), side.main = colnames(y$genes)[2],
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
963 xlab = "logFC", ylab = "-log10(P-value)",
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
964 folder = paste0("glimma_volcano_", unmake_names(con)), launch = FALSE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
965 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
966 link_name <- paste0("Glimma_VolcanoPlot_", con, ".html")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
967 link_addr <- paste0("glimma_volcano_", con, "/XY-Plot.html")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
968 link_data <- rbind(link_data, c(link_name, link_addr))
9
4255881bebb1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f8052ab47b789da5ea47feb48e1b8e08b5fc1e0
iuc
parents: 8
diff changeset
969 }
4255881bebb1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f8052ab47b789da5ea47feb48e1b8e08b5fc1e0
iuc
parents: 8
diff changeset
970
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
971 # Plot Volcano
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
972 pdf(vol_pdf[i])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
973 if (have_anno) {
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
974 # labels must be in second column currently
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
975 labels <- fit$genes[, 2]
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
976 } else {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
977 labels <- fit$genes$GeneID
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
978 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
979 limma::volcanoplot(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
980 coef = i,
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
981 main = paste("Volcano Plot:", unmake_names(con)),
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
982 highlight = opt$topgenes,
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
983 names = labels
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
984 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
985 link_name <- paste0("VolcanoPlot_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
986 link_addr <- paste0("volplot_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
987 link_data <- rbind(link_data, c(link_name, link_addr))
7
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
988 invisible(dev.off())
e6a4ff41af6b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit cf399638ebca4250bcc15f468238a9964de97b33
iuc
parents: 6
diff changeset
989
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
990 # PNG of MD and Volcano
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
991 png(mdvol_png[i], width = 1000, height = 500)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
992 par(mfrow = c(1, 2), mar = c(5, 4, 2, 2) + 0.1, oma = c(0, 0, 3, 0))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
993
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
994 # MD plot
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
995 limma::plotMD(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
996 status = status[, i], coef = i, main = "MD Plot",
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
997 hl.col = alpha(c("firebrick", "blue"), 0.4), values = c(1, -1),
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
998 xlab = "Average Expression", ylab = "logFC"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
999 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1000 abline(h = 0, col = "grey", lty = 2)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1001
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1002 # Volcano
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1003 if (have_anno) {
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1004 # labels must be in second column currently
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1005 limma::volcanoplot(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1006 coef = i, main = "Volcano Plot",
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1007 highlight = opt$topgenes,
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1008 names = fit$genes[, 2]
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1009 )
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1010 } else {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1011 limma::volcanoplot(fit,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1012 coef = i, main = "Volcano Plot",
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1013 highlight = opt$topgenes,
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1014 names = fit$genes$GeneID
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1015 )
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1016 }
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1017
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1018 img_name <- paste0("MDVolPlot_", con)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1019 img_addr <- paste0("mdvolplot_", con, ".png")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1020 image_data <- rbind(image_data, c(img_name, img_addr))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1021 title(paste0("Contrast: ", con_name), outer = TRUE, cex.main = 1.5)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1022 invisible(dev.off())
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1023
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1024 if ("h" %in% plots) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1025 # Plot Heatmap
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1026 topgenes <- rownames(top[1:opt$topgenes, ])
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1027 if (want_trend) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1028 topexp <- plot_data[topgenes, ]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1029 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1030 topexp <- plot_data$E[topgenes, ]
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1031 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1032 pdf(heat_pdf[i])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1033 mycol <- colorpanel(1000, "blue", "white", "red")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1034 if (have_anno) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1035 # labels must be in second column currently
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1036 labels <- top[topgenes, 2]
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1037 } else {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1038 labels <- rownames(topexp)
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1039 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1040 heatmap.2(topexp,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1041 scale = "row", Colv = FALSE, Rowv = FALSE, dendrogram = "none",
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1042 main = paste("Contrast:", unmake_names(con), "\nTop", opt$topgenes, "genes by adj.P.Val"),
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1043 trace = "none", density.info = "none", lhei = c(2, 10), margin = c(8, 6), labRow = labels, cexRow = 0.7, srtCol = 45,
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1044 col = mycol, ColSideColors = col_group
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1045 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1046 link_name <- paste0("Heatmap_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1047 link_addr <- paste0("heatmap_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1048 link_data <- rbind(link_data, c(link_name, link_addr))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1049 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1050 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1051
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1052 if ("s" %in% plots) {
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1053 # Plot Stripcharts of top genes
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1054 pdf(strip_pdf[i], title = paste("Contrast:", unmake_names(con)))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1055 par(mfrow = c(3, 2), cex.main = 0.8, cex.axis = 0.8)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1056 cols <- unique(col_group)
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1057
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1058 for (j in seq_along(topgenes)) {
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1059 lfc <- round(top[topgenes[j], "logFC"], 2)
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1060 pval <- round(top[topgenes[j], "adj.P.Val"], 5)
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1061 if (want_trend) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1062 stripchart(plot_data[topgenes[j], ] ~ factors[, 1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1063 vertical = TRUE, las = 2, pch = 16, cex = 0.8, cex.lab = 0.8, col = cols,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1064 method = "jitter", ylab = "Normalised log2 expression", main = paste0(labels[j], "\nlogFC=", lfc, ", adj.P.Val=", pval)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1065 )
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1066 } else {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1067 stripchart(plot_data$E[topgenes[j], ] ~ factors[, 1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1068 vertical = TRUE, las = 2, pch = 16, cex = 0.8, cex.lab = 0.8, col = cols,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1069 method = "jitter", ylab = "Normalised log2 expression", main = paste0(labels[j], "\nlogFC=", lfc, ", adj.P.Val=", pval)
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1070 )
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1071 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1072 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1073 link_name <- paste0("Stripcharts_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1074 link_addr <- paste0("stripcharts_", con, ".pdf")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1075 link_data <- rbind(link_data, c(link_name, link_addr))
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1076 invisible(dev.off())
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1077 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1078 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1079 sig_diff <- data.frame(Up = up_count, Flat = flat_count, Down = down_count)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1080 row.names(sig_diff) <- cons
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1081
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1082 # Save relevant items as rda object
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1083 if (want_rda) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1084 print("Saving RData")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1085 if (want_weight) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1086 save(counts, data, y, status, plot_data, labels, factors, wts, fit, top, contrast_data, contrasts, design,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1087 file = rda_out, ascii = TRUE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1088 )
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1089 } else {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1090 save(counts, data, y, status, plot_data, labels, factors, fit, top, contrast_data, contrasts, design,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1091 file = rda_out, ascii = TRUE
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1092 )
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1093 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1094 link_data <- rbind(link_data, c((paste0(de_method, "_analysis.RData")), (paste0(de_method, "_analysis.RData"))))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1095 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1096
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1097 # Record session info
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1098 writeLines(capture.output(sessionInfo()), session_out)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1099 link_data <- rbind(link_data, c("Session Info", "session_info.txt"))
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1100
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1101 # Record ending time and calculate total run time
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1102 time_end <- Sys.time()
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1103 time_taken <- capture.output(round(difftime(time_end, time_start), digits = 2))
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1104 time_taken <- gsub("Time difference of ", "", time_taken, fixed = TRUE)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1105 time_start <- format(time_start, "%A, %B %d, %Y %H:%M:%S")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1106 time_end <- format(time_end, "%A, %B %d, %Y %H:%M:%S")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1107 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1108 ### HTML Generation
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1109 ################################################################################
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1110
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1111 # Clear file
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1112 cat("", file = opt$htmlPath)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1113
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1114 cata("<html>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1115
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1116 cata("<body>\n")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1117 cata("<h3>Limma Analysis Output:</h3>\n")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1118 cata("Links to PDF copies of plots are in 'Plots' section below <br />\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1119
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1120 for (i in seq_len(nrow(image_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1121 if (grepl("density|box|mds|mdvol|wts", image_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1122 html_image(image_data$Link[i], image_data$Label[i], width = 1000)
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1123 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1124 html_image(image_data$Link[i], image_data$Label[i])
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1125 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1126 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1127
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1128 cata("<h4>Differential Expression Counts:</h4>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1129
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1130 cata("<table border=\"1\" cellpadding=\"4\">\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1131 cata("<tr>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1132 table_item()
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1133 for (i in colnames(sig_diff)) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1134 table_head_item(i)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1135 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1136 cata("</tr>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1137 for (i in seq_len(nrow(sig_diff))) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1138 cata("<tr>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1139 table_head_item(unmake_names(row.names(sig_diff)[i]))
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1140 for (j in seq_len(ncol(sig_diff))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1141 table_item(as.character(sig_diff[i, j]))
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1142 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1143 cata("</tr>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1144 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1145 cata("</table>")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1146
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1147 cata("<h4>Plots:</h4>\n")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1148 # PDFs
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1149 for (i in seq_len(nrow(link_data))) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1150 if (grepl(".pdf", link_data$Link[i]) && grepl("density|cpm|boxplot|mds|mdplots|voom|saplot", link_data$Link[i])) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1151 html_link(link_data$Link[i], link_data$Label[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1152 }
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1153 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1154
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1155 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1156 if (grepl("mdplot_", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1157 html_link(link_data$Link[i], link_data$Label[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1158 }
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1159 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1160
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1161 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1162 if (grepl("volplot", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1163 html_link(link_data$Link[i], link_data$Label[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1164 }
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1165 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1166
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1167 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1168 if (grepl("heatmap", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1169 html_link(link_data$Link[i], link_data$Label[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1170 }
8
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1171 }
00a42b66e522 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 48125e8638453668f889a67791421f14d3ebe623
iuc
parents: 7
diff changeset
1172
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1173 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1174 if (grepl("stripcharts", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1175 html_link(link_data$Link[i], link_data$Label[i])
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1176 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1177 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1178
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1179 cata("<h4>Tables:</h4>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1180 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1181 if (grepl("counts$", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1182 html_link(link_data$Link[i], link_data$Label[i])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1183 } else if (grepl(".tsv", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1184 html_link(link_data$Link[i], link_data$Label[i])
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1185 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1186 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1187
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1188 if (want_rda) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1189 cata("<h4>R Data Object:</h4>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1190 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1191 if (grepl(".RData", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1192 html_link(link_data$Link[i], link_data$Label[i])
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1193 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1194 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1195 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1196
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
1197 if ("i" %in% plots) {
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
1198 cata("<h4>Glimma Interactive Results:</h4>\n")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1199 for (i in seq_len(nrow(link_data))) {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1200 if (grepl("glimma", link_data$Link[i])) {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1201 html_link(link_data$Link[i], link_data$Label[i])
9
4255881bebb1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f8052ab47b789da5ea47feb48e1b8e08b5fc1e0
iuc
parents: 8
diff changeset
1202 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1203 }
14
3133e833b3ce planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit c915bd7e68cb3a2944397aaf184c2b1db97cb3a5
iuc
parents: 13
diff changeset
1204 }
9
4255881bebb1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f8052ab47b789da5ea47feb48e1b8e08b5fc1e0
iuc
parents: 8
diff changeset
1205
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1206 cata("<p>Alt-click links to download file.</p>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1207 cata("<p>Click floppy disc icon associated history item to download ")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1208 cata("all files.</p>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1209 cata("<p>.tsv files can be viewed in Excel or any spreadsheet program.</p>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1210
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1211 cata("<h4>Additional Information</h4>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1212 cata("<ul>\n")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1213
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1214 if (filt_cpm || filt_smpcount || filt_totcount) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1215 if (filt_cpm) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1216 temp_str <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1217 "Genes without more than", opt$cpmReq,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1218 "CPM in at least", opt$sampleReq, "samples are insignificant",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1219 "and filtered out."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1220 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1221 } else if (filt_smpcount) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1222 temp_str <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1223 "Genes without more than", opt$cntReq,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1224 "counts in at least", opt$sampleReq, "samples are insignificant",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1225 "and filtered out."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1226 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1227 } else if (filt_totcount) {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1228 temp_str <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1229 "Genes without more than", opt$cntReq,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1230 "counts, after summing counts for all samples, are insignificant",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1231 "and filtered out."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1232 )
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1233 }
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1234
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1235 list_item(temp_str)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1236 filter_prop <- round(filtered_count / prefilter_count * 100, digits = 2)
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1237 temp_str <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1238 filtered_count, " of ", prefilter_count, " (", filter_prop,
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1239 "%) genes were filtered out for low expression."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1240 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1241 list_item(temp_str)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1242 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1243 list_item(opt$normOpt, " was the method used to normalise library sizes.")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1244 if (want_trend) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1245 list_item("The limma-trend method was used.")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1246 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1247 list_item("The limma-voom method was used.")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1248 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1249 if (want_weight) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1250 list_item("Weights were applied to samples.")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1251 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1252 list_item("Weights were not applied to samples.")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1253 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1254 if (want_treat) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1255 list_item(paste("Testing significance relative to a fold-change threshold (TREAT) was performed using a threshold of log2 =", opt$lfcReq, "at FDR of", opt$pValReq, "."))
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1256 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1257 if (want_robust) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1258 if (want_treat) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1259 list_item("TREAT was used with robust settings (robust = TRUE).")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1260 } else {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1261 list_item("eBayes was used with robust settings (robust = TRUE).")
6
39fa12a6d885 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 60cae222b10f43f830936c19298bd723ac47e43d
iuc
parents: 5
diff changeset
1262 }
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1263 }
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1264 if (opt$pAdjOpt != "none") {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1265 if (opt$pAdjOpt == "BH" || opt$pAdjOpt == "BY") {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1266 temp_str <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1267 "MD Plot highlighted genes are significant at FDR ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1268 "of ", opt$pValReq, " and exhibit log2-fold-change of at ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1269 "least ", opt$lfcReq, "."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1270 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1271 list_item(temp_str)
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1272 } else if (opt$pAdjOpt == "holm") {
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1273 temp_str <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1274 "MD Plot highlighted genes are significant at adjusted ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1275 "p-value of ", opt$pValReq, " by the Holm(1979) ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1276 "method, and exhibit log2-fold-change of at least ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1277 opt$lfcReq, "."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1278 )
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1279 list_item(temp_str)
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1280 }
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1281 } else {
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1282 temp_str <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1283 "MD Plot highlighted genes are significant at p-value ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1284 "of ", opt$pValReq, " and exhibit log2-fold-change of at ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1285 "least ", opt$lfcReq, "."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1286 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1287 list_item(temp_str)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1288 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1289 cata("</ul>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1290
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1291 cata("<h4>Summary of experimental data:</h4>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1292
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
1293 cata("<p>*CHECK THAT SAMPLES ARE ASSOCIATED WITH CORRECT GROUP(S)*</p>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1294
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1295 cata("<table border=\"1\" cellpadding=\"3\">\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1296 cata("<tr>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1297 table_head_item("SampleID")
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1298 table_head_item(names(factors)[1], " (Primary Factor)")
1
76d01fe0ec36 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 58c05c0ce9334f8b9c800283cfd1f40573546edd
iuc
parents: 0
diff changeset
1299
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1300 if (ncol(factors) > 1) {
2
a330ddf43861 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 346319bd01bfd51f02d656e653a93f0bd1e954aa
iuc
parents: 1
diff changeset
1301 for (i in names(factors)[2:length(names(factors))]) {
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1302 table_head_item(i)
2
a330ddf43861 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 346319bd01bfd51f02d656e653a93f0bd1e954aa
iuc
parents: 1
diff changeset
1303 }
a330ddf43861 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 346319bd01bfd51f02d656e653a93f0bd1e954aa
iuc
parents: 1
diff changeset
1304 cata("</tr>\n")
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1305 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1306
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1307 for (i in seq_len(nrow(factors))) {
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1308 cata("<tr>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1309 table_head_item(row.names(factors)[i])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1310 for (j in seq_len(ncol(factors))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1311 table_item(as.character(unmake_names(factors[i, j])))
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1312 }
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1313 cata("</tr>\n")
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1314 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1315 cata("</table>")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1316
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1317 cit <- character()
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1318 link <- character()
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1319 link[1] <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1320 "<a href=\"",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1321 "http://www.bioconductor.org/packages/release/bioc/",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1322 "vignettes/limma/inst/doc/usersguide.pdf",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1323 "\">", "limma User's Guide", "</a>."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1324 )
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1325
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1326 link[2] <- paste0(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1327 "<a href=\"",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1328 "http://www.bioconductor.org/packages/release/bioc/",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1329 "vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1330 "\">", "edgeR User's Guide", "</a>"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1331 )
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1332
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1333 cit[1] <- paste("Please cite the following paper for this tool:")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1334
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1335 cit[2] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1336 "Liu R, Holik AZ, Su S, Jansz N, Chen K, Leong HS, Blewitt ME,",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1337 "Asselin-Labat ML, Smyth GK, Ritchie ME (2015). Why weight? ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1338 "Modelling sample and observational level variability improves power ",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1339 "in RNA-seq analyses. Nucleic Acids Research, 43(15), e97."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1340 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1341 cit[3] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1342 "Please cite the paper below for the limma software itself.",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1343 "Please also try to cite the appropriate methodology articles",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1344 "that describe the statistical methods implemented in limma,",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1345 "depending on which limma functions you are using. The",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1346 "methodology articles are listed in Section 2.1 of the",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1347 link[1],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1348 "Cite no. 3 only if sample weights were used."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1349 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1350 cit[4] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1351 "Smyth GK (2005). Limma: linear models for microarray data.",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1352 "In: 'Bioinformatics and Computational Biology Solutions using",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1353 "R and Bioconductor'. R. Gentleman, V. Carey, S. doit,.",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1354 "Irizarry, W. Huber (eds), Springer, New York, pages 397-420."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1355 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1356 cit[5] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1357 "Please cite the first paper for the software itself and the",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1358 "other papers for the various original statistical methods",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1359 "implemented in edgeR. See Section 1.2 in the", link[2],
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1360 "for more detail."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1361 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1362 cit[6] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1363 "Robinson MD, McCarthy DJ and Smyth GK (2010). edgeR: a",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1364 "Bioconductor package for differential expression analysis",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1365 "of digital gene expression data. Bioinformatics 26, 139-140"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1366 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1367 cit[7] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1368 "Robinson MD and Smyth GK (2007). Moderated statistical tests",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1369 "for assessing differences in tag abundance. Bioinformatics",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1370 "23, 2881-2887"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1371 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1372 cit[8] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1373 "Robinson MD and Smyth GK (2008). Small-sample estimation of",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1374 "negative binomial dispersion, with applications to SAGE data.",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1375 "Biostatistics, 9, 321-332"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1376 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1377 cit[9] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1378 "McCarthy DJ, Chen Y and Smyth GK (2012). Differential",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1379 "expression analysis of multifactor RNA-Seq experiments with",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1380 "respect to biological variation. Nucleic Acids Research 40,",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1381 "4288-4297"
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1382 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1383 cit[10] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1384 "Law CW, Chen Y, Shi W, and Smyth GK (2014). Voom:",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1385 "precision weights unlock linear model analysis tools for",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1386 "RNA-seq read counts. Genome Biology 15, R29."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1387 )
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1388 cit[11] <- paste(
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1389 "Ritchie ME, Diyagama D, Neilson J, van Laar R,",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1390 "Dobrovic A, Holloway A and Smyth GK (2006).",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1391 "Empirical array quality weights for microarray data.",
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1392 "BMC Bioinformatics 7, Article 261."
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1393 )
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1394 cata("<h3>Citations</h3>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1395 cata(cit[1], "\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1396 cata("<br>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1397 cata(cit[2], "\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1398
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1399 cata("<h4>limma</h4>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1400 cata(cit[3], "\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1401 cata("<ol>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1402 list_item(cit[4])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1403 list_item(cit[10])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1404 list_item(cit[11])
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1405 cata("</ol>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1406
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1407 cata("<h4>edgeR</h4>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1408 cata(cit[5], "\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1409 cata("<ol>\n")
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1410 list_item(cit[6])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1411 list_item(cit[7])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1412 list_item(cit[8])
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1413 list_item(cit[9])
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1414 cata("</ol>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1415
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1416 cata("<p>Please report problems or suggestions to: su.s@wehi.edu.au</p>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1417
21
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1418 for (i in seq_len(nrow(link_data))) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1419 if (grepl("session_info", link_data$Link[i])) {
58c35179ebf0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 127882bd6729d92500ce2a7a51eb5f8949a4c2b5"
iuc
parents: 20
diff changeset
1420 html_link(link_data$Link[i], link_data$Label[i])
3
38aab66ae5cb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 1640914b9812b0482a3cf684f05465f8d9cfdc65
iuc
parents: 2
diff changeset
1421 }
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1422 }
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1423
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1424 cata("<table border=\"0\">\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1425 cata("<tr>\n")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1426 table_item("Task started at:")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1427 table_item(time_start)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1428 cata("</tr>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1429 cata("<tr>\n")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1430 table_item("Task ended at:")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1431 table_item(time_end)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1432 cata("</tr>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1433 cata("<tr>\n")
26
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1434 table_item("Task run time:")
119b069fc845 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit b4d788c0f159d507159117a063b1f867b243c738
iuc
parents: 22
diff changeset
1435 table_item(time_taken)
0
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1436 cata("<tr>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1437 cata("</table>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1438
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1439 cata("</body>\n")
bdebdea5f6a7 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 2f34a215c35f08c3666f314a87d235437baa1d21
iuc
parents:
diff changeset
1440 cata("</html>")