diff --git a/scripts/11_annotate_hg19_create_pseudo_epicv1_from_epicv2.Rmd b/scripts/11_annotate_hg19_create_pseudo_epicv1_from_epicv2.Rmd index 34b1e51..684f73f 100644 --- a/scripts/11_annotate_hg19_create_pseudo_epicv1_from_epicv2.Rmd +++ b/scripts/11_annotate_hg19_create_pseudo_epicv1_from_epicv2.Rmd @@ -25,8 +25,14 @@ This script is only intended for EPICv2 data. Do not run it on EPICv1 data. start_time <- Sys.time() ``` +```{r import annotation, include=FALSE} +annotation_hg19 <- read.table("../data/EPICv2.hg19.manifest.tsv") +annotation_hg19 <- row_to_names(annotation_hg19, row_number = 1, remove_row = TRUE, remove_rows_above = TRUE) +``` + ```{r setup, include=FALSE} user_choices <- readRDS("../data/user_choices.rds") +knitr::opts_knit$set(root.dir = paste0(user_choices$personal_path, "/")) knitr::opts_chunk$set(echo = FALSE) if(user_choices$package_path != "PLEASE FILL IN"){ @@ -54,9 +60,6 @@ load(paste0(user_choices$project_name, "/processed_data/Betas_clean_filtered_qua load(paste0(user_choices$project_name, "/reports/annotations_clean_filtered.Rdata")) load(paste0(user_choices$project_name, "/reports/annotations_clean_unfiltered.Rdata")) load(paste0(user_choices$project_name, "/processed_data/PhenoData_clean.Rdata")) -annotation_hg19 <- read.table(paste0(user_choices$personal_path, "/epic_preprocessing_k2h/data/EPICv2.hg19.manifest.tsv")) -annotation_hg19 <- row_to_names(annotation_hg19, row_number = 1, remove_row = TRUE, remove_rows_above = TRUE) -knitr::opts_knit$set(root.dir = paste0(user_choices$personal_path, "/")) ``` ```{r, check array type, include = TRUE} @@ -80,7 +83,8 @@ save(annotions_clean_unfiltered_hg19, file = paste0(user_choices$project_name, " ```{r, create pseudo-EPICv1 version for filtered data, include=FALSE} # create annotation only containing filtered CpGs that are also on v1 and exclude any duplicated loci -annotations_clean_filtered_pseudo_v1 <- annotations_clean_filtered %>% +annotations_clean_filtered_pseudo_v1 <- annotations_clean_filtered@listData %>% + as.data.frame() %>% dplyr::filter(Name %in% rownames(Betas_clean_filtered_quantile_bmiq_combated)) %>% # only keep loci on EPICv1, filter wrongly annotated empty value dplyr::filter(EPICv1_Loci != "") %>% @@ -116,7 +120,8 @@ save(Betas_clean_filtered_quantile_bmiq_combated_pseudo_v1, file = paste0(user_c ```{r, create pseudo-EPICv1 version for unfiltered data, include=FALSE} # create annotation only containing unfiltered CpGs that are also on v1 and exclude any duplicated loci -annotations_clean_unfiltered_pseudo_v1 <- annotations_clean_unfiltered %>% +annotations_clean_unfiltered_pseudo_v1 <- annotations_clean_unfiltered@listData %>% + as.data.frame() %>% dplyr::filter(Name %in% rownames(Betas_clean_unfiltered_quantile_bmiq_combated)) %>% dplyr::filter(EPICv1_Loci != "") %>% dplyr::filter(duplicated(EPICv1_Loci) == FALSE)