-
Notifications
You must be signed in to change notification settings - Fork 4
/
tabs.R
283 lines (271 loc) · 7.94 KB
/
tabs.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
require(shinyMCE)
require(shiny)
source("modulesUI.R")
# this is where the general tabs are defined:
if (file.exists("defaultValues.R")) {
source("defaultValues.R")
} else {
defaultValueSingleGene <- ""
defaultValueMultiGenes <- ""
defaultValueRegExGene <- ""
}
# inputTab ----
inputTab <- tabItem(
tabName = "input",
fluidRow(div(h3("scShinyHub Input"), align = "center")),
br(),
fluidRow(div(
h5(
"This app is designed for exploratory data analysis of processed RNA-Seq data of single cell experiments.
Multiple files can be selected using certain browsers (E.g. chrome). This is not working when running in RStudio as a window.
Rds files are R data files generated using base::save(). They contain two objects, scEx that hold raw counts in a sparse matrix
and annotation in a data frame."
),
align = "center"
)),
br(),
br(),
fluidRow(column(
5,
offset = 4,
fileInput(
"file1",
"Choose .Rds file to upload",
accept = c(
".Rds",".RData"
),
multiple = TRUE
)
)),
fluidRow(column(6,
textInput("beforeFilterRegEx", "regular expression to count genes/cell", value = "^MT-|^RP|^MRP")
)),
fluidRow(column(6,
tags$div(
tags$p("This regular expression will be used before filtering out genes.
It is meant to keep track of genes that were removed from gene filtering. This will generate a projection
called 'before.filter'.")
)
))
)
# geneSelectionTab ----
geneSelectionTab <- tabItem(
tabName = "geneSelection",
fluidRow(div(h3("Gene selection"), align = "center")),
br(),
fluidRow(div(
h4(
"Here we filter out genes"
),
align = "center"
)),
fluidRow(
column(3,
offset = 1,
textInput("selectIds", "regular expression for selection of genes to be removed", value = "^MT-|^RP|^MRP")
),
column(
5,
h4("GeneList Selection"),
shinyTree("geneListSelection", checkbox = TRUE)
),
column(
2,
h4("Minoverall expression"),
numericInput("minGenesGS", "Min # of UMIs over all cells", 2, min = 2, max = 1000000)
)
),
fluidRow(
column(6,
offset = 1,
textInput("genesKeep", "genes to keep")
)
),
br(),
fluidRow(
h3("Genes kept, with mean Expression, and number of cells expressing min 1", align = "center"),
br(),
h4("Selected genes"),
column(12,
offset = 0,
textOutput("gsSelectedGenes", inline = FALSE)
),
br(),
column(10,
offset = 1,
DT::dataTableOutput("selectedGenesTable")
)
),
br(),
fluidRow(
h3("Genes removed, with mean Expression, and number of cells expressing min 1", align = "center"),
h4("Selected genes"),
br(),
textOutput("gsrmGenes", inline = FALSE)
), br(),
fluidRow(
column(10,
offset = 1,
DT::dataTableOutput("removedGenesTable")
)
)
)
# generalParametersTab ----
generalParametersTab <- tabItem(
"generalParameters",
fluidRow(div(h2("General parameters"), align = "center")),
br(),
fluidRow(div(h3("Parameters for clustering"), align = "left")),
fluidRow(
# column(2,
# offset = 1,
# numericInput("kNr", "Number of clusters", 10, min = 2, max = 30)
# ),
column(2, offset = 0,
selectInput("clusterSource", "use PCA or normalized data?", choices = c("PCA", "normData"), selected = "PCA")),
column(2, offset = 0,
numericInput("minClusterSize", "minimum size of each cluster.", 2, min = 2)),
column(2, offset = 0,
selectInput("clusterMethod", "clustering method to use", choices = c("hclust", "igraph"), selected = "igraph"))
),
fluidRow(
column(10, offset = 1,
textInput("geneSelectionClustering", "Genes to be used for clustering")
)
),
br(),
fluidRow(
column(10, offset = 1,
textOutput("Nclusters"))
),
br(),
fluidRow(div(h3("Comments"), align = "left")),
fluidRow(
tinyMCE(
"descriptionOfWork",
"Please describe your work. This will be included in the report."
)
),
br(),
fluidRow(div(h3("Colors"), align = "left")),
fluidRow(
actionButton("updateColors", "Update colours", icon = icon("update"))
),
fluidRow(column(4,offset = 1,
uiOutput('sampleColorSelection')
),
column(4,offset = 1,
uiOutput('clusterColorSelection')
)
)
# ,
# fluidRow(
# column(11,offset = 1,
# textOutput("descriptOfWorkOutput", inline = TRUE))
# )
)
# cellSelectionTab ----
cellSelectionTab <- tabItem(
tabName = "cellSelection",
fluidRow(div(h3("Cell selection"), align = "center")),
br(),
fluidRow(div(
h4(
"Here we filter out cells"
),
align = "center"
)), fluidRow(
column(6,
offset = 1,
tipify(textInput("minExpGenes", "List of genes with minimal expression", value = defaultValueRegExGene),
title = "<h3>Cells must have one or more</h3> <ul><li>These cells must have at least one of those genes expressed</li> </ul> ",
options = list(
"width" = "300px", "placement" = "right", "max-width" = "350px",
"data-container" = "body", container = "body"
)
) # tool tip: '^CD7$|^KIT$
)
),
fluidRow(
column(5,
offset = 1,
numericInput("minGenes", "Min # of UMIs", 2, min = 2, max = 1000000)
),
column(
5,
numericInput("maxGenes", "Max # of UMIs", 1000000, min = 10, max = 1000000)
)
), br(),
fluidRow(
column(6,
offset = 1,
textInput("cellSelectionComment", "Comment for selection of cells")
)
),
fluidRow(
column(6,
offset = 1,
tipify(textInput("cellPatternRM", "cells to be filtered out by pattern"),
title = "regular expression for cells to be removed (e.g. -1 will remove all cells from sample 1"
)
)
),
fluidRow(
column(6,
offset = 1,
tipify(textInput("cellKeep", "cells to keep"),
title = "comma separated list of cells (with min expression) that should be kept"
)
)
), fluidRow(
column(6,
offset = 1,
tipify(textInput("cellKeepOnly", "cells to keep; remove others"),
title = "comma separated list of cells (with min expression) that should be kept and anything else removed"
)
)
),
fluidRow(
column(10,
offset = 1,
tipify(textInput("cellsFiltersOut", "Cells to be removed", width = "100%"),
title = "comma separted list of cell names to be explicitly removed"
)
)
), br(),
fluidRow(column(
11,
offset = 1,
tableSelectionUi("cellSelectionMod")
)), br()
)
# parse all parameters.R files under contributions to include in application
# allTabs holds all tabs regardsless of their location in the GUI
parameterContributions <- list()
parFiles <- dir(path = "contributions", pattern = "parameters.R", full.names = TRUE, recursive = TRUE)
for (fp in parFiles) {
myPparameters <- list()
source(fp, local = TRUE)
if (length(myPparameters) > 0) {
for (li in myPparameters) {
if (length(li) > 0) {
if (DEBUG) cat(file = stderr(), paste(li$children[[1]], "\n"))
parameterContributions[[length(parameterContributions) + 1]] <- li
}
}
}
}
# submenu items for the paramters main tab
parameterItems <- list(
menuSubItem("Normalization", tabName = "normalizations"),
parameterContributions,
menuSubItem("General Parameters", tabName = "generalParameters")
)
# # link to the content of the
# parametersTab = tabItem(tabName = "normalizations",
# fluidRow(div(h3('Cell selection'), align = 'center')),
# br()
# )
if (DEBUG) {
cat(file = stderr(), paste("end: tabs.R\n"))
}