Browse code

hide dwn and close btns

pablo-rodr-bio2 authored on 13/04/2021 17:00:38
Showing7 changed files

... ...
@@ -12,7 +12,7 @@ Imports: methods, stats, utils, graphics, S4Vectors, IRanges,
12 12
          DelayedMatrixStats, HDF5Array, BiocSingular
13 13
 Suggests: BiocGenerics, RUnit, BiocStyle, knitr, markdown, limma, RColorBrewer,
14 14
           genefilter, edgeR, GSVAdata, shiny, shinythemes, ggplot2, data.table,
15
-          plotly, shinyjs, future, promises, shinybusy
15
+          plotly, shinyjs, future, promises, shinybusy, org.Hs.eg.db
16 16
 Description: Gene Set Variation Analysis (GSVA) is a non-parametric, unsupervised method for estimating variation of gene set enrichment through the samples of a expression data set. GSVA performs a change in coordinate systems, transforming the data from a gene by sample matrix to a gene-set by sample matrix, thereby allowing the evaluation of pathway enrichment for each sample. This new matrix of GSVA enrichment scores facilitates applying standard analytical methods like functional enrichment, survival analysis, clustering, CNV-pathway analysis or cross-tissue pathway analysis, in a pathway-centric manner.
17 17
 License: GPL (>= 2)
18 18
 VignetteBuilder: knitr
... ...
@@ -1,10 +1,11 @@
1 1
 igsva <- function() {
2 2
 
3 3
   shinydeps <- c("shiny", "shinythemes", "ggplot2",
4
-                 "data.table", "plotly")
4
+                 "data.table", "plotly", "future",
5
+                 "shinyjs", "shinybusy")
5 6
   maskshinydeps <- shinydeps %in% installed.packages()
6 7
   if (any(!maskshinydeps))
7
-    stop(sprintf("Please install the following packages to use the GenomiScores WebApp:\n\n  %s\n",
8
+    stop(sprintf("Please install the following packages to use the GSVA WebApp:\n\n  %s\n",
8 9
                  paste(shinydeps[!maskshinydeps], collapse=", ")))
9 10
   
10 11
   namespaceImportFrom(self=getNamespace("base"),
... ...
@@ -25,6 +26,15 @@ igsva <- function() {
25 26
   namespaceImportFrom(self=getNamespace("base"),
26 27
                       ns=getNamespace("plotly"),
27 28
                       vars=c("ggplotly", "event_data", "style"))
29
+  
30
+  namespaceImportFrom(self=getNamespace("base"),
31
+                      ns=getNamespace("future"))
32
+  
33
+  namespaceImportFrom(self=getNamespace("base"),
34
+                      ns=getNamespace("shinyjs"))
35
+  
36
+  namespaceImportFrom(self=getNamespace("base"),
37
+                      ns=getNamespace("shinybusy"))
28 38
 
29 39
   appDir <- system.file("shinyApp", package="GSVA")
30 40
   if (appDir == "")
31 41
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+closeBtnUI <- function(id){
2
+  ns <- NS(id)
3
+  hidden(actionButton(ns("closeSave"), "Save & Close"))
4
+}
5
+
6
+closeBtnServer <- function(id, gs){
7
+  moduleServer(
8
+    id, 
9
+    function(input, output, session){
10
+      # SAVE & CLOSE BTN
11
+      observe({
12
+        if(is.null(gs())){
13
+          hide("closeSave")
14
+        } else {
15
+          show("closeSave")
16
+        }
17
+      })
18
+      
19
+      observeEvent(input$closeSave, {
20
+        stopApp(gs()) #Stops the app and returns the rv$gs object to the R session
21
+      })
22
+    }
23
+  )
24
+}
0 25
\ No newline at end of file
... ...
@@ -1,9 +1,6 @@
1 1
 downloadUI <- function(id) {
2 2
   ns <- NS(id)
3
-  tagList(
4
-    downloadButton(ns('downloadData'), 'Download'),
5
-    actionButton(ns('closeSave'),'Save & Close')
6
-  )
3
+  hidden(downloadButton(ns('downloadData'), 'Download'))
7 4
 }
8 5
 
9 6
 downloadServer <- function(id, gs){
... ...
@@ -11,6 +8,11 @@ downloadServer <- function(id, gs){
11 8
     id,
12 9
     function(input, output, session){
13 10
       #Controls the Download button
11
+      
12
+      observe({
13
+        
14
+      })
15
+      
14 16
       output$downloadData <- downloadHandler(
15 17
         filename = function() {
16 18
           paste("gsva_es-", Sys.Date(), ".csv", sep="")
... ...
@@ -19,4 +19,5 @@ source("plot2_Module.R")
19 19
 source("plot3_Module.R")
20 20
 source("matrixModule.R")
21 21
 source("geneSetsModule.R")
22
-source("argumentsDataModule.R")
23 22
\ No newline at end of file
23
+source("argumentsDataModule.R")
24
+source("closeModule.R")
24 25
\ No newline at end of file
... ...
@@ -111,14 +111,12 @@ function(input, output, session) {
111 111
     ind <- ind$pointNumber+1
112 112
   })
113 113
   plot3_Server("plot3", eventData2, rv, rv$matrix, rv$genesets)
114
-
115
-  # SAVE & CLOSE BTN
116
-  observeEvent(input$closeSave, {
117
-    stopApp(rv$gs) #Stops the app and returns the rv$gs object to the R session
118
-  })
119 114
   
120 115
   # DWN BTN
121 116
   downloadServer("download", rv$gs)
117
+  
118
+  # CLOSE BTN
119
+  closeBtnServer("close", reactive(rv$gs))
122 120
 
123 121
   
124 122
   # TEXT1
... ...
@@ -39,7 +39,8 @@ fluidPage(
39 39
                                    htmlOutput("text1"),
40 40
                                    plot1_UI("plot1"),
41 41
                                    tableOutput("result"),
42
-                                   downloadUI("download")),
42
+                                   downloadUI("download"),
43
+                                   closeBtnUI("close")),
43 44
                           tabPanel("Gene Sets",
44 45
                                    uiOutput("text2"),
45 46
                                    htmlOutput("text3"),