Browse code

Updated shiny app.

[rcastelo] authored on 06/02/2020 11:48:32
Showing5 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: GSVA
2
-Version: 1.35.4
2
+Version: 1.35.5
3 3
 Title: Gene Set Variation Analysis for microarray and RNA-seq data
4 4
 Authors@R: c(person("Justin", "Guinney", role=c("aut", "cre"), email="justin.guinney@sagebase.org"),
5 5
              person("Robert", "Castelo", role="aut", email="robert.castelo@upf.edu"),
... ...
@@ -175,8 +175,7 @@ gsva_generation <- function(input, output, session, newY, genes,varMaxsz) {
175 175
     generated_gsva <<- gsva(newY, genes, method=input$method, kcdf=input$kcdf,
176 176
                             abs.ranking=as.logical(input$absRanking),
177 177
                             min.sz=input$minSz, max.sz=varMaxsz,
178
-                            ## parallel.sz=input$parallelSz, parallel.type=input$parallelType,
179
-                            parallel.sz=1, ## disable parallelism
178
+                            parallel.sz=1L, ## by now, disable parallelism
180 179
                             mx.diff=as.logical(input$mxDiff),
181 180
                             tau=selectedTau,
182 181
                             ssgsea.norm=as.logical(input$ssgseaNorm),
... ...
@@ -185,37 +184,26 @@ gsva_generation <- function(input, output, session, newY, genes,varMaxsz) {
185 184
 }
186 185
 
187 186
 gsva_information <- function(input, output, session) {
188
-  if(class(generated_gsva) == "matrix")
189
-  {
190
-    resultInformation <- matrix(data = c(input$matrixVar,input$genesetVar,ncol(generated_gsva),nrow(generated_gsva)), nrow = 1, ncol = 4)
191
-    colnames(resultInformation) <- c("Matrix used","GeneSet used", "Col num", "Row num")
192
-    output$result <- renderTable(resultInformation)
193
-    output$plot <- renderPlot(multidensity(as.list(as.data.frame(generated_gsva)), legend=NA, las=1, xlab=sprintf("%s scores", input$method), main="", lwd=2))
194
-    tagList(
195
-      downloadButton('downloadData', 'Download'),
196
-      actionButton('closeSave','Save & Close')
197
-    )
198
-  }
187
+  gsva_es <- NA
188
+  if("matrix" %in% class(generated_gsva))
189
+    gsva_es <- as.data.frame(generated_gsva)
190
+  else if ("ExpressionSet" %in% class(generated_gsva))
191
+    gsva_es <- as.data.frame(exprs(generated_gsva))
192
+  else if ("SummarizedExperiment" %in% class(generated_gsva))
193
+    gsva_es <- as.data.frame(assays(generated_gsva)[[1]])
199 194
   else
200
-  {
201
-    
202
-    resultInformation <- matrix(data = c(input$matrixVar,input$genesetVar,ncol(generated_gsva),nrow(generated_gsva)), nrow = 1, ncol = 4)
203
-    colnames(resultInformation) <- c("Matrix used","GeneSet used", "Col num", "Row num")
204
-    output$result <- renderTable(resultInformation)
205
-    if(class(generated_gsva) == "ExpressionSet") #If the generated gsva is an ExpressionSet
206
-    {
207
-      expressionSetObs <- exprs(generated_gsva)
208
-      output$plot <- renderPlot(multidensity(as.list(as.data.frame(expressionSetObs)), legend=NA, las=1, xlab=sprintf("%s scores", input$method), main="", lwd=2)) 
209
-    }
210
-    else
211
-    {
212
-      output$plot <- renderPlot(multidensity(as.list(as.data.frame(generated_gsva)), legend=NA, las=1, xlab=sprintf("%s scores", input$method), main="", lwd=2))
213
-    }
214
-    tagList(
215
-      downloadButton('downloadData', 'Download'),
216
-      actionButton('closeSave','Save & Close')
217
-    )
218
-  }
195
+    stop("Unknown output generated by the call to the 'gsva()' function.")
196
+
197
+  resultInformation <- matrix(data = c(nrow(generated_gsva),
198
+                                       ncol(generated_gsva)),
199
+                                       nrow = 1, ncol = 2)
200
+  colnames(resultInformation) <- c("Nr. of gene sets", "Nr. of samples")
201
+  output$result <- renderTable(resultInformation)
202
+  output$plot <- renderPlot(multidensity(as.list(as.data.frame(generated_gsva)), legend=NA, las=1, xlab=sprintf("%s scores", input$method), main="", lwd=2, cex.axis=1.2, cex.lab=1.5))
203
+  tagList(
204
+    downloadButton('downloadData', 'Download'),
205
+    actionButton('closeSave','Save & Close')
206
+  )
219 207
 }
220 208
 
221 209
 download_handler <- function(input, output, session) {
... ...
@@ -225,14 +213,14 @@ download_handler <- function(input, output, session) {
225 213
       paste("gsva_es-", Sys.Date(), ".csv", sep="")
226 214
     },
227 215
     content = function(file) {
228
-      if(class(generated_gsva) == "matrix") #If the whole object is a matrix
216
+      if("matrix" %in% class(generated_gsva)) # if the whole object is a matrix
229 217
       {
230 218
         dataFrameObs <- as.data.frame(generated_gsva)
231 219
         write.csv(dataFrameObs, file)
232 220
       }
233 221
       else
234 222
       {
235
-        if(class(generated_gsva) == "ExpressionSet") #If the generated gsva result value is an ExpressionSet
223
+        if("ExpressionSet" %in% class(generated_gsva)) #If the generated gsva result object is an ExpressionSet
236 224
         {
237 225
           expressionSetObs <- exprs(generated_gsva)
238 226
           dataFrameObs <- as.data.frame(expressionSetObs)
... ...
@@ -8,13 +8,13 @@ selectDataInput <- function(id) {
8 8
   #UI declaration
9 9
   column(
10 10
     3,
11
-    h3("Select data source:"),
11
+    h3("Data input:"),
12 12
     #Select data source
13 13
     wellPanel(fluidRow(
14 14
       column(
15 15
         12,
16
-        #Select matrix
17
-        radioButtons("matrixSourceType", "Select matrix:",
16
+        #Select expression data matrix
17
+        radioButtons("matrixSourceType", "Select expression data matrix:",
18 18
                      c("From file" = "fileMatrix",
19 19
                        "From workspace" = "varMatrix"))
20 20
         ,
... ...
@@ -37,7 +37,7 @@ selectDataInput <- function(id) {
37 37
         fluidRow(column(12,
38 38
                         HTML("<br>"))),
39 39
         #Select geneset
40
-        radioButtons("genesetSourceType", "Select GeneSet:",
40
+        radioButtons("genesetSourceType", "Select gene sets:",
41 41
                      c("From file" = "fileGeneset",
42 42
                        "From workspace" = "varGeneset"))
43 43
         ,
... ...
@@ -54,7 +54,7 @@ selectDataInput <- function(id) {
54 54
                       ls(envir=.GlobalEnv))
55 55
         ),
56 56
         HTML("<br>"),
57
-        radioButtons("arg", "Control arguments:",
57
+        radioButtons("arg", "Change default settings:",
58 58
                      c("No" = "no",
59 59
                        "Yes" = "yes"))
60 60
       )
... ...
@@ -69,7 +69,7 @@ mainDataInput <- function(id) {
69 69
   
70 70
   #UI Definition
71 71
   mainPanel(width = 6,
72
-            h2("Generated GSVA data:"),
72
+            ## h2("GSVA: gene set variation analysis"),
73 73
             textOutput("information"),
74 74
             plotOutput("plot"),
75 75
             tableOutput("result"),
... ...
@@ -85,7 +85,7 @@ argumentsDataInput <- function(id) {
85 85
     3,
86 86
     conditionalPanel(
87 87
       condition = "input.arg == 'yes'",
88
-      h3("Select arguments:"),
88
+      h3("Parameters:"),
89 89
       wellPanel(fluidRow(
90 90
         column(
91 91
           12,
... ...
@@ -98,9 +98,6 @@ argumentsDataInput <- function(id) {
98 98
                          "True" = TRUE)),
99 99
           numericInput("minSz","min.sz:",value = 1),
100 100
           numericInput("maxSz","max.sz (Write 0 for infinite):",value = 0),
101
-          numericInput("parallelSz","parallel.sz:",value = 0),
102
-          selectInput("parallelType", "parallel.type:",
103
-                      c("SOCK","MPI","NWS")),
104 101
           radioButtons("mxDiff", "mx.diff:",
105 102
                        c("True" = TRUE,
106 103
                          "False" = FALSE)),
... ...
@@ -110,14 +107,11 @@ argumentsDataInput <- function(id) {
110 107
           ),
111 108
           conditionalPanel(
112 109
             condition = "input.method == 'ssgsea'",
113
-            numericInput("tau2","tau:",value = 0.25)
110
+            numericInput("tau2","tau:",value = 0.25),
111
+            radioButtons("ssgseaNorm", "ssgsea.norm:",
112
+                         c("True" = TRUE,
113
+                           "False" = FALSE)),
114 114
           ),
115
-          conditionalPanel(
116
-            condition = "input.method == 'zscore' || input.method == 'plage'"
117
-          ),
118
-          radioButtons("ssgseaNorm", "ssgsea.norm:",
119
-                       c("True" = TRUE,
120
-                         "False" = FALSE)),
121 115
           radioButtons("verbose", "verbose:",
122 116
                        c("True" = TRUE,
123 117
                          "False" = FALSE))
... ...
@@ -126,7 +120,14 @@ argumentsDataInput <- function(id) {
126 120
   )
127 121
 }
128 122
 
129
-fluidPage(theme = shinytheme("simplex"),	
123
+fluidPage(
124
+  theme = shinytheme("spacelab"),	
125
+  tags$head(
126
+    tags$link(rel = "stylesheet", type = "text/css", href = "style.css")
127
+  ),
128
+  titlePanel(div(h2("GSVA WebApp", align="left"),
129
+             tags$img(src="GSVA.png", align="center", height=75, width=75)),
130
+             windowTitle="GSVA"),
130 131
 	fluidRow(
131 132
 	  selectDataInput("dataInput"),
132 133
 	  mainDataInput("mainInput")
... ...
@@ -135,4 +136,4 @@ fluidPage(theme = shinytheme("simplex"),
135 136
 	    argumentsDataInput("argumentsInput")
136 137
 	  )
137 138
 	)
138
-)
139 139
\ No newline at end of file
140
+)
140 141
new file mode 100644
141 142
Binary files /dev/null and b/inst/shinyApp/www/GSVA.png differ
142 143
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+.shiny-output-error-validation {
2
+	font-size: 16px;
3
+	font-weight: bold;
4
+	color: green;
5
+      }