Remove global methods data

This commit is contained in:
Elias Projahn 2022-05-26 17:55:40 +02:00
parent 13b5efc1e3
commit 421bb79a0b
4 changed files with 12 additions and 14 deletions

View file

@ -15,12 +15,14 @@ Description: This package provides a graphical user interface for analyzing
License: AGPL (>= 3) License: AGPL (>= 3)
Encoding: UTF-8 Encoding: UTF-8
Roxygen: list(markdown = TRUE) Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2 RoxygenNote: 7.2.0
Imports: Imports:
bslib,
data.table, data.table,
disgenet2r, disgenet2r,
DT, DT,
geposan, geposan,
glue,
gprofiler2, gprofiler2,
plotly, plotly,
purrr, purrr,

View file

@ -1,8 +0,0 @@
# All available methods from [geposan] and additional information on them.
methods <- geposan::all_methods()
# IDs of methods for geposan.
method_ids <- sapply(methods, function(method) method$id)
# Names of methods for geposan.
method_names <- sapply(methods, function(method) method$name)

View file

@ -21,7 +21,7 @@ methods_ui <- function(id) {
"Customize weights" = "custom" "Customize weights" = "custom"
) )
), ),
lapply(methods, function(method) { lapply(geposan::all_methods(), function(method) {
verticalLayout( verticalLayout(
checkboxInput( checkboxInput(
NS(id, method$id), NS(id, method$id),
@ -52,7 +52,7 @@ methods_ui <- function(id) {
methods_server <- function(id, analysis, comparison_gene_ids) { methods_server <- function(id, analysis, comparison_gene_ids) {
moduleServer(id, function(input, output, session) { moduleServer(id, function(input, output, session) {
# Observe each method's enable button and synchronise the slider state. # Observe each method's enable button and synchronise the slider state.
lapply(methods, function(method) { lapply(geposan::all_methods(), function(method) {
observeEvent(input[[method$id]], { observeEvent(input[[method$id]], {
shinyjs::toggleState( shinyjs::toggleState(
sprintf("%s_weight", method$id), sprintf("%s_weight", method$id),
@ -89,7 +89,7 @@ methods_server <- function(id, analysis, comparison_gene_ids) {
included_methods <- NULL included_methods <- NULL
for (method in methods) { for (method in geposan::all_methods()) {
if (input[[method$id]]) { if (input[[method$id]]) {
included_methods <- c(included_methods, method$id) included_methods <- c(included_methods, method$id)
} }
@ -105,7 +105,7 @@ methods_server <- function(id, analysis, comparison_gene_ids) {
}) |> bindCache( }) |> bindCache(
analysis(), analysis(),
optimization_gene_ids(), optimization_gene_ids(),
sapply(methods, function(method) input[[method$id]]), sapply(geposan::all_methods(), function(method) input[[method$id]]),
input$optimization_target input$optimization_target
) )
@ -114,7 +114,7 @@ methods_server <- function(id, analysis, comparison_gene_ids) {
if (length(optimization_gene_ids()) < 1 | if (length(optimization_gene_ids()) < 1 |
input$optimization_target == "custom") { input$optimization_target == "custom") {
for (method in methods) { for (method in geposan::all_methods()) {
if (input[[method$id]]) { if (input[[method$id]]) {
weight <- input[[sprintf("%s_weight", method$id)]] weight <- input[[sprintf("%s_weight", method$id)]]
weights[[method$id]] <- weight weights[[method$id]] <- weight

View file

@ -51,6 +51,10 @@ results_server <- function(id, filtered_results) {
) )
}) })
methods <- geposan::all_methods()
method_ids <- sapply(methods, function(method) method$id)
method_names <- sapply(methods, function(method) method$name)
columns <- c( columns <- c(
"rank", "rank",
"gene", "gene",