mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
Update gprofiler integration
This commit is contained in:
parent
ffa90cd667
commit
36546570e0
3 changed files with 53 additions and 25 deletions
|
|
@ -22,7 +22,7 @@ filters_ui <- function(id) {
|
|||
min = 0,
|
||||
max = 100,
|
||||
step = 1,
|
||||
value = 60
|
||||
value = 75
|
||||
)
|
||||
),
|
||||
tabPanelBody(
|
||||
|
|
|
|||
59
R/server.R
59
R/server.R
|
|
@ -172,20 +172,53 @@ server <- function(input, output, session) {
|
|||
geposan::plot_boxplot(ranking(), gene_sets)
|
||||
})
|
||||
|
||||
output$gost <- plotly::renderPlotly({
|
||||
if (input$enable_gost) {
|
||||
result <- gprofiler2::gost(
|
||||
results_filtered()[, gene],
|
||||
ordered_query = TRUE
|
||||
)
|
||||
gost <- reactive({
|
||||
withProgress(
|
||||
message = "Querying g:Profiler",
|
||||
value = 0.0,
|
||||
{ # nolint
|
||||
setProgress(0.2)
|
||||
gprofiler2::gost(results_filtered()[, gene])
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
gprofiler2::gostplot(
|
||||
result,
|
||||
capped = FALSE,
|
||||
interactive = TRUE
|
||||
output$gost_plot <- plotly::renderPlotly({
|
||||
gprofiler2::gostplot(
|
||||
gost(),
|
||||
capped = FALSE,
|
||||
interactive = TRUE
|
||||
)
|
||||
})
|
||||
|
||||
output$gost_details <- DT::renderDT({
|
||||
data <- data.table(gost()$result)
|
||||
setorder(data, p_value)
|
||||
|
||||
data[, total_ratio := term_size / effective_domain_size]
|
||||
data[, query_ratio := intersection_size / query_size]
|
||||
|
||||
dt <- DT::datatable(
|
||||
data[, .(source, term_name, total_ratio, query_ratio, p_value)],
|
||||
rownames = FALSE,
|
||||
colnames = c(
|
||||
"Source",
|
||||
"Term",
|
||||
"Total ratio",
|
||||
"Query ratio",
|
||||
"p-Value"
|
||||
),
|
||||
style = "bootstrap",
|
||||
options = list(
|
||||
pageLength = 25
|
||||
)
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
)
|
||||
|
||||
dt <- DT::formatRound(dt, "p_value", digits = 4)
|
||||
dt <- DT::formatPercentage(
|
||||
dt,
|
||||
c("total_ratio", "query_ratio"),
|
||||
digits = 1
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
17
R/ui.R
17
R/ui.R
|
|
@ -85,18 +85,13 @@ ui <- div(
|
|||
),
|
||||
tabPanel(
|
||||
title = "g:Profiler",
|
||||
checkboxInput(
|
||||
"enable_gost",
|
||||
"Perform a gene set enrichment analysis on the \
|
||||
filtered result genes."
|
||||
div(
|
||||
style = "margin-top: 16px",
|
||||
plotly::plotlyOutput("gost_plot"),
|
||||
),
|
||||
conditionalPanel(
|
||||
"input.enable_gost == true",
|
||||
plotly::plotlyOutput(
|
||||
"gost",
|
||||
width = "100%",
|
||||
height = "600px"
|
||||
)
|
||||
div(
|
||||
style = "margin-top: 16px",
|
||||
DT::DTOutput("gost_details")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue