mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
gsea: Properly show empty results
This commit is contained in:
parent
49d5a3f281
commit
f0a8bce297
1 changed files with 85 additions and 45 deletions
130
R/gsea.R
130
R/gsea.R
|
|
@ -17,13 +17,33 @@ gsea_ui <- function(id) {
|
||||||
style = "margin-left: 16px"
|
style = "margin-left: 16px"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
div(
|
tabsetPanel(
|
||||||
style = "margin-top: 16px",
|
id = NS(id, "results"),
|
||||||
plotly::plotlyOutput(NS(id, "plot")),
|
type = "hidden",
|
||||||
),
|
tabPanelBody(
|
||||||
div(
|
"some",
|
||||||
style = "margin-top: 16px",
|
div(
|
||||||
DT::DTOutput(NS(id, "details"))
|
style = "margin-top: 16px",
|
||||||
|
plotly::plotlyOutput(NS(id, "plot")),
|
||||||
|
),
|
||||||
|
div(
|
||||||
|
style = "margin-top: 16px",
|
||||||
|
DT::DTOutput(NS(id, "details"))
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tabPanelBody(
|
||||||
|
"none",
|
||||||
|
div(
|
||||||
|
style = "margin-top: 32px",
|
||||||
|
h5("No results"),
|
||||||
|
div(
|
||||||
|
"The enrichment analysis using g:Profiler yielded no results. ",
|
||||||
|
"You can change the parameters of the ranking and the filter ",
|
||||||
|
"criteria. Click the \"Update analysis\" button to rerun the ",
|
||||||
|
"analysis."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -55,51 +75,71 @@ gsea_server <- function(id, ranking) {
|
||||||
bindCache(ranking_filtered()) |>
|
bindCache(ranking_filtered()) |>
|
||||||
bindEvent(input$gsea_run, ignoreNULL = FALSE)
|
bindEvent(input$gsea_run, ignoreNULL = FALSE)
|
||||||
|
|
||||||
output$plot <- plotly::renderPlotly({
|
observe({
|
||||||
gprofiler2::gostplot(
|
updateTabsetPanel(
|
||||||
gsea_analysis(),
|
session,
|
||||||
capped = FALSE,
|
"results",
|
||||||
interactive = TRUE
|
selected = if (!is.null(gsea_analysis()$result)) {
|
||||||
|
"some"
|
||||||
|
} else {
|
||||||
|
"none"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
output$plot <- plotly::renderPlotly({
|
||||||
|
if (!is.null(gsea_analysis()$result)) {
|
||||||
|
gprofiler2::gostplot(
|
||||||
|
gsea_analysis(),
|
||||||
|
capped = FALSE,
|
||||||
|
interactive = TRUE
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
plotly::plotly_empty()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
output$details <- DT::renderDT({
|
output$details <- DT::renderDT({
|
||||||
data <- data.table(gsea_analysis()$result)
|
if (!is.null(gsea_analysis()$result)) {
|
||||||
setorder(data, p_value)
|
data <- data.table(gsea_analysis()$result)
|
||||||
|
setorder(data, p_value)
|
||||||
|
|
||||||
data[, total_ratio := term_size / effective_domain_size]
|
data[, total_ratio := term_size / effective_domain_size]
|
||||||
data[, query_ratio := intersection_size / query_size]
|
data[, query_ratio := intersection_size / query_size]
|
||||||
data[, increase := (query_ratio - total_ratio) / total_ratio]
|
data[, increase := (query_ratio - total_ratio) / total_ratio]
|
||||||
|
|
||||||
data <- data[, .(
|
data <- data[, .(
|
||||||
source,
|
source,
|
||||||
term_name,
|
term_name,
|
||||||
total_ratio,
|
total_ratio,
|
||||||
query_ratio,
|
query_ratio,
|
||||||
increase,
|
increase,
|
||||||
p_value
|
p_value
|
||||||
)]
|
)]
|
||||||
|
|
||||||
DT::datatable(
|
DT::datatable(
|
||||||
data,
|
data,
|
||||||
rownames = FALSE,
|
rownames = FALSE,
|
||||||
colnames = c(
|
colnames = c(
|
||||||
"Source",
|
"Source",
|
||||||
"Term",
|
"Term",
|
||||||
"Total ratio",
|
"Total ratio",
|
||||||
"Query ratio",
|
"Query ratio",
|
||||||
"Increase",
|
"Increase",
|
||||||
"p-value"
|
"p-value"
|
||||||
),
|
),
|
||||||
options = list(
|
options = list(
|
||||||
pageLength = 25
|
pageLength = 25
|
||||||
)
|
)
|
||||||
) |>
|
) |>
|
||||||
DT::formatRound("p_value", digits = 4) |>
|
DT::formatRound("p_value", digits = 4) |>
|
||||||
DT::formatPercentage(
|
DT::formatPercentage(
|
||||||
c("total_ratio", "query_ratio", "increase"),
|
c("total_ratio", "query_ratio", "increase"),
|
||||||
digits = 2
|
digits = 2
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
DT::datatable(data.table())
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue