annotate test-data/out_rscript.txt @ 1:73281fbdf6c1 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 225518a08941e7ef8e5c402e3696ec5fa6e592a0
author iuc
date Thu, 15 Feb 2018 02:34:59 -0500
parents a8a083193440
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
1 # Code based on (and inspired by) the Galaxy limma-voom/edgeR/DESeq2 wrappers
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
2
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
4
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
5 # we need that to not crash galaxy with an UTF8 error on German LC settings.
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
6 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
7
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
8 suppressPackageStartupMessages({
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
9 library(EGSEA)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
10 library(limma)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
11 library(edgeR)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
12 library(optparse)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
13 })
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
14
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
15
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
16 ## Function Declaration
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
17
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
18 sanitiseEquation <- function(equation) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
19 equation <- gsub(" *[+] *", "+", equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
20 equation <- gsub(" *[-] *", "-", equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
21 equation <- gsub(" *[/] *", "/", equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
22 equation <- gsub(" *[*] *", "*", equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
23 equation <- gsub("^\\s+|\\s+$", "", equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
24 return(equation)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
25 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
26
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
27 # Function to sanitise group information
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
28 sanitiseGroups <- function(string) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
29 string <- gsub(" *[,] *", ",", string)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
30 string <- gsub("^\\s+|\\s+$", "", string)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
31 return(string)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
32 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
33
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
34 # Generating design information
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
35 pasteListName <- function(string) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
36 return(paste0("factors$", string))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
37 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
38
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
39 ## Input Processing
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
40
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
41 option_list <- list(
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
42 make_option(c("-threads", "--threads"), default=2, type="integer", help="Number of threads for egsea"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
43 make_option(c("-filesPath", "--filesPath"), type="character", help="JSON list object if multiple files input"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
44 make_option(c("-matrixPath", "--matrixPath"), type="character", help="Path to count matrix"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
45 make_option(c("-factFile", "--factFile"), type="character", help="Path to factor information file"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
46 make_option(c("-factInput", "--factInput"), type="character", help="String containing factors if manually input"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
47 make_option(c("-contrastData", "--contrastData"), type="character", help="Contrasts of Interest (Groups to compare)"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
48 make_option(c("-genes", "--genes"), type="character", help="Path to genes file"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
49 make_option(c("-species", "--species"), type="character"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
50 make_option(c("-base_methods", "--base_methods"), type="character", help="Gene set testing methods"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
51 make_option(c("-msigdb", "--msigdb"), type="character", help="MSigDB Gene Set Collections"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
52 make_option(c("-keggdb", "--keggdb"), type="character", help="KEGG Pathways"),
1
73281fbdf6c1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 225518a08941e7ef8e5c402e3696ec5fa6e592a0
iuc
parents: 0
diff changeset
53 make_option(c("-keggupdated", "--keggupdated"), type="logical", help="Use updated KEGG"),
0
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
54 make_option(c("-gsdb", "--gsdb"), type="character", help = "GeneSetDB Gene Sets"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
55 make_option(c("-display_top", "--display_top"), type="integer", help = "Number of top Gene Sets to display"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
56 make_option(c("-min_size", "--min_size"), type="integer", help = "Minimum Size of Gene Set"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
57 make_option(c("-fdr_cutoff", "--fdr_cutoff"), type="double", help = "FDR cutoff"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
58 make_option(c("-combine_method", "--combine_method"), type="character", help="Method to use to combine the p-values"),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
59 make_option(c("-sort_method", "--sort_method"), type="character", help="Method to sort the results"),
1
73281fbdf6c1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 225518a08941e7ef8e5c402e3696ec5fa6e592a0
iuc
parents: 0
diff changeset
60 make_option(c("-rdaOpt", "--rdaOpt"), type="character", help="Output RData file")
0
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
61 )
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
62
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
63 parser <- OptionParser(usage = "%prog [options] file", option_list=option_list)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
64 args = parse_args(parser)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
65
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
66
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
67 ## Read in Files
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
68
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
69 if (!is.null(args$filesPath)) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
70 # Process the separate count files (adapted from DESeq2 wrapper)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
71 library("rjson")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
72 parser <- newJSONParser()
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
73 parser$addData(args$filesPath)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
74 factorList <- parser$getObject()
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
75 factors <- sapply(factorList, function(x) x[[1]])
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
76 filenamesIn <- unname(unlist(factorList[[1]][[2]]))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
77 sampleTable <- data.frame(sample=basename(filenamesIn),
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
78 filename=filenamesIn,
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
79 row.names=filenamesIn,
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
80 stringsAsFactors=FALSE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
81 for (factor in factorList) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
82 factorName <- factor[[1]]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
83 sampleTable[[factorName]] <- character(nrow(sampleTable))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
84 lvls <- sapply(factor[[2]], function(x) names(x))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
85 for (i in seq_along(factor[[2]])) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
86 files <- factor[[2]][[i]][[1]]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
87 sampleTable[files,factorName] <- lvls[i]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
88 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
89 sampleTable[[factorName]] <- factor(sampleTable[[factorName]], levels=lvls)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
90 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
91 rownames(sampleTable) <- sampleTable$sample
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
92 rem <- c("sample","filename")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
93 factors <- sampleTable[, !(names(sampleTable) %in% rem), drop=FALSE]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
94
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
95 #read in count files and create single table
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
96 countfiles <- lapply(sampleTable$filename, function(x){read.delim(x, row.names=1)})
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
97 counts <- do.call("cbind", countfiles)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
98
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
99 } else {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
100 # Process the single count matrix
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
101 counts <- read.table(args$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
102 row.names(counts) <- counts[, 1]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
103 counts <- counts[ , -1]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
104 countsRows <- nrow(counts)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
105
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
106 # Process factors
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
107 if (is.null(args$factInput)) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
108 factorData <- read.table(args$factFile, header=TRUE, sep="\t")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
109 factors <- factorData[, -1, drop=FALSE]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
110 } else {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
111 factors <- unlist(strsplit(args$factInput, "|", fixed=TRUE))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
112 factorData <- list()
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
113 for (fact in factors) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
114 newFact <- unlist(strsplit(fact, split="::"))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
115 factorData <- rbind(factorData, newFact)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
116 } # Factors have the form: FACT_NAME::LEVEL,LEVEL,LEVEL,LEVEL,... The first factor is the Primary Factor.
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
117
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
118 # Set the row names to be the name of the factor and delete first row
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
119 row.names(factorData) <- factorData[, 1]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
120 factorData <- factorData[, -1]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
121 factorData <- sapply(factorData, sanitiseGroups)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
122 factorData <- sapply(factorData, strsplit, split=",")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
123 factorData <- sapply(factorData, make.names)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
124 # Transform factor data into data frame of R factor objects
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
125 factors <- data.frame(factorData)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
126 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
127 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
128
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
129 # Create a DGEList object
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
130 counts <- DGEList(counts)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
131
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
132 # Set group to be the Primary Factor input
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
133 group <- factors[, 1, drop=FALSE]
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
134
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
135 # Split up contrasts separated by comma into a vector then sanitise
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
136 contrastData <- unlist(strsplit(args$contrastData, split=","))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
137 contrastData <- sanitiseEquation(contrastData)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
138 contrastData <- gsub(" ", ".", contrastData, fixed=TRUE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
139
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
140 # Creating design
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
141 row.names(factors) <- colnames(counts)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
142 factorList <- sapply(names(factors), pasteListName)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
143
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
144 formula <- "~0"
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
145 for (i in 1:length(factorList)) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
146 formula <- paste(formula, factorList[i], sep="+")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
147 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
148 formula <- formula(formula)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
149
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
150 design <- model.matrix(formula)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
151
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
152 for (i in 1:length(factorList)) {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
153 colnames(design) <- gsub(factorList[i], "", colnames(design), fixed=TRUE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
154 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
155
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
156 ## Generate Contrasts information
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
157 contrasts <- makeContrasts(contrasts=contrastData, levels=design)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
158
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
159
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
160 ## Add Gene Symbol information
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
161
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
162 genes <- read.table(args$genes, sep='\t', header=TRUE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
163
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
164
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
165 ## Set Gene Set Testing Methods
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
166
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
167 base_methods <- unlist(strsplit(args$base_methods, ","))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
168
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
169
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
170 ## Set Gene Sets
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
171
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
172 if (args$msigdb != "None") {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
173 msigdb <- unlist(strsplit(args$msigdb, ","))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
174 } else {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
175 msigdb <- "none"
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
176 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
177
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
178 if (args$keggdb != "None") {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
179 keggdb <- unlist(strsplit(args$keggdb, ","))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
180 kegg_all <- c("Metabolism"="keggmet", "Signaling"="keggsig", "Disease"="keggdis")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
181 kegg_exclude <- names(kegg_all[!(kegg_all %in% keggdb)])
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
182 } else {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
183 kegg_exclude <- "all"
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
184 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
185
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
186 if (args$gsdb != "None") {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
187 gsdb <- unlist(strsplit(args$gsdb, ","))
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
188 } else {
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
189 gsdb <- "none"
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
190 }
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
191
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
192 ## Index gene sets
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
193
1
73281fbdf6c1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 225518a08941e7ef8e5c402e3696ec5fa6e592a0
iuc
parents: 0
diff changeset
194 gs.annots <- buildIdx(entrezIDs=rownames(counts), species=args$species, msigdb.gsets=msigdb, gsdb.gsets=gsdb, kegg.exclude=kegg_exclude, kegg.updated=args$keggupdated)
0
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
195
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
196
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
197 ## Run egsea.cnt
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
198
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
199 gsa <- egsea.cnt(counts=counts, group=group, design=design, contrasts=contrasts, gs.annots=gs.annots, symbolsMap=genes, baseGSEAs=base_methods, minSize=args$min_size, display.top=args$display_top, combineMethod=args$combine_method, sort.by=args$sort_method, report.dir='./report_dir', fdr.cutoff=args$fdr_cutoff, num.threads=args$threads, report=TRUE)
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
200
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
201
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
202 ## Output RData file
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
203
1
73281fbdf6c1 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 225518a08941e7ef8e5c402e3696ec5fa6e592a0
iuc
parents: 0
diff changeset
204 if (!is.null(args$rdaOpt)) {
0
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
205 save.image(file = "EGSEA_analysis.RData")
a8a083193440 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit 7d0c7d850cd56ea3e54d8c03266f719241b20b8b
iuc
parents:
diff changeset
206 }