Browse code

Merge branch 'shinyDashboard' of https://github.com/pablo-rodr-bio2/GSVA into shinyDashboard

pablo-rodr-bio2 authored on 17/05/2021 07:51:28
Showing11 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: GSVA
2
-Version: 1.39.29
2
+Version: 1.39.30
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"),
... ...
@@ -11,7 +11,7 @@ Imports: methods, stats, utils, graphics, S4Vectors, IRanges,
11 11
          BiocParallel, SingleCellExperiment, sparseMatrixStats, DelayedArray,
12 12
          DelayedMatrixStats, HDF5Array, BiocSingular
13 13
 Suggests: BiocGenerics, RUnit, BiocStyle, knitr, rmarkdown, limma, RColorBrewer,
14
-          org.Hs.eg.db, genefilter, edgeR, GSVAdata, shiny, shinythemes, ggplot2,
14
+          org.Hs.eg.db, genefilter, edgeR, GSVAdata, shiny, shinydashboard, ggplot2,
15 15
           data.table, plotly, future, promises, shinybusy, shinyjs
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)
... ...
@@ -1,48 +1,53 @@
1 1
 igsva <- function() {
2 2
 
3
-  shinydeps <- c("shiny", "shinythemes", "ggplot2",
3
+  shinydeps <- c("shiny", "shinydashboard", "ggplot2",
4 4
                  "data.table", "plotly", "future",
5
-                 "shinyjs", "shinybusy", "limma")
5
+                 "shinyjs", "shinybusy", "limma", "magrittr")
6 6
   maskshinydeps <- shinydeps %in% installed.packages()
7 7
   if (any(!maskshinydeps))
8 8
     stop(sprintf("Please install the following packages to use the GSVA WebApp:\n\n  %s\n",
9 9
                  paste(shinydeps[!maskshinydeps], collapse=", ")))
10
-  
11
-  # namespaceImportFrom(self=getNamespace("base"),
12
-  #                     ns=getNamespace("shiny"))
13
-  # 
14
-  # namespaceImportFrom(self=getNamespace("base"),
15
-  #                     ns=getNamespace("shinythemes"),
16
-  #                     vars="shinytheme")
17
-  # 
18
-  # namespaceImportFrom(self=getNamespace("base"),
19
-  #                     ns=getNamespace("ggplot2"),
20
-  #                     vars="ggplot")
21
-  # 
22
-  # namespaceImportFrom(self=getNamespace("base"),
23
-  #                     ns=getNamespace("data.table"))
24
-  # 
25
-  # namespaceImportFrom(self=getNamespace("base"),
26
-  #                     ns=getNamespace("plotly"),
27
-  #                     vars=c("ggplotly", "event_data", "style"))
28
-  # 
29
-  # namespaceImportFrom(self=getNamespace("base"),
30
-  #                     ns=getNamespace("future"))
31
-  # 
32
-  # namespaceImportFrom(self=getNamespace("base"),
33
-  #                     ns=getNamespace("shinyjs"))
34
-  # 
35
-  # namespaceImportFrom(self=getNamespace("base"),
36
-  #                     ns=getNamespace("shinybusy"))
37
-  # 
38
-  # namespaceImportFrom(self=getNamespace("base"),
39
-  #                     ns=getNamespace("limma"))
40 10
 
41 11
   appDir <- system.file("shinyApp", package="GSVA")
42 12
   if (appDir == "")
43 13
     stop("The GSVA Shiny app cannot be found within the package.")
44 14
 
45
-  # runWebApp <- get("runApp", mode="function")
46
-  # runWebApp(appDir)
15
+
47 16
   shiny::runApp(appDir)
48 17
 }
