Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log2 pre processing #315

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/interface-details/pre-processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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
- 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
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
5 changes: 3 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,8 @@ 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)
logarithm <- ifelse(logarithm_procedure == "log10", log10,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logarithm <- ifelse(logarithm_procedure == "log10", log10,
logarithm <- ifelse(logarithm_procedure == "log10", log10,

I think for more than a single if...else i would prefer classical
if(){} else if{} else{} for reading purposes

ifelse(logarithm_procedure == "log2", log2, 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