diff --git a/scripts/10_correction_batch_effects_unfiltered.Rmd b/scripts/10_correction_batch_effects_unfiltered.Rmd index dce65a0..f59a991 100644 --- a/scripts/10_correction_batch_effects_unfiltered.Rmd +++ b/scripts/10_correction_batch_effects_unfiltered.Rmd @@ -30,7 +30,7 @@ start_time <- Sys.time() ``` ```{r setup, include=FALSE} -source("../data/calculate_pc_cutoff.R") # source function for determining PC cutoff +source("../data/Calculate_PC_Cutoff.R") # source function for determining PC cutoff needed_packages <- c("BiocManager", "dplyr", "knitr", "rmarkdown", "tibble", "ggplot2", "ggrepel", "broom", "gplots", "tidyr", "sva", "methods") user_choices <- readRDS("../data/user_choices.rds") @@ -69,7 +69,7 @@ phenotype_data <- readRDS(paste0(user_choices$project_name, "/processed_data/phe ## Correction of technical batch effects with ComBat -```{r, correction of first batch effect and PCA} +```{r, correction of first batch effect and PCA, results='asis'} m_values <- apply(Betas_clean_unfiltered_quantile_bmiq, 2, function(x) log2((x)/(1-x))) # get M-values if (correction_variable_1 == "PLEASE FILL IN"){ @@ -230,7 +230,11 @@ if (correction_variable_1 == "PLEASE FILL IN"){ } ``` -```{r, correction of second batch effect and PCA} +```{r, print p-value table for batch effects after correction of first batch effect variable} +anova_lm_pvalue_df %>% paged_table() +``` + +```{r, correction of second batch effect and PCA, results='asis'} if (correction_variable_2 == "PLEASE FILL IN"){ print("No second batch correction variable was specified by user, data remains unchanged") } else { @@ -389,7 +393,11 @@ if (correction_variable_2 == "PLEASE FILL IN"){ } ``` -```{r, correction of third batch effect and PCA} +```{r, print p-value table for batch effects after correction of second batch effect variable} +anova_lm_pvalue_df %>% paged_table() +``` + +```{r, correction of third batch effect and PCA, results='asis'} if (correction_variable_3 == "PLEASE FILL IN"){ print("No third batch correction variable was specified by user, data remains unchanged") } else { @@ -548,7 +556,11 @@ if (correction_variable_3 == "PLEASE FILL IN"){ } ``` -```{r, convertion M to Beta and save, include=FALSE} +```{r, print p-value table for batch effects after correction of third batch effect variable} +anova_lm_pvalue_df %>% paged_table() +``` + +```{r, conversion M to Beta and save, include=FALSE} if(exists("m_values_combat_3")){ corrected_data <- m_values_combat_3 changing_status <- "changed"