18
+
19
+## legacy code
20
+
21
+# runWebApp <- get("runApp", mode="function")
22
+# runWebApp(appDir)
23
+
24
+
25
+# namespaceImportFrom(self=getNamespace("base"),
26
+#                     ns=getNamespace("shiny"))
27
+# 
28
+# namespaceImportFrom(self=getNamespace("base"),
29
+#                     ns=getNamespace("shinythemes"),
30
+#                     vars="shinytheme")
31
+# 
32
+# namespaceImportFrom(self=getNamespace("base"),
33
+#                     ns=getNamespace("ggplot2"),
34
+#                     vars="ggplot")
35
+# 
36
+# namespaceImportFrom(self=getNamespace("base"),
37
+#                     ns=getNamespace("data.table"))
38
+# 
39
+# namespaceImportFrom(self=getNamespace("base"),
40
+#                     ns=getNamespace("plotly"),
41
+#                     vars=c("ggplotly", "event_data", "style"))
42
+# 
43
+# namespaceImportFrom(self=getNamespace("base"),
44
+#                     ns=getNamespace("future"))
45
+# 
46
+# namespaceImportFrom(self=getNamespace("base"),
47
+#                     ns=getNamespace("shinyjs"))
48
+# 
49
+# namespaceImportFrom(self=getNamespace("base"),
50
+#                     ns=getNamespace("shinybusy"))
51
+# 
52
+# namespaceImportFrom(self=getNamespace("base"),
53
+#                     ns=getNamespace("limma"))
49 54
\ No newline at end of file
... ...
@@ -9,7 +9,7 @@ argumentsDataUI <- function(id) {
9 9
       column(
10 10
         width = 12,
11 11
         align = "center",
12
-        h3("Parameters", style="font-weight: bold")
12
+        h4("Parameters", style="font-weight: bold")
13 13
       )
14 14
     ),
