-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.R
275 lines (260 loc) · 20.4 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
library(shiny)
library(shinyjs)
library(shinyBS)
library(shinycssloaders)
library(shinyWidgets)
library(shinythemes)
library(DT)
library(rhandsontable)
library(colourpicker)
# library(shinybusy)
library(shinydashboard)
# source("https://gist.githubusercontent.com/mtandon09/4a870bf4addbe46e784059bce0e5d8d6/raw/dc2927aa3e6a09b34a39f8346b5ebcfd41ce2a6d/install_R_dependencies.R")
# source("~/Documents/helper_functions/helper_functions.oncoplot.R")
# source("https://raw.githubusercontent.com/mtandon09/mt_helpers/main/helper_functions.oncoplot.R")
# source("helper_functions.tcga.R")
source("helper_functions.shiny.R")
shinyUI(
dashboardPage(skin = "black",
dashboardHeader(title = "MafWiz",titleWidth=100),
dashboardSidebar(
sidebarMenu(
# Setting id makes input$tabs give the tabName of currently-selected tab
id = "tab_menu",
menuItem("Get Data", icon=icon("cloud-download-alt"), tabName = "get-data", selected=T),
menuItem("Pick Clinical Variables", tabName = "get-clinical-variables", icon = icon("search")),
menuItem("Visualizations", icon = icon("sliders-h"), tabName = "visualizations"),
menuItem("Table Output", icon = icon("table"), tabName = "table-output")
)
),
dashboardBody(
tabItems(
# tabPanel("Upload and Filter",
tabItem(tabName="get-data",
useShinyjs(),
h1("Select a MAF file"),
# tags$hr(),
fluidRow(
column(6, #offset = 1,
h4("Use TCGA data"),
selectizeInput("tcga_dataset", "TCGA Dataset",
multiple = T, selected = TCGA_project_choices[1],
choices=TCGA_project_choices),
# tags$style(type='text/css', ".selectize-input { font-size: 12px; line-height: 20px;}"),
selectInput("tcga_pipeline", "Variant Calling Pipeline",
choices=TCGA_pipeline_choices, selected="mutect2",
selectize = F),
actionButton("get_tcga_data","Download", icon=icon("cloud-download-alt")),
),
column(4,
h4("Use your own data"),
actionLink("clear_maf_file", "Reset",
style="color: #cccccc; font-size: 10spx;"),
fileInput("maf_file_upload", "Upload MAF file",
multiple = FALSE,
accept = c("text",".maf",".txt")),
actionLink("load_example_data", "Use example data (TCGA-CHOL)",
style="color: #0000ff; font-size: 12spx;"),
)
),
tags$br(),
h3("Add Sample Information"),
# h3(actionBttn("pick_clin_vars", label="Add Sample Information", style="unite")),
# disabled(
fluidRow(
column(6, #offset = 1,
h4("Get TCGA clinical data"),
actionButton("get_tcga_clinical_data","Download", icon=icon("cloud-download-alt")),
),
column(4,
h4("Use your own data"),
actionLink("clear_clinical_data_file", "Reset",
style="color: #cccccc; font-size: 10spx;"),
fileInput("sample_file_upload", "Choose Tab-separated text or Excel file",
multiple = FALSE,
accept = c("text",".txt",".xlsx",".xls",".csv")),
actionLink("load_example_clinical_data", "Use example data (TCGA-CHOL)",
style="color: #0000ff; font-size: 12spx;"),
)
),
tags$br(),
tags$hr(),
h3("Apply filters"),
checkboxInput("exclude_flags", "Exclude known frequently mutated genes (FLAGs)?", TRUE),
actionLink("flags_info","More info on FLAGs genes"),
bsModal("flags_info_popup","FLAGs filter","flags_info",
# hr(),
includeMarkdown("html_content/flags.md"),
size="large"),
actionButton("run_apply_filters","Apply Filters"),
tags$hr(),
# actionButton("pick_clin_vars","Pick Clinical Variables"),
tags$hr()
# )
),
tabItem(tabName="get-clinical-variables",
h1("Sample Information Table"),
h2(actionBttn("go_to_vis_tab","Go to Visualizations", style="stretch",color="primary",size="sm",icon=icon("chart-bar"))),
tags$hr(),
fluidRow(
column(3, #offset = 1,
h4("Find clinical variable"),
# actionButton("add_curr_var_data","Add to sample table"),
actionBttn("load_preset_clinical_colors","Load default TCGA variables", icon=icon("plus-square"), style="fill", size="md", color="success"),
tags$hr(),
selectInput("select_curr_clin_var", "Column Name",
choices=c(), selected=NULL,
selectize = T),
p("Try searching for age, gender, stage, etc."),
actionBttn("add_curr_var_data","Add to sample table", icon=icon("plus-square"), style="fill", size="sm"),
tags$hr(),
DTOutput("curr_clin_var_table", height = "300px")
),
column(8,
h4("Variables for analysis"),
actionLink("clear_clinical_data", "Reset",
style="color: #cccccc; font-size: 10spx;"),
tags$style(HTML('table.dataTable tr:nth-child(even) {background-color: #deebff !important;}')),
tags$style(HTML('table.dataTable tr:nth-child(odd) {background-color: #fafcff !important;}')),
tags$style(HTML('table.dataTable th {background-color: white !important;}')),
# dataTableOutput("clin_dat_header_table"),
# dataTableOutput("maf_clin_dat_table")
rHandsontableOutput("maf_clin_dat_table", height = "400px")
)
),
tags$hr(),
h2("Annotation Legend"),
actionBttn("pick_anno_colors","Pick Colors", icon=icon("palette"), style="jelly", color="default"),
bsModal("anno_color_picker","Pick Annotation Colors","pick_anno_colors",size="large",
selectInput("color_var_picker","Select Variable", choices = c()),
selectInput("color_var_type_picker","Variable Type", choices = c("Category","Numeric")),
textOutput("test_txtout"),
conditionalPanel(
condition = "input.color_var_type_picker == 'Numeric'",
fixedRow(column(1,colourInput("curr_min_color", "Min", "white",showColour="text")),
column(1,colourInput("curr_max_color", "Max", "Black",showColour="text"))),
),
plotOutput("curr_anno_legend",width = "90%", height = "300px")
),
withSpinner(plotOutput("anno_legend_preview", width = "80%", height = "100px"),type=1)
),
tabItem(tabName="visualizations",
h2(actionBttn("go_to_clinical_tab","Add Clinical Data", style="stretch",color="primary",size="sm",icon=icon("search"))),
tabsetPanel(id = "viz_panel", type="tabs",
tabPanel("Mutation Burden",
tags$hr(),
sidebarPanel("", width=3,
radioButtons("burden_plot_type",label = "Type of plot",
choices = c("Barplot", "Dotplot"))
),
mainPanel(
withSpinner(plotOutput("burden_output", width = "90%", height = "600px", click = NULL,
dblclick = NULL, hover = NULL, brush = NULL, inline = FALSE), type=1),
tags$hr(),
downloadButton("download_burdenplot_button",label="Download plot"),
bsModal("download_burdenplot_modal","Download plot","download_burdenplot_button",
radioButtons("burdenplot_save_type","Format",c("pdf","png","tiff","svg"),selected="pdf"),
numericInput("burdenplot_save_width", "Width (in)",value=8, min=2, max=50, step=0.5),
numericInput("burdenplot_save_height", "Height (in)",value=8, min=2, max=50, step=0.5),
downloadButton("download_burdenplot","Download"))
)
),
tabPanel("Oncoplot",
tags$hr(),
# sidebarPanel("Plot Options", width=2),
mainPanel(
tags$hr(),
# withSpinner(plotOutput("oncoplot_output"),type=1),
tabsetPanel(id = "viz_panel", type="tabs",
tabPanel("Plot",
withSpinner(plotOutput("oncoplot_output", width = "800px", height = "600px"),type=1)
),
tabPanel("Options",
# p("Plot Options"),
numericInput("onco_cohort_frac","Plot genes with mutation in fraction of cohort",
value=0.05, min=0, max=1, step=0.01)
)
),
tags$hr(),
downloadButton("download_oncoplot_button",label="Download plot"),
bsModal("download_oncoplot_modal","Download plot","download_oncoplot_button",
radioButtons("oncoplot_save_type","Format",c("pdf"),selected="pdf"),
numericInput("oncoplot_save_width", "Width (in)",value=8, min=2, max=50, step=0.5),
numericInput("oncoplot_save_height", "Height (in)",value=8, min=2, max=50, step=0.5),
downloadButton("download_oncoplot","Download"))
)
),
tabPanel("Mutational Signatures",
sidebarPanel("", width=3,
# selectInput("genome_select",label="Genome Build",choices=c(NULL,"hg19","hg38")),selectize=F,
checkboxInput("use_syn_mut", "Use Synonymous Mutations?", FALSE)
),
mainPanel(
withSpinner(plotOutput("mutsig_output", width = "800px", height = "800px", click = NULL,
dblclick = NULL, hover = NULL, brush = NULL, inline = FALSE), type=1),
tags$hr(),
downloadButton("download_mutsigplot_button",label="Download plot"),
bsModal("download_mutsigplot_modal","Download plot","download_mutsigplot_button",
radioButtons("mutsigplot_save_type","Format",c("pdf"),selected="pdf"),
numericInput("mutsigplot_save_width", "Width (in)",value=8, min=2, max=50, step=0.5),
numericInput("mutsigplot_save_height", "Height (in)",value=8, min=2, max=50, step=0.5),
downloadButton("download_mutsigplot","Download"))
)
),
tabPanel("Co-mutated Genes",
sidebarPanel("", width=3,
# selectInput("genome_select",label="Genome Build",choices=c(NULL,"hg19","hg38")),selectize=F,
checkboxInput("use_syn_mut_genecomut", "Use Synonymous Mutations?", FALSE),
bsCollapse(id = "gene_comut_options", open = NULL,
bsCollapsePanel(title="Choose Genes",
style="info",
actionLink("reset_gene_comut_options", "Reset",
style="color: #cccccc; font-size: 10spx;"),
# Input: Select a file ----
numericInput("gene_comut_topN","Analyze this many top mutated genes", value=25, min=3, max=100, step=1)
),
bsCollapsePanel(title="Plot Options",
style="info",
numericInput("gene_comut_pvalHigh","Minimum p-value of co-occurence for plot", value=0.1, min=0, max=1, step=1),
numericInput("gene_comut_pvalLow","p-value of co-occurence shown with dotted lines", value=0.05, min=0, max=1, step=1),
checkboxInput("gene_comut_customribboncolor", "Use custom ribbon color",value = FALSE),
colourInput("gene_comut_ribbon_color", "Select color for ribbon",value="steelblue",returnName=TRUE)
)
),
actionButton("plot_generibbon","Make plot")
),
mainPanel(
tabsetPanel(id = "generibbon_panel", type="tabs",
tabPanel("Ribbon Plot",
# withSpinner(plotOutput("generibbon_output", width = "90%", height = "600px", click = NULL,
withSpinner(imageOutput("generibbon_output", width = "90%", height = "600px", click = NULL,
dblclick = NULL, hover = NULL, brush = NULL, inline = FALSE), type=1)
),
tabPanel("Interaction Matrix",
# p("Plot Options"),
withSpinner(imageOutput("genematrix_output", width = "90%", height = "600px", click = NULL,
dblclick = NULL, hover = NULL, brush = NULL, inline = FALSE), type=1)
)
),
tags$hr(),
downloadButton("download_generibbon_button",label="Download plot"),
bsModal("download_generibbon_modal","Download plot","download_generibbon_button",
radioButtons("generibbon_save_type","Format",c("pdf"),selected="pdf"),
numericInput("generibbon_save_width", "Width (in)",value=8, min=2, max=50, step=0.5),
numericInput("generibbon_save_height", "Height (in)",value=8, min=2, max=50, step=0.5),
downloadButton("download_generibbon_plot","Download"))
)
)
)
),
tabItem(tabName="table-output",
# p("Nothing here yet")
h1("Variant Table"),
tags$hr(),
# withSpinner(rHandsontableOutput("output_variant_table_rhandson"),type=1)
withSpinner(DTOutput("output_variant_table_DT"),type=1)
)
)
)
)
)