Update gprofiler integration

This commit is contained in:
Elias Projahn 2021-12-08 14:38:38 +01:00
parent ffa90cd667
commit 36546570e0
3 changed files with 53 additions and 25 deletions

View file

@ -22,7 +22,7 @@ filters_ui <- function(id) {
min = 0,
max = 100,
step = 1,
value = 60
value = 75
)
),
tabPanelBody(

View file

@ -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])
}
)
})
output$gost_plot <- plotly::renderPlotly({
gprofiler2::gostplot(
result,
gost(),
capped = FALSE,
interactive = TRUE
)
} else {
NULL
}
})
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
)
)
dt <- DT::formatRound(dt, "p_value", digits = 4)
dt <- DT::formatPercentage(
dt,
c("total_ratio", "query_ratio"),
digits = 1
)
})
}

17
R/ui.R
View file

@ -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")
)
)
)