diff --git a/scripts/9_correction_batch_effects_filtered.Rmd b/scripts/9_correction_batch_effects_filtered.Rmd index a8e1daf..17500de 100644 --- a/scripts/9_correction_batch_effects_filtered.Rmd +++ b/scripts/9_correction_batch_effects_filtered.Rmd @@ -41,7 +41,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") @@ -79,7 +79,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_filtered_quantile_bmiq, 2, function(x) log2((x)/(1-x))) # get M-values if (correction_variable_1 == "PLEASE FILL IN"){ @@ -240,7 +240,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 { @@ -399,6 +403,10 @@ if (correction_variable_2 == "PLEASE FILL IN"){ } ``` +```{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} if (correction_variable_3 == "PLEASE FILL IN"){ print("No third batch correction variable was specified by user, data remains unchanged") @@ -557,6 +565,10 @@ if (correction_variable_3 == "PLEASE FILL IN"){ } ``` +```{r, print p-value table for batch effects after correction of third batch effect variable} +anova_lm_pvalue_df %>% paged_table() +``` + ```{r, convertion M to Beta and save, include=FALSE} if(exists("m_values_combat_3")){ corrected_data <- m_values_combat_3