-
Notifications
You must be signed in to change notification settings - Fork 6
/
ui.R
428 lines (426 loc) · 18.3 KB
/
ui.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
library(shiny)
shinyUI(navbarPage(
title = "", id="main_panel",
theme = shinythemes::shinytheme("flatly"),
tabPanel(value="main",
title = p("UpSetR", style = "font-size: 20px; padding-bottom: -0.5cm"),
fluidRow(column(
6,
sidebarLayout(
sidebarPanel(
h2("Welcome to the UpSetR Shiny App!"),
br(),
tags$p(HTML(
"UpSetR generates static <a href=\"http://vcg.github.io/upset/?dataset=0&duration=1000&orderBy=subsetSize&grouping=groupByIntersectionSize&selection=\">UpSet plots</a>.
The UpSet technique visualizes set intersections in a matrix layout
and introduces aggregates based on groupings and queries. The matrix layout enables the effective
representation of associated data, such as the number of elements in the aggregates and intersections,
as well as additional summary statistics derived from subset or element attributes."
)),
br(),
h4(
HTML("To begin, input your data using one of the three input styles.")
),
tags$p(
HTML(
"<ol start='1'> <li>\"File\" takes a correctly formatted.csv file.</li>
<li>\"List\" takes up to 6 different lists that contain unique elements, similar to that used in
the web applications BioVenn <a href='http://www.biomedcentral.com/content/pdf/1471-2164-9-488.pdf'> (Hulsen et al., 2008)</a> and jvenn <a href=http://www.biomedcentral.com/content/pdf/1471-2105-15-293.pdf> (Bardou et al., 2014) </a></li>
<li>\"Expression\" takes the input used by the venneuler R package <a href ='https://cran.r-project.org/web/packages/venneuler/venneuler.pdf'> (Wilkinson, 2015) </a></li>
</ol>"
)
),
h4('To view and explore your data click on the "Plot!" button.'),
br(),
tags$p(HTML(
"For further details about the original technique see the <a href=\"http://www.caleydo.org/tools/upset/\">UpSet website</a>.
You can also check out the <a href=\"https://github.com/hms-dbmi/UpSetR\"> UpSetR R package </a> and its source code."
)),
tags$p(HTML(
"If you use UpSetR in a paper, please cite: "
)),
tags$p(HTML(
"<blockquote style='font-size:14px'>Alexander Lex, Nils Gehlenborg, Hendrik Strobelt, Romain Vuillemot, Hanspeter Pfister,
UpSet: Visualization of Intersecting Sets,
IEEE Transactions on Visualization and Computer Graphics (InfoVis '14), vol. 20, no. 12, pp. 1983–1992, 2014.
doi:10.1109/TVCG.2014.2346248 </blockquote>"
)),
width = 12
),
mainPanel(img(src = 'Rplot.png', align = "center", width="675px", height="457px"))
)
), column(
6,
tabsetPanel(
tabPanel("Option 1: File",
column(12,
sidebarLayout(
fluidRow(
mainPanel(
tags$h3(HTML("<u>Instructions</u>")),
p(
"To use this method, begin by uploading a correctly formatted .csv file.
A correctly formatted .csv file is encoded in binary and set up so that each
column represents a set, and each row represents an element. If an element is
in the set it is represented as a 1 in that position. If an element is not in
the set it is represented as a 0."
),
br(),
p(
"After uploading the file, choose the correct separator. If the elements in each
column are seperated by a ' , ' choose comma, by a ' ; ' choose semicolon, or by tabs choose tab."
),
# h3("Begin by uploading your correctly formatted .csv file, and selecting the correct separator."),
# h4("A correctly formatted data set will denote the sets in binary. (e.g. The movie genres in the table below.)"),
# h5(br()),
# h5("For example, in this data set Toy Story is considered only a comedy, whereas Grumpier Old Men is considered both a comedy and a romance."),
# br(),
# h5("Additional attributes may be present in the data. (e.g. ReleaseDate, AvgRating in the table below.)"),
br(),
# img(src='Data_setup.png', align = "center"),
# h6("Want some data to get a feel for UpSetR?"),
p(
"To see what a correctly formatted data set with a comma (' , ') seperator
looks like download the movies file below."
),
tags$a(href = "movies.csv", "Download the movies data set here!"),
br(),
br(),
width = 12
)
),
fluidRow(
sidebarPanel(
fluidRow(fileInput(
'file1',
label = h5("Upload file"),
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'.csv',
'.tsv'
)
)),
fluidRow(checkboxInput('header', label = 'Header', TRUE)),
fluidRow(radioButtons(
'sep',
label = h6('Separator'),
choices = c(
Comma = ',',
Semicolon = ';',
Tab = '\t'
),
selected = ','
)),
fluidRow(br(),
tags$button(id="confirm1",
type="button",
class="btn action-button btn-large btn-primary",
HTML('<i class="icon-star"></i>Plot!'))
),
width = 12
))))),
tabPanel("Option 2: List",
column(12,
sidebarLayout(
fluidRow(
mainPanel(
tags$h3(HTML("<u>Instructions</u>")),
p(
"The input style of lists is useful when wanting to compare sets by supplying , say
a list of gene IDs or SNPs. To use this format enter a list of elements seperated by a
comma to each input box. These elements can be entered as numbers, letters, IDs, words, etc.
The only limitation to entering the lists is having spaces in the element names. As an
alternative an underscore (' _ ') character can be used to to substitute for the spaces.
To give each set a name, enter the names into the bars where the word 'List' followed by
a number is grayed out."
),
br(),
br(),
p(
"To see how the list format works copy and paste each list of letters into their respective input boxes."
),
br(),
p("List 1: A, B, C, D, E, F, G, H"),
p("List 2: A, B, D, F, I, J, K, L"),
p("List 3: A, H, J, M, N, O, P, Q"),
p("List 4: B, L, O, P, R, S, T, U")
# h3("The set visualization web apps BioVenn and jvenn utilize the input style of lists containing unique elements."),
# h3("This type of input is useful when wanting to compare sets by supplying, say, a list of gene IDs or SNPs"),
# h3("Here is an example of the input. Copy and paste them into the respective lists to see how it works."),
# br(),
# h4("List 1: A, B, C, D, E, F, G, H"),
# h4("List 2: A, B, D, F, I, J, K, L"),
# h4("List 3: A, H, J, M, N, O, P, Q"),
# h4("List 4: B, L, O, P, R, S, T, U"),
# br(),br(),
# h4("Example of jvenn with cancer SNPs:"),
# img(src='jvenn.png', align = "right", width="103%")
,
width = 12
)
),
fluidRow(
sidebarPanel(tags$style(type = "text/css", "textarea {width:100%}"),
fluidRow(
column(6,
tags$textarea(
id = 'name1',
placeholder = "List 1",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list1',
placeholder = '',
rows = 3
),
tags$textarea(
id = 'name2',
placeholder = "List 2",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list2',
placeholder = '',
rows = 3
),
tags$textarea(
id = 'name3',
placeholder = "List 3",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list3',
placeholder = '',
rows = 3
)),
column(6,
tags$textarea(
id = 'name4',
placeholder = "List 4",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list4',
placeholder = '',
rows = 3
),
tags$textarea(
id = 'name5',
placeholder = "List 5",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list5',
placeholder = '',
rows = 3
),
tags$textarea(
id = 'name6',
placeholder = "List 6",
rows = 1
),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = 'list6',
placeholder = '',
rows = 3
)
)),
fluidRow(br(),
tags$button(id="confirm2",
type="button",
class="btn action-button btn-large btn-primary",
HTML('<i class="icon-star"></i>Plot!'))
),
width= 12)
)))),
tabPanel(
"Option 3: Expression",
column(12,
sidebarLayout(
mainPanel(
tags$h3(HTML("<u>Instructions</u>")),
p(
"The expression input style allows the user to name each intersection and assign
a size to it. When including an intersection of degree 2 or more, the names of the sets
that make up the intersections are seperated by an ampersand (' & '). The names of the sets
can be any string. The only limitations of the set names is that they cant contain any spaces.
As an alternative an underscore (' _ ') character can be used to to substitute for the spaces."
),
br(),
br(),
p(
"Here is an example of an expression input. Copy and paste it into the input box to see how it works."
),
br(),
p("A=12, B=12, C=5, A&B=4, A&C=2, B&C=1, A&B&C=2")
# h3("One of the most popular set visualization R packages is the venneuler package."),
# h3("For this reason we have allowed the same input style for UpSetR."),
# h3("Here is an example of the input. Copy and paste it above to see how it works."),
# br(),
# h4("A=12, B=12, C=5, A&B=4, A&C=2, B&C=1, A&B&C=2"),
# br(),br(),
# h5("** Restriction: No spaces allowed in the names. _ is acceptable.")
,
width = 12
),
sidebarPanel(
fluidRow(
h5("expression input"),
tags$style(type = "text/css", "textarea {width:100%}"),
tags$textarea(
id = "venn",
placeholder = '',
rows = 10
)
),
fluidRow(br(), tags$button(id="confirm3",
type="button",
class="btn action-button btn-large btn-primary",
HTML('<i class="icon-star"></i>Plot!'))),
width = 12)
)
)
)
)
))
),
tabPanel(value="upset_plot",
p("UpSet Plot", style = "padding-bottom: -0.5cm"),
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel('Settings',
fluidRow(htmlOutput("sets")),
fluidRow(
checkboxInput('setorder', label = "Order sets as above", value = FALSE)
),
fluidRow(
numericInput(
"nintersections",
label = h6("Limit number of intersections shown to :"),
value = 40,
min = 1,
max = 60
)
),
fluidRow(
selectInput(
"order",
label = h6("Order by"),
choices = list("Degree" = "degree",
"Frequency" = "freq"),
selected = "freq"
)
),
fluidRow(selectInput(
"decreasing",
h6("Increasing/Decreasing"),
choices = list("Increasing" = "inc",
"Decreasing" = "dec"),
selected = "dec"
)),
fluidRow(
sliderInput(
"mbratio",
label = h6("Bar : Matrix ratio"),
value = 0.30,
min = 0.20,
max = 0.80,
ticks = FALSE,
step = 0.01
)
),
fluidRow(
sliderInput(
"angle",
h6("Number angles"),
min = -90,
max = 90,
value = 0,
step = 1,
ticks = F
)
),
fluidRow(
checkboxInput('empty', label = "Show empty intersections", value = FALSE)
),
fluidRow(numericInput(
"pointsize",
label = h6("Point Size"),
value = 4,
min = 1,
max = 15
)),
fluidRow(
radioButtons(
inputId = "filetype",
label = "File type",
choices = list("png", "svg", "pdf")
)
),
fluidRow(downloadButton(outputId = "down", label = "Download!"))
,
width = 2
),
tabPanel('Advanced',
fluidRow(numericInput(
"intersection_title_scale",
label = h6("Intersection Size Label Text Scale"),
value = 1.2,
min = 1,
max = 1000
)),
fluidRow(numericInput(
"set_title_scale",
label = h6("Set Size Label Text Scale"),
value = 1.2,
min = 1,
max = 1000
)),
fluidRow(numericInput(
"intersection_ticks_scale",
label = h6("Intersection Size Ticks Text Scale"),
value = 1.2,
min = 1,
max = 1000
)),
fluidRow(numericInput(
"set_ticks_scale",
label = h6("Set Size Ticks Text Scale"),
value = 1.2,
min = 1,
max = 1000
)),
fluidRow(numericInput(
"intersection_size_numbers_scale",
label = h6("Intersection Size Numbers Text Scale"),
value = 1.2,
min = 1,
max = 1000
)),
fluidRow(numericInput(
"names_scale",
label = h6("Set Names Text Size"),
value = 1.2,
min = 1,
max = 1000
)))
), width=3),
mainPanel(htmlOutput('plot_text'),
imageOutput('plot')
, width = 9)
)
),
tags$head(tags$style('
nav .container:first-child {
margin-left:50px; width: 100%;
}'))
))