mirror of
https://github.com/johrpan/ubigen.git
synced 2025-10-26 19:57:24 +01:00
Move ranking table and support selection
This commit is contained in:
parent
268bfd6415
commit
c9b26cc823
2 changed files with 24 additions and 13 deletions
17
R/server.R
17
R/server.R
|
|
@ -22,7 +22,18 @@ server <- function(input, output) {
|
||||||
})
|
})
|
||||||
|
|
||||||
output$scores_plot <- plotly::renderPlotly(scores_plot(ranked_data()))
|
output$scores_plot <- plotly::renderPlotly(scores_plot(ranked_data()))
|
||||||
output$ranked_data <- DT::renderDataTable(genes_table(ranked_data()))
|
|
||||||
|
output$selected_genes <- DT::renderDataTable({
|
||||||
|
selected_points <- plotly::event_data("plotly_selected")
|
||||||
|
|
||||||
|
data <- if (is.null(selected_points)) {
|
||||||
|
ranked_data()
|
||||||
|
} else {
|
||||||
|
ranked_data()[rank %in% selected_points$x]
|
||||||
|
}
|
||||||
|
|
||||||
|
genes_table(data)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#' Create plot showing the distribution of scores using `plotly`.
|
#' Create plot showing the distribution of scores using `plotly`.
|
||||||
|
|
@ -63,7 +74,9 @@ scores_plot <- function(ranked_data, ranks = 1000) {
|
||||||
) |>
|
) |>
|
||||||
plotly::layout(
|
plotly::layout(
|
||||||
xaxis = list(title = ranks_label),
|
xaxis = list(title = ranks_label),
|
||||||
yaxis = list(title = "Score")
|
yaxis = list(title = "Score"),
|
||||||
|
clickmode = "event+select",
|
||||||
|
dragmode = "select"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
20
R/ui.R
20
R/ui.R
|
|
@ -41,17 +41,15 @@ ui <- function() {
|
||||||
),
|
),
|
||||||
mainPanel(
|
mainPanel(
|
||||||
width = 9,
|
width = 9,
|
||||||
tabsetPanel(
|
h3("Distribution of scores"),
|
||||||
type = "pills",
|
div(paste0(
|
||||||
tabPanel(
|
"Note: Click or drag within the figure to select ",
|
||||||
title = "Distribution of scores",
|
"genes of interest."
|
||||||
plotly::plotlyOutput("scores_plot")
|
)),
|
||||||
),
|
plotly::plotlyOutput("scores_plot"),
|
||||||
tabPanel(
|
h3("Detailed ranking"),
|
||||||
title = "Detailed results",
|
div(class = "p-1"),
|
||||||
DT::dataTableOutput("ranked_data")
|
DT::dataTableOutput("selected_genes")
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue