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, min = 0,
max = 100, max = 100,
step = 1, step = 1,
value = 60 value = 75
) )
), ),
tabPanelBody( tabPanelBody(

View file

@ -172,20 +172,53 @@ server <- function(input, output, session) {
geposan::plot_boxplot(ranking(), gene_sets) geposan::plot_boxplot(ranking(), gene_sets)
}) })
output$gost <- plotly::renderPlotly({ gost <- reactive({
if (input$enable_gost) { withProgress(
result <- gprofiler2::gost( message = "Querying g:Profiler",
results_filtered()[, gene], value = 0.0,
ordered_query = TRUE { # nolint
) setProgress(0.2)
gprofiler2::gost(results_filtered()[, gene])
}
)
})
gprofiler2::gostplot( output$gost_plot <- plotly::renderPlotly({
result, gprofiler2::gostplot(
capped = FALSE, gost(),
interactive = TRUE 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
View file

@ -85,18 +85,13 @@ ui <- div(
), ),
tabPanel( tabPanel(
title = "g:Profiler", title = "g:Profiler",
checkboxInput( div(
"enable_gost", style = "margin-top: 16px",
"Perform a gene set enrichment analysis on the \ plotly::plotlyOutput("gost_plot"),
filtered result genes."
), ),
conditionalPanel( div(
"input.enable_gost == true", style = "margin-top: 16px",
plotly::plotlyOutput( DT::DTOutput("gost_details")
"gost",
width = "100%",
height = "600px"
)
) )
) )
) )