From 2041cf2c2cc655f8bc461e9548c066f529377bd9 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Wed, 8 Dec 2021 14:49:50 +0100 Subject: [PATCH] Add DisGeNET integration --- DESCRIPTION | 1 + R/server.R | 49 +++++++++++++++++++++++++++++++++++++++++++++---- R/ui.R | 7 +++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b1c2cf3..c726dcf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,6 +16,7 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.2 Imports: data.table, + disgenet2r, DT, geposan, gprofiler2, diff --git a/R/server.R b/R/server.R index c28b5f2..2298f12 100644 --- a/R/server.R +++ b/R/server.R @@ -173,14 +173,14 @@ server <- function(input, output, session) { }) gost <- reactive({ - withProgress( + withProgress( message = "Querying g:Profiler", value = 0.0, { # nolint setProgress(0.2) gprofiler2::gost(results_filtered()[, gene]) } - ) + ) }) output$gost_plot <- plotly::renderPlotly({ @@ -198,15 +198,17 @@ server <- function(input, output, session) { data[, total_ratio := term_size / effective_domain_size] data[, query_ratio := intersection_size / query_size] + data <- data[, .(source, term_name, total_ratio, query_ratio, p_value)] + dt <- DT::datatable( - data[, .(source, term_name, total_ratio, query_ratio, p_value)], + data, rownames = FALSE, colnames = c( "Source", "Term", "Total ratio", "Query ratio", - "p-Value" + "p-value" ), style = "bootstrap", options = list( @@ -221,4 +223,43 @@ server <- function(input, output, session) { digits = 1 ) }) + + output$disgenet <- DT::renderDT({ + withProgress( + message = "Querying DisGeNET", + value = 0.0, + { # nolint + setProgress(0.2) + + gene_names <- results_filtered()[, name] + gene_names <- unique(gene_names[gene_names != ""]) + + diseases <- disgenet2r::disease_enrichment(gene_names) + + data <- data.table(diseases@qresult) + + data <- data[, .(Description, Ratio, BgRatio, pvalue)] + setorder(data, pvalue) + + dt <- DT::datatable( + data, + rownames = FALSE, + colnames = c( + "Disease", + "Query ratio", + "Total ratio", + "p-value" + ), + style = "bootstrap", + options = list( + pageLength = 25 + ) + ) + + dt <- DT::formatRound(dt, "pvalue", digits = 4) + + dt + } + ) + }) } diff --git a/R/ui.R b/R/ui.R index 029286b..f5d7f09 100644 --- a/R/ui.R +++ b/R/ui.R @@ -93,6 +93,13 @@ ui <- div( style = "margin-top: 16px", DT::DTOutput("gost_details") ) + ), + tabPanel( + title = "DisGeNET", + div( + style = "margin-top: 16px", + DT::DTOutput("disgenet") + ) ) ) )