-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathui.R
807 lines (744 loc) · 47.5 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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
# Intervene: is a tool for intersection and visualization of multiple lists and genomic region sets
# Author: Aziz Khan <aziz.khan@ncmm.uio.no>
# Date: January 30, 2017
#UI code for intervene
#====================================================#
## Sidebar content ####
#====================================================#
sidebar <- dashboardSidebar(
width = 150,
sidebarMenu(
menuItem("Dashboard", tabName = "main", icon = icon("dashboard")),
menuItem("Venn", tabName = "venn", icon = icon("venus-mars")),
menuItem("UpSet", tabName = "upset", icon = icon("bar-chart")),
menuItem("Pairwise", tabName = "pairwise", icon = icon("th"))
)
)
#====================================================#
## Dashboard Home ####
#====================================================#
bodyHome <- tabItem(tabName = "main", value="main_panel",
fluidRow(
box(
tags$head(tags$link(rel="shortcut icon", href="favicon.ico")),
tags$script(src = "js/google-analytics.js"),
title = "Welcome to Intervene's Shiny App!", width = 12, status = "primary",
HTML("<b>Intervene Shiny App</b> provides an interactive interface for intersection and effective visualization
of gene or genomic region sets. Currently, Shiny app does not acccept genomic regions as input, but the text files
generated by Interve's <a href='https://bitbucket.org/CBGR/intervene' target='_blank'>command line interface</a> can be
easily uploaded to further explore and customize the plots in an interactive way.
Intervene has three modules: <i>venn</i> to generate Venn diagrams of up-to 6 sets, <i>upset</i> to generate
UpSet plots of more than 3 sets and <i>pairwise</i> to compute and visualize pariwise intersections as clustered heatmap.
")
)
),
fluidRow(
box(
title = "Venn module", width = 4, status = "warning",
p("Intervene's venn module provides up-to 6-way classical, Chow-Ruskey and Edwards’ Euler/Venn diagrams to visualize the intersections of genomic regions or lists."),
#p("Using battle option one can generate up-to 9 sets."),
img(src='venn_module.png', align = "center", width="100%")
),
box(
title = "UpSet module", width = 4,status = "warning",
p("Intervene’s UpSet modules can be used to visualize the intersection of multiple genomic region sets using UpSet plots."),
img(src='upset_module.png', align = "center", width="100%")
),
box(
title = "Pairwise module", width = 4,status = "warning",
p("Intervene’s pairwise module provides several styles of heatmaps and clustering approaches to customize the heatmaps."),
img(src='pairwise_module.png', align = "center", width="100%")
)
),
fluidRow(
box(
title = "Citation", width = 12, status = "success",
h4("If you use intervene, please cite this paper:"),
HTML("<h5>Khan A, Mathelier A. <a href='https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1708-7' target='_blank'>Intervene: a tool for intersection and visualization of multiple gene or genomic region sets</a>. BMC Bioinformatics. 2017;18:287. doi: 10.1186/s12859-017-1708-7</h5>")
)
)
)
#====================================================#
## Venn module ####
#====================================================#
bodyVenn <- tabItem(tabName = "venn",
h2("Venn diagrams"),
fluidRow(
box( title = "Data upload & settings", width = 4, status = "warning",
tabBox(
id = "venntab", height = "100%", width = "100%",
tabPanel("Upload",
fileInput(
'file_venn',
label = "Upload file",
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'.csv',
'.tsv'
)
),
checkboxInput('header_venn', label = 'Header', TRUE),
radioButtons(
'sep_venn',
label = 'Separator',
#inline = TRUE,
choices = c(
Comma = ',',
Tab = '\t',
Semicolon = ';'
),
selected = ','
),
br(),
HTML("<hr> <a href='Whyte_et_al_2013_SEs_genes.csv'> <i class='fa fa-download'> </i> List example data</a>")
#textAreaInput('venn_comb', label = "OR enter Venn combinations", rows = 4, placeholder = "Enter combinations of sets to plot"),
#p("For example: A=12, B=12, C=5, A&B=4, A&C=2, B&C=1, A&B&C=2"),
#tags$button(id="confirm_venn",
# type="button",
# class="btn action-button btn-large btn-primary",
# HTML('<i class="icon-star"></i> Plot Venn Diagram'))
),
tabPanel("Settings",
#add content
htmlOutput("venn_sets"),
selectInput(
"venn_type",
label = "Venn type",
choices = list("Classical" = "Classical",
"Chow-Ruskey" = "ChowRuskey",
"Edwards" = "AWFE",
"Squares" = "squares",
"Battle" = "battle"
),
selected = "ChowRuskey"),
checkboxInput('doWeights', label = "Weighted", value = TRUE),
checkboxInput('doEuler', label = "Eular", value = FALSE),
sliderInput(
"venn_lwd",
label = "Border line width",
value = 2.0,
min = 0.0,
max = 10.0,
ticks = TRUE,
step = 0.5),
selectInput('venn_lty', label="Border line type",
choices = list(
"Solid" = 1,
"Dashed" = 2,
"Dotted" = 3,
"Dot dash" = 4,
"Long dash" = 5,
"Two dash" = 6,
"Blank" = 0
),
selected = "1"
),
sliderInput(
"venn_size",
label = "Zoom in/out Venn diagram",
value = 500,
min = 200,
max = 1200,
ticks = FALSE,
step = 10)
#textInput("venn_title", label="Title: ", value="Venn diagram")
),
tabPanel("Font & Color",
selectInput('venn_color_type', label="Select color theme",
choices = list(
Set1 = "Set1",
#YlOrRd = "YlOrRd",
Custom = "custom"
),
selected = "Set1"
),
conditionalPanel(condition = "input.venn_color_type=='custom'",
fluidRow(
column(2,colourInput("set1_color", label = "Set1", value = "#E41A1C")),
column(2, colourInput("set2_color", label = "Set2", value = "#377EB8")),
column(2,colourInput("set3_color", label = "Set3", value = "#4DAF4A")),
column(2, colourInput("set4_color", label = "Set4", value = "#984EA3")),
column(2,colourInput("set5_color", label = "Set5", value = "#FF7F00")),
column(2, colourInput("set6_color", label = "Set6", value = "#FFFF33")))
),
numericInput(
"venn_labelsize",
label = "Label font size",
value = 15,
min = 1,
max = 50),
numericInput(
"venn_cex",
label = "Number font size",
value = 1.5,
min = 0.5,
max = 20)
#colourInput("addgrid_col", "Select grid colour", "#FAF5F5"),
#colourInput("rect_col", "Color for rectangle border(s)", "#17110F"),
#colourInput("tl_col", "Select label colour", "grey23")
)
)
),
box(
status = "warning", width = 8,
tabBox(
# The id lets us use input$tabset1 on the server to find the current tab
id = "tabset1", height = "100%", width = "100%",
tabPanel("Venn diagram",
#htmlOutput('plot_text_p'),
plotOutput("vennPlot", width = "100%", height = "100%"),
box(
width = NULL, status = "warning",
radioButtons(
inputId = "filetype_venn",
label = "Choose file type to download:",
inline = TRUE,
choices = list("PDF", "PNG","SVG","TIFF")),
downloadButton(outputId = "VennDown", label = "Download Plot")
)
),
tabPanel("Usage Instructions",
h4("Instructions for Venn diagram module"),
p("To use this venn module, you can upload a correctly formatted csv/text file, with lists of names.
Each column represents a set, and each row represents an element (names/gene/SNPs)."),
p("Before uploading the file, choose the correct separator, wheather the names in each column are
seperated by a ' , ' choose comma, by a ' ; ' choose semicolon, or by tabs choose tab."),
p("Header names (first row) will be used as set names."),
tags$a(href = "Whyte_et_al_2013_SEs_genes.csv", "Download demo data from Whyte et al. 2013 "),
HTML("<p>Intervene uses the <a href='https://github.com/js229/Vennerable' target='_blank'> Vennerable</a> to generate different Venn diagrams.</p>")
)
)
)
)
)
#====================================================#
## UpSet module ####
#====================================================#
bodyUpSet <- tabItem(tabName = "upset", value="upset_plot",
h2("UpSet plots"),
fluidRow(
box(
status = "warning", width = 4,
tabBox(
# The id lets us use input$tabset1 on the server to find the current tab
id = "upset_plot", height = "100%", width = "100%",
tabPanel("Upload",
radioButtons('upset_input_type',
label ='Input type ',
choices = c(
"List of Genes/SNPs" = 'list',
"Binary data (0 & 1)" = 'binary'
),
selected = 'list'
),
fileInput(
'file1',
label = "Upload file",
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'.csv',
'.tsv'
)
),
checkboxInput('header', label = 'Header', TRUE),
radioButtons('sep',
label ='Separator',
choices = c(
Comma = ',',
Semicolon = ';',
Tab = '\t'
),
selected = ','
),
#actionButton("confirm_upset", "Plot UpSet"),
textAreaInput('upset_comb', label = "OR enter set combinations/expression", rows = 4, placeholder = "Enter combinations of sets to plot"),
p("For example: A=3, B=3, C=2, A&B=1, A&C=2, B&C=1 ,A&B&C=1"),
#actionLink("confirm_upset_demo", "Or load demo data")
HTML("<hr> <a href='Whyte_et_al_2013_SEs_genes.csv'> <i class='fa fa-download'> </i> List example data</a> | "),
HTML("<a href='mutations_glioblastoma_TCGA.csv'> <i class='fa fa-download'> </i> Binary example data</a>")
),
tabPanel("Settings",
#add content
htmlOutput("sets"),
numericInput(
"nintersections",
label = "Number of intersections to show",
value = 30,
min = 1,
max = 60),
selectInput(
"order",
label = "Order intersections by",
choices = list("Degree" = "degree",
"Frequency" = "freq"),
selected = "freq"),
selectInput(
"decreasing",
label = "Increasing/Decreasing",
choices = list("Increasing" = "inc",
"Decreasing" = "dec"),
selected = "dec"),
selectInput(
"scale.intersections",
label = "Scale intersections",
choices = list("Original" = "identity",
"Log10" = "log10",
"Log2" = "log2"),
selected = "identity"),
selectInput(
"scale.sets",
label = "Scale sets",
choices = list("Original" = "identity",
"Log10" = "log10",
"Log2" = "log2"),
selected = "identity"),
sliderInput(
"upset_width",
label = "Plot width",
value = 650,
min = 400,
max = 1200,
ticks = FALSE,
step = 10),
sliderInput(
"upset_height",
label = "Plot height",
value = 400,
min = 300,
max = 1000,
ticks = FALSE,
step = 10),
sliderInput(
"mbratio",
label = "Bar matrix ratio",
value = 0.30,
min = 0.20,
max = 0.80,
ticks = FALSE,
step = 0.01),
checkboxInput('show_numbers', label = "Show numbers on bars", value = TRUE),
sliderInput(
"angle",
label = "Angle of number on the bar",
min = -90,
max = 90,
value = 0,
step = 1,
ticks = F),
checkboxInput('empty', label = "Show empty intersections", value = FALSE),
checkboxInput('keep.order', label = "Keep set order", value = FALSE),
numericInput(
"pointsize",
label = "Connecting point size",
value = 2.5,
min = 1,
max = 10),
numericInput(
"linesize",
label = "Connecting line size",
value = 0.8,
min = 0.5,
max = 10)
),
tabPanel("Font & Colors",
colourInput("mbcolor", "Select main bar colour", "#ea5d4e"),
colourInput("sbcolor", "Select set bar colour", "#317eab"),
numericInput(
"intersection_title_scale",
label = "Font size of intersection size label",
value = 1.8,
min = 0.5,
max = 100),
numericInput(
"set_title_scale",
label = "Set size label font",
value = 1.8,
min = 0.5,
max = 100),
numericInput(
"intersection_ticks_scale",
label = "Intersection size ticks font",
value = 1.2,
min = 0.5,
max = 100),
numericInput(
"set_ticks_scale",
label = "Set Size ticks font",
value = 1.5,
min = 0.5,
max = 100),
numericInput(
"intersection_size_numbers_scale",
label = "Intersection Size Numbers font size",
value = 1.2,
min = 0.5,
max = 100),
numericInput(
"names_scale",
label = "Set Names font size",
value = 1.5,
min = 0.5,
max = 100
)
)
)
),
box(
status = "warning", width = 8, height = "100%",
tabBox(
#title = "First tabBox",
# The id lets us use input$tabset1 on the server to find the current tab
id = "upsetplottab", height = "100%", width = "100%",
tabPanel("UpSet Plot",
htmlOutput('plot_text'),
plotOutput('plot1', width = "100%", height = "100%"),
box(
width = NULL, status = "warning",
radioButtons(
inputId = "filetype",
label = "Choose file type to download:",
inline = TRUE,
choices = list("PDF", "PNG","SVG","TIFF")),
downloadButton(outputId = "UpSetDown", label = "Download Plot")
)
),
tabPanel("Usage Instructions",
h4("Instructions for UpSet plot module"),
p("To use this module you can upload a correctly formatted .csv or text file, encoded in binary."),
p("Before uploading the file, choose the correct separator, wheather the names in each column are
seperated by a ' , ' choose comma, by a ' ; ' choose semicolon, or by tabs choose tab. Header names (first row) will be used as set names."),
p("UpSet module takes three types of inputs."),
h4("List type data:"),
p("List data is a correctly formatted csv/text file, with lists of names.
Each column represents a set, and each row represents an element (names/gene/SNPs). Header names (first row) will be used as set names."),
tags$a(href = "Whyte_et_al_2013_SEs_genes.csv", "Download list of genes data from Whyte et al. 2013 "),
h4("Binary type data:"),
p("In the binary input file each column represents a set, and each row represents an element.
If a names is in the set then it is represented as a 1, else it is represented as a 0."),
HTML("Here is a sample <a href='mutations_glioblastoma_TCGA.csv'> mutations data set</a> from TCGA, which represents mutations for the 100 most mutated genes in a glioblastoma multiforme cohort. This file was downloaded from <a href='https://github.com/hms-dbmi/UpSetR/tree/master/inst/extdata' target='_blank'> here</a>"),
h4("Combination/expression type data:"),
p("Combination/expression type data is the possible combinations of set intersections. User can copy/past the combinations of intersection from the Intervene commnad line interface. For example;"),
p("H3K4me2&H3K4me3=16321,H3K4me2&H3K4me3&H3K27me3=5756,H3K27me3=25174,H3K4me3&H3K27me3=15539,H3K4me3=32964,H3K4me2&H3K27me3=19039,H3K4me2=60299,H3K27ac&H3K4me2&H3K4me3&H3K27me3=7235,H3K27ac&H3K4me2&H3K4me3=17505,H3K27ac&H3K4me2=21347,H3K27ac&H3K4me2&H3K27me3=1698,H3K27ac&H3K4me3=8134,H3K27ac&H3K4me3&H3K27me3=295,H3K27ac&H3K27me3=7605,H3K27ac=42164"),
HTML("<p>Intervene uses the <a href='https://cran.r-project.org/package=UpSetR' target='_blank'> UpSetR</a> R package for visualization.</p>")
)
)
)
)
)
#====================================================#
## Pairwise module ####
#====================================================#
bodyPairwise <- tabItem(tabName = "pairwise",
h2("Pairwise intersection heatmap"),
fluidRow(
box( title = "Data upload & settings", width = 4, status = "warning",
tabBox(
id = "pairwisetab", height = "100%", width = "100%",
tabPanel("Upload",
radioButtons('pairwise_input_type',
label ='Input type ',
choices = c(
"Matrix" = 'matrix',
"List of Genes/SNPs" = 'list'
),
selected = 'matrix'
),
fileInput(
'file_p',
label = "Upload file",
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'.csv',
'.tsv'
)
),
checkboxInput('header_p', label = 'Header', TRUE),
radioButtons(
'sep_p',
label = 'Separator',
choices = c(
Tab = "\t",
Comma = ",",
Semicolon = ";"
),
selected = "\t"
),
br(),
HTML("<hr> <a href='frac_pairwise_matrix_Khan_et_al_2016.txt'> <i class='fa fa-download'> </i> Matrix example data</a> | "),
HTML("<a href='Whyte_et_al_2013_SEs_genes.csv'> <i class='fa fa-download'> </i> List example data</a> | ")
),
tabPanel("Settings",
selectInput(
"plotType", label= "Plot type",
choices = list("Heatmap.2" = "heatmap.2",
"Corrplot" = "corrplot"),
selected = 'heatmap.2'),
selectInput(
"corp_cor",
label = "Correlation Coefficient",
choices = list("Non" = "non",
"Pearson" = "pearson",
"Kendall" = "kendall",
"Spearman" = "spearman"
),
selected = "non"),
conditionalPanel(condition = "input.plotType == 'corrplot'",
selectInput(
"corp_method",
label = "Heatmap method",
choices = list("Color" = "color",
"Pie" = "pie",
"Circle" = "circle",
"Square" = "square",
"Ellipse" = "ellipse",
"Number" = "number",
"Shade" = "shade"
),
selected = "color"),
selectInput(
"corp_type",
label = "Heatmap type",
choices = list("Full" = "full",
"Lower" = "lower",
"Upper" = "upper"
),
selected = "full"),
selectInput(
"corp_order",
label = "Heatmap order",
choices = list("Hierarchical clustering" = "hclust",
"Eigenvectors" = "AOE",
"Principal component" = "FPC",
#"Alphabetical order" = "alphabet",
"Original" = "original"
),
selected = "hclust"),
selectInput(
"tl_pos",
label = "Position of text labels",
choices = list("Left and top" = "lt",
#"Left and diagonal" = "ld",
#"Top and diagonal" = "td",
"Diagonal" = "d",
"Do not show" = "n"
),
selected = "lt"),
selectInput(
"cl.pos",
label = "Position of colorlabel",
choices = list("Right" = "r",
"Bottom" = "b",
"Don't show" = "n"
),
selected = "r"),
checkboxInput('corp_diag', label = "Show diagonal", value = FALSE)
),
selectInput(
"hclust_method",
label = "Agglomeration method for hclust",
choices = list(
"ward.D" = "ward.D",
"ward.D2" = "ward.D2",
"Single" = "single",
"Complete" = "complete",
"Average" = "average",
"Mcquitty" = "mcquitty",
"Median" = "median",
"Centroid" = "centroid"
),
selected = "complete"),
numericInput(
"addrect",
label = "No. of clusters for hclust",
value = 3,
min = 1,
max = 25
),
conditionalPanel(condition = "input.plotType == 'heatmap.2'",
selectInput(
"distance",
label = "Distance Matrix Computation",
choices = list(
"None" = "none",
"Euclidean" = "euclidean",
"Manhattan" = "manhattan",
"Canberra" = "canberra",
"Minkowski" = "minkowski"
),
selected = "euclidean"),
selectInput(
"dendrogram",
label = "Dendrogram",
choices = list(
"Both" = "both",
"Row" = "row",
"Column" = "column",
"None" = "none"
),
selected = "both"),
checkboxInput('symm', label = "X is a symmetric matrix", value = FALSE),
checkboxInput('key', label = "Show/hide color-key", value = TRUE),
conditionalPanel(condition = "input.key == true",
sliderInput("keysize",
label = h5("Size of the key"),
value = 1.2,
min = 1,
max = 10,
ticks = TRUE,
step = 0.1),
textInput("key.title", "Key title: ", value="Color key"),
textInput("key.xlab", "Key x-axis label: ", value="Value"),
textInput("key.ylab", "Key y-axis label: ", value="Count")
)
),
textInput("corp_title", "Title: ", value="Pairwise intersection"),
sliderInput(
"heatmap_size",
label = h5("Zoom in & out Heatmap"),
value = 500,
min = 200,
max = 1200,
ticks = FALSE,
step = 10)
),
tabPanel("Font & Color",
selectInput('color_type', label="Select theme",
choices = list(
RdYlBu = "RdYlBu",
YlOrRd = "YlOrRd",
Custom = "custom"
),
selected = "RdYlBu"
),
conditionalPanel(condition = "input.color_type=='custom'",
fluidRow(
column(4,colourInput("lower_colour", label = "Lower", value = "#6a011f")),
column(4, colourInput("middle_colour", label = "Middle", value = "#FFFFFF")),
column(4, colourInput("higher_colour", label = "Higher", value = "#08376a")))
),
numericInput(
"tl.cex",
label = "Size of text label",
value = 0.8,
min = 0.3,
step = 0.1,
max = 50
),
numericInput(
"tl.srt",
label = "Text label rotation in degrees",
value = 90,
min = 0,
step = 5,
max = 180
),
numericInput(
"cl.cex",
label = "Size of colorlabel text",
value = 0.8,
min = 0.3,
step = 0.1,
max = 10
),
colourInput("addgrid_col", "Select grid colour", "#FAF5F5"),
colourInput("rect_col", "Color for rectangle border(s)", "#17110F"),
colourInput("tl_col", "Select label colour", "grey23")
)
)
),
box(
status = "warning", width = 8,
tabBox(
#title = "First tabBox",
# The id lets us use input$tabset1 on the server to find the current tab
id = "tabset1", height = "100%", width = "100%",
tabPanel("Heatmap",
htmlOutput('plot_text_p'),
conditionalPanel(condition = "input.plotType == 'corrplot'",
plotOutput("corrplotHM", width = "100%", height = "100%")
),
conditionalPanel(condition = "input.plotType == 'heatmap.2'",
plotOutput("heatmap2_plot_out", width = "100%", height = "100%")
),
box(
width = NULL, status = "warning",
radioButtons(
inputId = "filetype_heatmap",
label = "Choose file type to download:",
inline = TRUE,
choices = list("PDF", "PNG","SVG","TIFF")),
conditionalPanel(condition = "input.plotType == 'heatmap.2'",
downloadButton(outputId = "Heatmap2PlotDown", label = "Download Plot"),
br()
),
conditionalPanel(condition = "input.plotType == 'corrplot'",
downloadButton(outputId = "HeatmapDown", label = "Download Plot"),
br()
)
)
),
tabPanel("Interactive heatmap",
conditionalPanel(condition = "input.plotType == 'heatmap.2'",
d3heatmapOutput("d3HM"),
br(),
downloadButton(outputId = "HeatmapHTMLDown", label = "Download HTML")
),
conditionalPanel(condition = "input.plotType == 'corrplot'",
h4("Note: Interactive heatmap is only available for Heatmap.2 plot type.")
)
),
tabPanel("Data table",
div(style = 'overflow-x: scroll', DT::dataTableOutput("pairwiseTable", width = "100%")),
br(),
downloadButton(outputId = "HeatmapCSVDown", label = "Download CSV")
),
tabPanel("Usage Instructions",
h4("Instructions for pairwise heatmap module"),
p("To use pairwise module, you can upload a pairwise matrix file in .csv/txt format.
Each column and row represents pairwise fraction of overlap/count etc between different names/genomic region sets."),
p("Before uploading the file, choose the correct separator, wheather the matrix file is
seperated by a ' , ' choose comma, by a ' ; ' choose semicolon, or by tabs choose tab."),
p("Pairwise module takes input of two types:"),
h4("List type data:"),
p("List data is a correctly formatted csv/text file, with lists of names.
Each column represents a set, and each row represents an element (names/gene/SNPs). Header names (first row) will be used as set names."),
tags$a(href = "Whyte_et_al_2013_SEs_genes.csv", "Download list of genes data from Whyte et al. 2013 "),
h4("Pairwise matrix data:"),
p("A pairwise matrix type data is a matrix of size NxN (all pairwise combinations) with values as number/fraction of overlap between two corresponding sets.
For genomic region sets user can use the commpnad line interface of Intervene and upload the generated matrix here as matrix type."),
HTML("For example here is the <a href = 'frac_pairwise_matrix_Khan_et_al_2016.txt'> demo data </a> generated by Intervene's command line interfacce for super-enhancers(SEs) of different cell/tissue-types from dbSUPER."),
HTML("<p>Intervene uses the <a href='https://cran.r-project.org/package=corrplot' target='_blank'> Corrplot</a> and <a href='https://cran.r-project.org/package=plotly' target='_blank'> plotly</a> R packages to plot heatmap</p>")
)
)
)
)
)
## Body content ####
shinyUI(dashboardPage(
title="Intervene - an interactive Shiny app for UpSet plots, Venn diagrams and Pairwise heatmaps",
#tags$header(tags$script(src = "js/google-analytics.js")),
skin = "black",
dashboardHeader(
# Set height of dashboardHeader
title = tags$a(href='https://asntech.shinyapps.io/intervene/',
tags$img(src='intervene_logo.png', height = "90%")),
titleWidth = 150),
sidebar,
dashboardBody(
tabItems(
bodyHome,
#Venn plots
bodyVenn,
#UpSet Plots
bodyUpSet,
#Pairwise heatmap
bodyPairwise
)
)
))