15 15
     wellPanel(
... ...
@@ -1,12 +1,15 @@
1 1
 closeBtnUI <- function(id){
2 2
   ns <- NS(id)
3
-  hidden(actionButton(ns("closeSave"), "Save & Close", style = "color: #fff;
4
-  font-weight: bold;
5
-  background-color: red;
6
-  border-color: #fff;
7
-  width:130;
8
-  padding: 5px 5px 5px 5px;
9
-  margin: 5px 5px 5px 5px; "))
3
+  hidden(actionButton(ns("closeSave"), "Save & Close", 
4
+                      icon = icon("window-close"),
5
+                      width = "10vw",
6
+                      style = "color: #fff; 
7
+                      background-color: red;
8
+                      font-weight: bold;
9
+                      border-color: #fff;
10
+                      padding: 5px 5px 5px 5px;
11
+                      margin: 6px 5px 6px 15px;"
12
+                      ))
10 13
 }
11 14
 
12 15
 closeBtnServer <- function(id, gs){
... ...
@@ -1,11 +1,14 @@
1 1
 downloadUI <- function(id) {
2 2
   ns <- NS(id)
3
-  hidden(downloadButton(ns('downloadData'), 'Download', style = "color: #fff;
4
-  font-weight: bold;
5
-  background-color: #27ae60;
6
-  border-color: #fff;
7
-  padding: 5px 14px 5px 14px;
8
-  margin: 5px 5px 5px 5px;" ))
3
+  hidden(
4
+    downloadButton(ns('downloadData'), 'Download',
5
+                   style = "color: #fff;
6
+                   background-color: #27ae60;
7
+                   font-weight: bold;
8
+                   border-color: #fff;
9
+                   padding: 5px 14px 5px 14px;
10
+                   margin: 6px 5px 6px 15px;
11
+                   width: 10vw;")) 
9 12
 }
10 13
 
11 14
 downloadServer <- function(id, gs){
... ...
@@ -1,7 +1,7 @@
1 1
 geneSetsUI <- function(id){
2 2
   ns <- NS(id)
3
-  tagList(
4
-    radioButtons(ns("genesetSourceType"), "Select gene sets:",
3
+  div( id = ns("genesets-input"),
4
+    radioButtons(ns("genesetSourceType"), "Select Gene Sets:",
5 5
                  c("From file" = "fileGeneset",
6 6
                    "From workspace" = "varGeneset")),
7 7
     conditionalPanel(
... ...
@@ -1,7 +1,7 @@
1 1
 matrixUI <- function(id){
2 2
   ns <- NS(id)
3
-  tagList(
4
-    radioButtons(ns("matrixSourceType"), "Select expression data matrix:",
3
+  div(id = ns("matrix-input"),
4
+    radioButtons(ns("matrixSourceType"), "Select Expression Data Matrix:",
5 5
                  c("From file" = "fileMatrix",
6 6
                    "From workspace" = "varMatrix")),
7 7
     conditionalPanel(
... ...
@@ -181,14 +181,17 @@ function(input, output, session) {
181 181
   
182 182
   # CLOSE BTN
183 183
   closeBtnServer("close", reactive(rv$gs))
184
-
184
+  
185 185
   
186 186
   # TEXT1
187 187
   output$text1 <- renderUI({
188 188
     req(rv$gs)
189
-    HTML(paste("<br/>", "\t To see the Empirical Cumulative Distribution Function 
190
-    of a Sample, click on its line in this plot and go
191
-      to the 'Gene.Set' Panel", "<br/>", sep="<br/>"))
189
+    tagList(
190
+      br(),
191
+      div("To see the Empirical Cumulative Distribution Function 
192
+      of a Sample, click on its line in this plot and go to the 
193
+      'Gene.Set' Panel", style="text-align: center;")
194
+    )
192 195
   })
193 196
   
194 197
   # TABLE
... ...
@@ -24,20 +24,24 @@ dashboardPage(
24 24
     br(),
25 25
     geneSetsUI("genes1"),
26 26
     br(),
27
-    radioButtons("arg", "Change default settings:",
27
+    radioButtons("arg", "Change default settings?",
28 28
                  c("No" = "no",
29 29
                    "Yes" = "yes")),
30 30
     br(),
31 31
     fluidRow(
32
-      actionButton("button", "Run"),
33
-      downloadUI("download"),
34
-      closeBtnUI("close"),
32
+      column(
33
+        width = 12, align = "left",
34
+        actionButton("button", "Run", class = "run-btn", icon = icon("play-circle"),
35
+                     width = "10vw"),
36
+        downloadUI("download"),
37
+        closeBtnUI("close")
38
+      )
35 39
     )
36 40
   ),
37 41
   
38 42
   dashboardBody(
39 43
     shinyjs::useShinyjs(),
40
-    add_busy_spinner(spin = "double-bounce", position = "bottom-right",
44
+    add_busy_spinner(spin = "cube-grid", position = "bottom-right",
41 45
                      height = "100px", width = "100px"),
42 46
     fluidRow(
43 47
       box(
... ...
@@ -47,7 +51,14 @@ dashboardPage(
47 51
                              textOutput("errorsGsva"),
48 52
                              htmlOutput("text1"),
49 53
                              plot1_UI("plot1"),
50
-                             tableOutput("result")
54
+                             br(),
55
+                             fluidRow(
56
+                               column(
57
+                                 width = 12,
58
+                                 align = "center",
59
+                                 tableOutput("result")
60
+                               )
61
+                             )
51 62
                     ),
52 63
                     tabPanel("GeneSets",
53 64
                              uiOutput("text2"),
... ...
@@ -11,6 +11,16 @@ font-weight: bold;
11 11
   color: white;
12 12
   font-weight: bold;
13 13
   font-size: 30px;
14
+  padding: 5px 5px 5px 5px;
15
+  margin: 5px 5px 5px 5px;
16
+}
17
+
18
+#matrix1-matrix-input, #genes1-genesets-input {
19
+  background-color: #708090;
20
+}
21
+
22
+#arg {
23
+  background-color: #BC8F8F;
14 24
 }
15 25
 
16 26
 .left-side, .main-sidebar {
... ...
@@ -26,6 +36,15 @@ font-weight: bold;
26 36
   
27 37
 }
28 38
 
39
+.run-btn {
40
+  color: #fff; 
41
+  background-color: #6495ED;
42
+  font-weight: bold;
43
+  border-color: #fff;
44
+  padding: 5px 5px 5px 5px;
45
+  margin: 5px 5px 5px 5px;
46
+}
47
+
29 48
 
30 49
 /**
31 50
 .main-header {
... ...
@@ -63,8 +63,9 @@ Once `r Biocpkg("GSVA")` is installed, it can be loaded with the following comma
63 63
 library(GSVA)
64 64
 ```
65 65
 
66
-Given a gene expression data matrix with rows corresponding to genes and columns
67
-to samples, such as this one simulated from random Gaussian data:
66
+Given a gene expression data matrix, which we shall call `X`, with rows
67
+corresponding to genes and columns to samples, such as this one simulated from
68
+random Gaussian data:
68 69
 
69 70
 ```{r}
70 71
 p <- 10000 ## number of genes
... ...
@@ -75,8 +76,9 @@ X <- matrix(rnorm(p*n), nrow=p,
75 76
 X[1:5, 1:5]
76 77
 ```
77 78
 
78
-Given a collection of gene sets stored, for instance, in a `list` object such as
79
-this one with genes sampled uniformly at random without replacement into the gene sets:
79
+Given a collection of gene sets stored, for instance, in a `list` object, which
80
+we shall call `gs`, with genes sampled uniformly at random without replacement
81
+into 100 different gene sets:
80 82
 
81 83
 ```{r}
82 84
 ## sample gene set sizes
... ...
@@ -95,24 +97,26 @@ dim(gsva.es)
95 97
 gsva.es[1:5, 1:5]
96 98
 ```
97 99
 
98
-So, the first argument to the `gsva()` function is the gene expression data matrix
99
-and the second the collection of gene sets. The `gsva()` function can take the input
100
-expression data and gene sets using different specialized containers that facilitate
101
-the access and manipulation of molecular and phenotype data, as well as their associated
102
-metadata. Another advanced features include the use of on-disk and parallel backends to
103
-enable using GSVA on large molecular data sets and speed up computing time. You will
104
-find information on all these features in this vignette.
100
+The first argument to the `gsva()` function is the gene expression data matrix
101
+and the second the collection of gene sets. The `gsva()` function can take the
102
+input expression data and gene sets using different specialized containers that
103
+facilitate the access and manipulation of molecular and phenotype data, as well
104
+as their associated metadata. Another advanced features include the use of
105
+on-disk and parallel backends to enable, respectively, using GSVA on large
106
+molecular data sets and speed up computing time. You will find information on
107
+these features in this vignette.
105 108
 
106 109
 # Introduction
107 110
 
108 111
 Gene set variation analysis (GSVA) provides an estimate of pathway activity
109
-by transforming an input gene-by-sample expression data matrix
110
-into a gene-set-by-sample one. This resulting expression data matrix can be
111
-then used with classical analytical methods such as differential expression,
112
-classification, survival analysis, clustering or correlation analysis in a
113
-pathway-centric manner. One can also perform sample-wise comparisons between
114
-pathways and other molecular data types such as microRNA expression or binding
115
-data, copy-number variation (CNV) data or single nucleotide polymorphisms (SNPs).
112
+by transforming an input gene-by-sample expression data matrix into a
113
+corresponding gene-set-by-sample expression data matrix. This resulting
114
+expression data matrix can be then used with classical analytical methods such
115
+as differential expression, classification, survival analysis, clustering or
116
+correlation analysis in a pathway-centric manner. One can also perform
117
+sample-wise comparisons between pathways and other molecular data types such
118
+as microRNA expression or binding data, copy-number variation (CNV) data or
119
+single nucleotide polymorphisms (SNPs).
116 120
 
117 121
 The GSVA package provides an implementation of this approach for the following
118 122
 methods:
... ...
@@ -151,7 +155,7 @@ methods:
151 155
 
152 156
 The interested user may find full technical details about how these methods
153 157
 work in their corresponding articles cited above. If you use any of them in a
154
-publication, please cite it with the given bibliographic reference.
158
+publication, please cite them with the given bibliographic reference.
155 159
 
156 160
 # Overview of the GSVA functionality
157 161
 
... ...
@@ -197,13 +201,14 @@ the following filters:
197 201
    minimum and maximum size, which by default is one for the minimum size and
198 202
    has no limit for the maximum size.
199 203
 
200
-If, as a result of this filter, either no genes or gene sets are left, the
201
-`gsva()` function will prompt an error. A common cause for an error at this
202
-stage is that gene identifiers between the expression data matrix and the gene
203
-sets do not belong to the same standard nomenclature and could not be mapped,
204
-because either the input data were not provided using some of the specialized
205
-containers described above or the necessary metadata in those containers to
206
-successfully map gene identifiers is missing.
204
+If, as a result of applying these three filters, either no genes or gene sets
205
+are left, the `gsva()` function will prompt an error. A common cause for such
206
+an error at this stage is that gene identifiers between the expression data
207
+matrix and the gene sets do not belong to the same standard nomenclature and
208
+could not be mapped. This may happen because either the input data were not
209
+provided using some of the specialized containers described above or the
210
+necessary metadata in those containers that allows the software to successfully
211
+map gene identifiers, is missing.
207 212
 
208 213
 By default, the `gsva()` function employs the method described by
209 214
 @haenzelmann_castelo_guinney_2013 but this can be changed using the argument
... ...
@@ -253,12 +258,12 @@ continuous expression values.
253 258
 
254 259
 # Gene set definitions and gene identifier mapping
255 260
 
256
-Gene sets constitute a simple, yet useful, way to define pathways, essentially
257
-because we use pathway membership definitions only, neglecting the information
258
-on molecular interactions. Gene set definitions are a crucial input to any gene
259
-set enrichment analysis because if our gene sets do not capture the biological
261
+Gene sets constitute a simple, yet useful, way to define pathways because we
262
+use pathway membership definitions only, neglecting the information on molecular
263
+interactions. Gene set definitions are a crucial input to any gene set
264
+enrichment analysis because if our gene sets do not capture the biological
260 265
 processes we are studying, we will likely not find any relevant insights in our
261
-data.
266
+data from an analysis based on these gene sets.
262 267
 
263 268
 There are multiple sources of gene sets, the most popular ones being
264 269
 [The Gene Ontology (GO) project](http://geneontology.org) and