diff --git a/docs/interface-details/pre-processing.md b/docs/interface-details/pre-processing.md index 4ae36a3d..01c09297 100644 --- a/docs/interface-details/pre-processing.md +++ b/docs/interface-details/pre-processing.md @@ -13,10 +13,10 @@ The Pre-processing tab is divided into two main sections: the side panel and the In the side panel, you have the following options: -- **Pre-Processing Procedures**: You can select from various pre-processing procedures. - - Options: none, filterOnly, vst_DESeq, simpleCenterScaling, Scaling_0_1, log10, pareto_scaling, ln - - vst_DESeq also requires the selection of a design formula. +- **Pre-Processing Procedures**: You can select from various pre-processing procedures. + - Options: none, filterOnly, vst_DESeq, simpleCenterScaling, Scaling_0_1, log10, log2, pareto_scaling, ln + - vst_DESeq also requires the selection of a design formula. - **Select Batch Effect Column**: Choose a batch effect if applicable. Possible choices are taken from the sample annotation columns. diff --git a/program/shinyApp/R/Report_text_snippets.R b/program/shinyApp/R/Report_text_snippets.R index 2215dcc6..6d6b3b2d 100644 --- a/program/shinyApp/R/Report_text_snippets.R +++ b/program/shinyApp/R/Report_text_snippets.R @@ -80,6 +80,8 @@ snippet_preprocessing <- function( snippet <- paste0(snippet, "The base-10 logarithm of each data point was calculated. If a single zero value was present, 1 was added to all points to avoid undefined results.\n") } else if (params$PreProcessing_Procedure == "ln") { snippet <- paste0(snippet, "The natural logarithm of each data point was calculated. If a single zero value was present, 1 was added to all points to avoid undefined results.\n") + } else if (params$PreProcessing_Procedure == "log2") { + snippet <- paste0(snippet, "The base-2 logarithm of each data point was calculated. If a single zero value was present, 1 was added to all points to avoid undefined results.\n") } else if (params$PreProcessing_Procedure == "pareto_scaling") { snippet <- paste0(snippet, "The data was parteo scaled. Pareto scaling emphasizes the importance of small values by dividing each data point by the square root of its standard deviation.\n") } else if(params$PreProcessing_Procedure == "None") { diff --git a/program/shinyApp/R/pre_processing/ui.R b/program/shinyApp/R/pre_processing/ui.R index 91c4e88f..2089a6dc 100644 --- a/program/shinyApp/R/pre_processing/ui.R +++ b/program/shinyApp/R/pre_processing/ui.R @@ -14,6 +14,7 @@ pre_processing_sidebar_panel <- sidebarPanel( "centering to 0 and scaling" = "simpleCenterScaling", "scaling values to be within 0 and 1" = "Scaling_0_1", "log10" = "log10", + "log2" = "log2", "Pareto scaling (mean-centered and scaled by the square root of the standard deviation)" = "pareto_scaling", "natural logarithm" = "ln" ), diff --git a/program/shinyApp/R/pre_processing/util.R b/program/shinyApp/R/pre_processing/util.R index 09814f42..19f3db36 100644 --- a/program/shinyApp/R/pre_processing/util.R +++ b/program/shinyApp/R/pre_processing/util.R @@ -10,7 +10,7 @@ preprocessing <- function(data, omic_type, procedure){ if(procedure %in% c("Scaling_0_1", "pareto_scaling")){ return(scaling_normalisation(data, omic_type, procedure)) } - if(procedure %in% c("log10", "ln")){ + if(procedure %in% c("log10", "ln", "log2")){ return(ln_normalisation(data, omic_type, procedure)) } if(procedure == "none"){ @@ -72,7 +72,18 @@ scaling_normalisation <- function(data, omic_type, scaling_procedure){ ln_normalisation <- function(data, omic_type, logarithm_procedure){ # Center and scale the data - logarithm <- ifelse(logarithm_procedure == "log10", log10, log) + if(logarithm_procedure == "log10") + { + logarithm = log10 + } + else if(logarithm_procedure == "log2") + { + logarithm = log2 + } + else + { + logarithm = log + } # prefilter the data data <- prefiltering(data, omic_type) # log the data and always add 1 to avoid -Inf diff --git a/program/shinyApp/helpfiles/PreProcessing_Procedures.md b/program/shinyApp/helpfiles/PreProcessing_Procedures.md index 4eddae2b..2577a6cf 100644 --- a/program/shinyApp/helpfiles/PreProcessing_Procedures.md +++ b/program/shinyApp/helpfiles/PreProcessing_Procedures.md @@ -55,7 +55,13 @@ - Special consideration is given to handling zero values to avoid undefined results: If any zero values are present, +1 is added to all values before applying the logarithm. - + +- **Logarithm Base 2 (log2):** + - The base-2 logarithm of each data point is calculated. + - Special consideration is given to handling zero values to avoid undefined + results: If any zero values are present, +1 is added to all values before applying + the logarithm. + - **Pareto Scaling:** - Pareto scaling emphasizes the importance of small values by dividing each data point by the square root of its standard deviation. - This method is suitable for datasets with a wide range of values.