forked from theodos/biotextquest_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
261 lines (242 loc) · 13.8 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
# Define UI
ui <- tagList(
useShinyjs(debug=TRUE),
navbarPage(
title = "BioTextQuest v2.0",
windowTitle = "Welcome to version 2.0 of BioTestQuest",
theme = shinytheme("flatly"),
id = "navbarPage",
tabPanel(
"Home",
div(column(width=3), column(width = 6, includeHTML("www/description3.html"), align="center"), column(width=3)),
themeelector()
),
#It worked here, might not be the best place to put it however. This gets the data
# for the wordcloud from the server.
#tags$script(src = "wordcloud2.js"),
#tags$script(src = "generateCloud.js"),
#tabPanel Start
tabPanel(
"Start",
# Application title
div(id="myModal",
HTML("
<div class='modal-content'>
<!--<span class='close'>×</span>-->
<div id='myProgress'>
<div id='myBar'></div>
</div>
</div>
")
),
h3("Parameters of the Analysis", style="text-align:center"),
hr(),
fluidRow(
column(3),
column(6,
textInput("query", label = h3("Query"),
placeholder = "Enter your query here...",
width = '100%'),
bsTooltip("query",
title = "The keywords you enter will be used to query PubMed and retrieve relevant documents",
placement = "right", options = list(container = "body")),
tags$p("The query must return more than 25 articles for proper results", style="font-style: italic; color: grey; text-align:center;")
),
column(3)
),
# Row for buttons Run Analysis and Reset
fluidRow(
column(3),
column(6, align = "center",
actionButton("run_analysis", "Run analysis",class = "btn-primary", style="margin-right:12px"),
actionButton("reset_inputs", "Reset inputs", class = "btn-warning", style="margin-right:12px"),
actionButton("toggle_advanced", "Advanced", class="btn-secondary")
),
column(3)
),# Row for buttons Run Analysis and Reset
#Row for Advanced parameters
#shinyjs::hidden(
div(id="advanced",
fluidRow(
column(3),
column(6,
tags$h3("Advanced parameters"),
wellPanel(
tags$p("If you want to use the old version of BioTextQuest please follow the ", a("link", href="http://bioinformatics.med.uoc.gr/biotextquest")),
# radioButtons(inputId = "targetdb", "Use terms from database:",
# choices = c("Extract" = "extract",
# "Pubmed" = "pubmed"
#
# ),
# inline = TRUE
# ), #radioButtons
bsTooltip("targetdb",
title = "Use either terms from the PubMed retrieved or use terms from the Extract database extracted for the retrieved documents",
placement = "right", options = list(container = "body")),
# radioButtons("aspects", "PubMed aspects to use:",
# choices = c("abstracts" = "abstracts",
# "MeSH terms" = "mesh",
# "Both" = "both"),
# inline = TRUE
# ),
# alternative can use bsButton and bsPopover
# bsTooltip("aspects",
# title = "Use words from abstract or only MeSH terms or both",
# placement = "right", options = list(container = "body")),
selectInput("entity_types_parameters", "Choose extract entities:",
multiple = TRUE,
# choices = c("All" = "",
# "PubChem Compound identifiers" = "pubchem",
# "NCBI Taxonomy entries" = "ncbi",
# "Gene Ontology biological process terms" = "go_biological",
# "Gene Ontology cellular component terms" = "go_cellular",
# "Gene Ontology molecular function terms" = "go_molecular",
# "BRENDA Tissue Ontology terms" = "brenda",
# "Disease Ontology terms" = "disease",
# "Environment Ontology terms" = "enviroment")
choices = c("All" = "",
"Genes/Proteins of a specific organism" = "0>",
"PubChem Compound identifiers" = "-1",
"NCBI Taxonomy entries" = "-2",
"Gene Ontology biological process terms" = "-21",
"Gene Ontology cellular component terms" = "-22",
"Gene Ontology molecular function terms" = "-23",
"BRENDA Tissue Ontology terms" = "-25",
"Disease Ontology terms" = "-26",
"Environment Ontology terms" = "-27")
), #selectInput
bsTooltip("entity_types_parameters",
title = "Choose the entity types you want to use from extract",
placement = "right", options = list(container = "body")
),
# checkboxInput("stemming", label = "Remove common word suffixes (Stemming)",
# TRUE),
# bsTooltip("databaseChoice",
# title = "Select which version of PubMed will be used",
# placement = "right", options = list(container = "body")),
# radioButtons("databaseChoice", "Pubmed database:",
# c("Local" = FALSE,
# "Online" = TRUE)
# #"Hierarchical: agglomerative" = "hier_agglo")
# ),
bsTooltip("stemming",
title = "Porter stemming",
placement = "right", options = list(container = "body")
),
selectInput("similarity", "Similarity matrix:",
c("Cosine" = "cosine",
"Jaccard" = "jaccard",
"Euclidean" = "euclidean")
),
bsTooltip("similarity",
title = "Select the metric to use for calculating the distance/similarity between the retrieved documents",
placement = "right", options = list(container = "body")),
selectInput("clustering_algo", "Clustering algorithm:",
c("K-means (>25 articles)" = "kmeans",
"MCL (>120 articles)" = "mcl",
"Louvain (>120 articles)" = "louvain",
"Top2Vec (>120 articles)" = "top2vec")
#"Hierarchical: agglomerative" = "hier_agglo")
),
uiOutput("algo_params"),
bsTooltip("algo_params",
title = "Check the Help tab for details",
placement = "right", options = list(container = "body")),
sliderInput("maxDocs", "Total papers:", value=10000, step = 1000, min = 1000, max=10000),
bsTooltip("maxDocs",
title = "The maximum number of papers that will be analyzed",
placement = "right", options = list(container = "body")),
# numericInput("threshold", "Threshold:", 0.05,
# min = 0, max = 1, step = 0.01),
# bsTooltip("threshold",
# title = "The threshold under which the documntes are considered to have no relation (values: 0...1), e.g. 0.05",
# placement = "right", options = list(container = "body"))
)
),
column(3)
) #fluidrow
) #div
#) # shinyjs::hidden
),# tabPanel Start
tabPanel("Results",
value = "resultTab",
titlePanel("Results of the Analysis"),
tabsetPanel(id="results_tabs", type="tabs",
#tabPanel(id="query_results", title = "First 100 Documents retrieved",
#DT::dataTableOutput("query_results")
#), # tabPanel query_results
tabPanel(id="docs_clusters", title = "Clustered documents",
textOutput("clusterSummary"),
DT::dataTableOutput('summaryTable'),
DT::dataTableOutput("cluster_results")
), #tabPanel clusters
# tabPanel(id="docs_clusters_graph", title = "Graphs of clustered documents",
# DT::dataTableOutput("cluster_results")
# ), #tabPanel clusters
tabPanel(id="terms_clusters",value="wordcloudPanel", title="Wordclouds",
#sidebarPanel(
#selectInput("entity_types_plots", "Choose entities:",
#multiple = TRUE,
#choices = ""
#)#selectInput
#), # sidebarPanel
mainPanel(
div( id='wordcloudPanel',
h3("Wordcloud divided into clusters"),
actionButton("reloadClouds", "Reload Wordclouds", class = "btn-info", style="margin-right:30%"),
div( id='entityCheckboxes',
# Input: Slider for the number of words in each cloud
numericInput(inputId = "totalWords",
label = "Total words in cloud",
min = 10,
max = 500,
value = 50, width = '40%'),
HTML("<input type='button' value='Download wordclouds' id='btnConvert'>"),
HTML("<p id='focusCloud' style='margin-top:5%;'>Wordcloud in focus: Cluster 1</p>"),
h4("Select Entity Types:"),
#actionButton("toggle_entityColor", "Uncheck all", class="btn-secondary"),# TODO: this needs fixing
HTML("
<br>
<input type='checkbox' class='entityColor' id='genesProteins' onclick='selectEntity()' checked>
<label for='genesProteins' style='color:#807689;' onmouseover='func()' onmouseout='func1()'>Genes/Proteins of a specific organism</label><br>
"),
),
plotOutput("tagcloud_plot")#, height = "1000px"),
#div(id='terms_plot'),
#div(
#HTML("<h3 style='padding: 100px;'>Most frequent terms per cluster</h3>"),
#h3("Most frequent terms per cluster"),
#plotOutput("most_freq_terms", height = "900px") #TODO: Maybe on load after wordcloud
#),
) # mainPanel
#DT::dataTableOutput("clusters_of_terms")
), #wordcloud Div
), #tabPanel terms_clusters
tabPanel(id="biomed_terms", title="Biomedical terms",
DT::dataTableOutput("biomed_terms")
),
) #tabsetPanel
), #tabPanel Results
tabPanel("Help",
titlePanel("Help for BioTextQuest ver. 2.0"),
div(includeHTML("www/Help_page/textQuest2.html"))
#includeHTML("www/Help_page/textQuest.html")
)
), # navbarPage
#It worked here, might not be the best place to put it however. This gets the data
# for the wordcloud from the server.
tags$script(src = "wordcloud2.js"),
tags$script(src = "generateCloud2.js"),
tags$script(src = "html2canvas.js"),
tags$script(src = "general3.js"),
tags$script(src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"),
#tags$script(src="generateExtractCloud.js")
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")
),
#tags$style(type="text/css", "body { overflow-y: scroll; }")
) # tagList
# Copyright [2023] [copyright holder]
#
# Licensed under the BSD 3-Clause License.
# See https://opensource.org/license/bsd-3-clause/ for more information.