ubigen/R/ui.R

295 lines
10 KiB
R
Raw Normal View History

2022-05-07 17:54:23 +02:00
#' Function for creating the main user interface.
#' @noRd
2022-12-02 15:16:37 +01:00
ui <- function(custom_dataset = NULL) {
2022-06-22 13:57:20 +02:00
div(
custom_css(),
2022-08-22 16:22:17 +02:00
rclipboard::rclipboardSetup(),
2022-06-22 13:57:20 +02:00
navbarPage(
theme = bslib::bs_theme(
version = 5,
bootswatch = "united",
primary = "#7d19bf"
),
title = "Ubigen",
tabPanel(
"Explore",
sidebarLayout(
sidebarPanel(
width = 3,
2022-12-16 11:44:32 +01:00
h5("Your genes"),
2022-06-22 13:57:20 +02:00
gene_selector_ui("custom_genes"),
2022-12-16 11:44:32 +01:00
h5("Method"),
2022-12-01 21:23:46 +01:00
selectInput(
"dataset",
label = strong("Expression dataset"),
2022-12-02 15:16:37 +01:00
{
choices <- list(
"GTEx (across tissues and conditions)" = "gtex_all",
"GTEx (across tissues)" = "gtex_tissues",
2024-03-14 19:40:25 +01:00
"Human Protein Atlas (across tissues)" = "hpa_tissues",
"CMap" = "cmap"
2022-12-02 15:16:37 +01:00
)
if (!is.null(custom_dataset)) {
c(list("Custom dataset" = "custom"), choices)
} else {
choices
}
}
2022-12-01 21:23:46 +01:00
),
2022-06-22 13:57:20 +02:00
selectInput(
"cross_sample_metric",
verticalLayout(
strong("Expression across samples"),
paste0(
"Proportion samples in which the gene is expressed above ",
"the selected threshold. Select a method and a weight for ",
"the final score."
)
),
list(
"Above 95th percentile" = "above_95",
"Above median" = "above_median",
"Above zero" = "above_zero"
2022-05-30 21:59:40 +02:00
)
2022-05-30 19:32:19 +02:00
),
2022-06-22 13:57:20 +02:00
sliderInput(
"cross_sample_weight",
label = NULL,
min = -1.0,
max = 1.0,
step = 0.01,
value = 0.5
2022-06-06 15:56:34 +02:00
),
2022-09-25 20:01:42 +02:00
selectInput(
"level_metric",
2022-06-22 13:57:20 +02:00
verticalLayout(
2022-09-25 20:01:42 +02:00
strong("Expression level"),
"Typical expression level of the gene across all samples."
2022-06-22 13:57:20 +02:00
),
2022-09-25 20:01:42 +02:00
list(
"Median expression" = "median_expression_normalized",
"Mean expression" = "mean_expression_normalized"
)
),
sliderInput(
"level_weight",
label = NULL,
2022-06-22 13:57:20 +02:00
min = -1.0,
max = 1.0,
step = 0.01,
value = 0.25
2022-06-02 10:17:49 +02:00
),
2022-09-25 20:01:42 +02:00
selectInput(
"variation_metric",
2022-06-22 13:57:20 +02:00
verticalLayout(
2022-09-25 20:01:42 +02:00
strong("Expression variation"),
2022-06-22 13:57:20 +02:00
paste0(
2022-09-25 20:01:42 +02:00
"Measure of the variation of the gene's expression between ",
2022-06-22 13:57:20 +02:00
"samples."
)
),
2022-09-25 20:01:42 +02:00
list(
"Quantile based coefficient of variation" =
"qcv_expression_normalized",
"Interquartile range" = "iqr_expression_normalized",
"Coefficient of variation" = "cv_expression_normalized",
"Standard deviation" = "sd_expression_normalized"
)
),
sliderInput(
"variation_weight",
label = NULL,
2022-06-22 13:57:20 +02:00
min = -1.0,
max = 1.0,
step = 0.01,
value = -0.25
)
),
mainPanel(
width = 9,
plotly::plotlyOutput("overview_plot", height = "200px"),
tabsetPanel(
id = "results_panel",
selected = "top_genes",
header = div(class = "p-2"),
tabPanel(
"Your genes",
value = "custom_genes",
htmlOutput("custom_genes_synopsis"),
plotly::plotlyOutput("custom_genes_boxplot"),
div(class = "p-1"),
2022-08-22 16:22:17 +02:00
genes_table_ui("custom_genes")
2022-06-22 13:57:20 +02:00
),
tabPanel(
"Top genes",
value = "top_genes",
div(paste0(
"Hover over the markers to see details on each gene. Click ",
2024-04-26 20:52:56 +02:00
"or drag within the figure to select genes of interest. ",
"Double-click removes the selection."
2022-06-22 13:57:20 +02:00
)),
plotly::plotlyOutput("scores_plot"),
2022-08-22 16:22:17 +02:00
div(class = "p-1"),
2022-06-22 13:57:20 +02:00
div(paste0(
"Click on gene names to view them using the GTEx website. ",
"There, you can see the tissue specific expression behavior ",
"derived from the samples that this analysis is also based ",
"on."
)),
div(class = "p-1"),
2024-04-26 20:52:56 +02:00
genes_table_ui("selected_top_genes")
),
tabPanel(
"Compare rankings",
value = "rankings",
div(
class = "flow-layout",
selectInput(
"ranking_y",
label = NULL,
list(
"Custom" = "custom",
"GTEx (across tissues and conditions)" = "gtex_all",
"GTEx (across tissues)" = "gtex_tissues",
"Human Protein Atlas (across tissues)" = "hpa_tissues",
"CMap" = "cmap"
),
selected = "cmap"
),
span(
style = paste0(
"display: inline-block;",
"margin-right: 12px;",
"padding: 0.375rem 0.75rem;"
),
"~"
),
selectInput(
"ranking_x",
label = NULL,
list(
"Custom" = "custom",
"GTEx (across tissues and conditions)" = "gtex_all",
"GTEx (across tissues)" = "gtex_tissues",
"Human Protein Atlas (across tissues)" = "hpa_tissues",
"CMap" = "cmap"
)
),
selectInput(
"rankings_comparison_mode",
label = NULL,
list(
"Compare scores" = "scores",
"Compare percentiles" = "percentiles"
)
)
),
div(class = "p-1"),
div(paste0(
"Hover over the markers to see the HGNC symbols for the ",
"genes. Click or draw within the figure to select genes of ",
"interest. Double-click removes the selection."
)),
div(class = "p-1"),
plotly::plotlyOutput(
"rankings_plot",
width = "800px",
height = "800px"
),
div(class = "p-1"),
genes_table_ui("selected_comparison_genes")
2022-06-22 13:57:20 +02:00
),
tabPanel(
"GSEA",
value = "gsea",
div(
class = "flow-layout",
selectInput(
"gsea_set",
2022-06-02 10:17:49 +02:00
label = NULL,
2022-06-22 13:57:20 +02:00
list(
"Top genes" = "top",
"Selected genes" = "selected",
"Your genes" = "custom"
)
),
conditionalPanel(
"input.gsea_set == 'top'",
sliderInput(
"gsea_ranks",
label = NULL,
min = 10,
max = 1000,
value = 100,
step = 10,
ticks = FALSE
)
),
actionButton(
"gsea_run",
"Update analysis",
class = "btn-primary"
2022-07-22 08:51:05 +02:00
),
a(
"Powered by g:Profiler",
href = "https://biit.cs.ut.ee/gprofiler/gost",
target = "_blank",
style = "margin-left: 16px"
2022-06-02 10:17:49 +02:00
)
),
2022-06-22 13:57:20 +02:00
plotly::plotlyOutput("gsea_plot"),
div(class = "p-2"),
DT::dataTableOutput("gsea_details")
)
2022-05-30 21:59:40 +02:00
)
2022-06-02 09:14:34 +02:00
)
2022-05-07 17:54:23 +02:00
)
2022-06-22 13:57:20 +02:00
),
tabPanel(
2022-06-22 19:34:39 +02:00
title = "Additional information",
div(
class = "container",
h2("Number of interesting genes along the ranking"),
p(HTML(paste0(
"The notion of ubiquitous genes or housekeeping genes implies ",
"some kind of enrichment of important genes. Within groups of ",
"genes with certain biological associations, these genes should ",
"be overrepresented. We use GeneOntology terms as well as some ",
"other gene set sources to represent this concept. The following ",
"plot shows the number of associated terms for a non-overlapping ",
"sliding window of 500 genes along the ranking of ubiquity using ",
"our default parameters. The terms have been obtained using a ",
"gene set enrichment analysis with the tool ",
"<a href=\"https://biit.cs.ut.ee/gprofiler/gost\" ",
"target=\"_blank\">g:Profiler</a>. We observe that the most ",
"ubiquitous genes have many more known biological implications ",
"than any other bucket of genes. The genes of average ubiquity ",
"have almost no associations with GeneOntology terms. The number ",
"of associations rises again for the least ubiquitous genes."
))),
p(HTML(paste0(
"Note: Click on the legend items to toggle single sources. A ",
"double-click will isolate a single source of interest."
))),
plotly::plotlyOutput("gsea_plot_ranking", height = "600px")
)
2022-12-11 21:03:41 +01:00
),
2022-12-16 14:10:08 +01:00
tabPanel(
title = "Help",
div(
class = "container",
includeMarkdown(system.file("content", "help.md", package = "ubigen"))
)
),
2022-12-11 21:03:41 +01:00
tabPanel(
title = "API access",
div(
class = "container",
includeMarkdown(system.file("content", "api.md", package = "ubigen"))
)
2022-05-30 19:32:19 +02:00
)
2022-05-07 17:54:23 +02:00
)
2022-05-30 19:32:19 +02:00
)
2022-05-07 17:54:23 +02:00
}