Add chromosomal positions plot

This commit is contained in:
Elias Projahn 2022-05-17 21:58:40 +02:00
parent 40164ebf84
commit 6a5e5ed9c6
3 changed files with 131 additions and 83 deletions

View file

@ -21,6 +21,7 @@ Imports:
geposan, geposan,
gprofiler2, gprofiler2,
plotly, plotly,
purrr,
rlang, rlang,
rclipboard, rclipboard,
shiny, shiny,

View file

@ -119,6 +119,13 @@ server <- function(input, output, session) {
geposan::plot_boxplot(ranking(), gene_sets) geposan::plot_boxplot(ranking(), gene_sets)
}) })
output$positions_plot <- plotly::renderPlotly(
geposan::plot_scores_by_position(
ranking(),
input$positions_plot_chromosome_name
)
)
gost <- reactive({ gost <- reactive({
withProgress( withProgress(
message = "Querying g:Profiler", message = "Querying g:Profiler",

44
R/ui.R
View file

@ -1,4 +1,7 @@
ui <- div( #' Generate the main UI for the application.
#' @noRd
ui <- function() {
div(
shinyjs::useShinyjs(), shinyjs::useShinyjs(),
rclipboard::rclipboardSetup(), rclipboard::rclipboardSetup(),
navbarPage( navbarPage(
@ -59,6 +62,22 @@ ui <- div(
) )
) )
), ),
tabPanel(
title = "Scores by position",
div(
style = "margin-top: 16px",
selectInput(
"positions_plot_chromosome_name",
label = NULL,
choices = chromosome_choices()
),
plotly::plotlyOutput(
"positions_plot",
width = "100%",
height = "600px"
)
)
),
tabPanel( tabPanel(
title = "Detailed results", title = "Detailed results",
results_ui("results") results_ui("results")
@ -89,4 +108,25 @@ ui <- div(
title = "Publication" title = "Publication"
) )
) )
) )
}
#' Generate a named list for choosing chromosomes.
#' @noRd
chromosome_choices <- function() {
choices <- purrr::lmap(
unique(geposan::genes$chromosome),
function(name) {
choice <- list(name)
names(choice) <- paste0(
"Chromosome ",
name
)
choice
}
)
choices[order(suppressWarnings(sapply(choices, as.integer)))]
}