Skip to content

Commit

Permalink
Import annotation before changing working directorz, convert annotati…
Browse files Browse the repository at this point in the history
…on to dataframe
  • Loading branch information
Vera N. Karlbauer committed Jun 5, 2025
1 parent c5ecf99 commit fcc6915
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/11_annotate_hg19_create_pseudo_epicv1_from_epicv2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"){
Expand Down Expand Up @@ -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}
Expand All @@ -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 != "") %>%
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fcc6915

Please sign in to comment.