Skip to content

Commit

Permalink
Log2 pre processing (#315)
Browse files Browse the repository at this point in the history
* add Log2 as preprocessing
* Added lines to help files and report output
  • Loading branch information
anikde07 authored Oct 30, 2024
1 parent 1b6a717 commit 82f67c5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/interface-details/pre-processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions program/shinyApp/R/Report_text_snippets.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
1 change: 1 addition & 0 deletions program/shinyApp/R/pre_processing/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
15 changes: 13 additions & 2 deletions program/shinyApp/R/pre_processing/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"){
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion program/shinyApp/helpfiles/PreProcessing_Procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 82f67c5

Please sign in to comment.