From 438b628c68ed4ee9ba87f3ea9c90cd7be43126fc Mon Sep 17 00:00:00 2001 From: ESCRI11 Date: Tue, 16 Jul 2024 14:01:20 +0200 Subject: [PATCH] feat: upload tranlation and defaults for proteomics --- components/app/R/server.R | 8 +++++++- .../board.upload/R/upload_module_computepgx.R | 20 ++++++++++++++----- .../board.upload/R/upload_module_outliers.R | 4 ++-- components/board.upload/R/upload_server.R | 5 +++-- components/board.upload/R/upload_ui.R | 2 +- etc/translation.json | 4 ++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/components/app/R/server.R b/components/app/R/server.R index e190fd189..af457b4b4 100644 --- a/components/app/R/server.R +++ b/components/app/R/server.R @@ -211,7 +211,7 @@ app_server <- function(input, output, session) { ## Modules needed from the start if (opt$ENABLE_UPLOAD) { - UploadBoard( + upload_datatype <-UploadBoard( id = "upload", pgx_dir = PGX.DIR, pgx = PGX, @@ -225,6 +225,12 @@ app_server <- function(input, output, session) { ) } + shiny::observeEvent(upload_datatype(), { + if (tolower(upload_datatype()) == "proteomics") { + shiny.i18n::update_lang("proteomics", session) + } + }) + ## Modules needed after dataset is loaded (deferred) -------------- observeEvent(env$load$is_data_loaded(), { diff --git a/components/board.upload/R/upload_module_computepgx.R b/components/board.upload/R/upload_module_computepgx.R index d495eb59b..619ef914b 100644 --- a/components/board.upload/R/upload_module_computepgx.R +++ b/components/board.upload/R/upload_module_computepgx.R @@ -39,10 +39,20 @@ upload_module_computepgx_server <- function( function(input, output, session) { ns <- session$ns ## statistical method for GENE level testing - GENETEST.METHODS <- c( - "ttest", "ttest.welch", "voom.limma", "trend.limma", "notrend.limma", - "deseq2.wald", "deseq2.lrt", "edger.qlf", "edger.lrt" - ) + GENETEST.METHODS <- shiny::reactiveVal("") + shiny::observeEvent(upload_datatype(), { + if (tolower(upload_datatype()) == "proteomics") { + GENETEST.METHODS( + c("ttest", "ttest.welch", "trend.limma", "notrend.limma") + ) + } else { + GENETEST.METHODS( + c("ttest", "ttest.welch", "voom.limma", "trend.limma", "notrend.limma", + "deseq2.wald", "deseq2.lrt", "edger.qlf", "edger.lrt") + ) + } + }) + ## GENETEST.SELECTED <- c("trend.limma", "voom.limma", "deseq2.wald", "edger.qlf") GENETEST.SELECTED <- c("ttest", "ttest.welch", "trend.limma", "notrend.limma") @@ -148,7 +158,7 @@ upload_module_computepgx_server <- function( shiny::checkboxGroupInput( ns("gene_methods"), shiny::HTML("

Gene tests:

"), - GENETEST.METHODS, + GENETEST.METHODS(), selected = GENETEST.SELECTED ) ), diff --git a/components/board.upload/R/upload_module_outliers.R b/components/board.upload/R/upload_module_outliers.R index 190ac882e..037571564 100644 --- a/components/board.upload/R/upload_module_outliers.R +++ b/components/board.upload/R/upload_module_outliers.R @@ -682,12 +682,12 @@ upload_module_outliers_server <- function( div("Normalize data values:\n"), shiny::selectInput(ns("scaling_method"), NULL, choices = c( - "LogCPM (default)" = "CPM", ## log2(nC+1) + "LogCPM" = "CPM", ## log2(nC+1) "LogMaxMedian" = "logMaxMedian", "LogMaxSum" = "logMaxSum", "Skip normalization" = "Skip_normalization" ), - selected = "CPM" + selected = ifelse(tolower(upload_datatype()) == "proteomics", "logMaxMedian", "CPM") ), shiny::checkboxInput(ns("quantile_norm"), "Quantile normalization", value = TRUE), br() diff --git a/components/board.upload/R/upload_server.R b/components/board.upload/R/upload_server.R index cb6abd880..b39a5af0e 100644 --- a/components/board.upload/R/upload_server.R +++ b/components/board.upload/R/upload_server.R @@ -12,7 +12,7 @@ UploadBoard <- function(id, recompute_pgx, recompute_info, inactivityCounter, - new_upload) { + new_upload, session2) { moduleServer(id, function(input, output, session) { ns <- session$ns ## NAMESPACE @@ -839,7 +839,7 @@ UploadBoard <- function(id, scrollY = "calc(50vh - 140px)", width = c("auto", "100%"), height = c("100%", TABLE_HEIGHT_MODAL), - title = "Uploaded Counts", + title = ifelse(tolower(upload_datatype()) == "proteomics", "Uploaded Expression", "Uploaded Counts"), info.text = "This is the uploaded counts data.", caption = "This is the uploaded counts data." ) @@ -941,5 +941,6 @@ UploadBoard <- function(id, ## ------------------------------------------------ ## Board return object ## ------------------------------------------------ + return(upload_datatype) }) } diff --git a/components/board.upload/R/upload_ui.R b/components/board.upload/R/upload_ui.R index 1c39f0264..5f4ed6f84 100644 --- a/components/board.upload/R/upload_ui.R +++ b/components/board.upload/R/upload_ui.R @@ -19,7 +19,7 @@ UploadUI <- function(id) { ) counts_ui <- wizardR::wizard_step( - step_title = "Step 2: Upload counts", + step_title = tspan("Step 2: Upload counts"), step_id = "step_counts", upload_table_preview_counts_ui( ns("counts_preview") diff --git a/etc/translation.json b/etc/translation.json index e0a9e212f..f31ccdea2 100644 --- a/etc/translation.json +++ b/etc/translation.json @@ -65,6 +65,10 @@ { "RNA-seq": "Counts boxplots", "proteomics": "Abundance boxplots" + }, + { + "RNA-seq": "Step 2: Upload counts", + "proteomics": "Step 2: Upload expression" } ] } \ No newline at end of file