Skip to content

Commit

Permalink
fixed DO mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sigven committed May 19, 2023
1 parent bbbce75 commit 889b403
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 30 deletions.
Binary file modified R/sysdata.rda
Binary file not shown.
6 changes: 3 additions & 3 deletions data-raw/data-raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lgr::lgr$appenders$console$set_layout(
)
## Get UMLS / DiseaseOntology / EFO mappings
umls_map <- map_umls(
update = T,
update = F,
basedir = here::here())

icd10_map <- map_icd10(
Expand All @@ -40,7 +40,7 @@ efo_map <- map_efo(
umls_map = umls_map,
efo_release = metadata$phen_oncox[
metadata$phen_oncox$source == "Experimental Factor Ontology",]$version,
update = T,
update = F,
basedir = here::here())

## Use OncoTree as starting point for phenotype cross-map
Expand Down Expand Up @@ -73,7 +73,7 @@ db[['oncotree_core']] <- oncotree_core
db[['oncotree_expanded']] <- oncotree_expanded
db[['auxiliary_maps']] <- auxiliary_maps

version_bumped <- "0.5.9"
version_bumped <- "0.6.0"
gd_records <- list()
db_id_ref <- data.frame()

Expand Down
73 changes: 46 additions & 27 deletions data-raw/phen_oncox_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -799,33 +799,6 @@ map_disease_ontology <- function(
i <- i + 1
}

do_map_cui_name_matched <- do_map |>
dplyr::select(do_id, do_name) |>
dplyr::left_join(
umls_map_lower,
by = c("do_name" = "cui_name_lc"),
multiple = "all", relationship = "many-to-many") |>
dplyr::filter(!is.na(cui)) |>
dplyr::select(do_id, cui) |>
dplyr::distinct()

#do_map <- dplyr::left_join(do_map, do_map_cui_name_matched)

if (skip_non_cui_mapped == T) {
do_map1 <- do_map |>
dplyr::filter(!is.na(cui)) |>
dplyr::distinct()
do_map2 <- do_map |>
dplyr::filter(is.na(cui)) |>
dplyr::select(-c(cui)) |>
dplyr::inner_join(
do_map_cui_name_matched,
by = c("do_id"),
multiple = "all", relationship = "many-to-many")

do_map <- dplyr::bind_rows(do_map1, do_map2)
}

## manual correction of erroneous or missing UMLS cross-references
do_map <- do_map |>
# dplyr::mutate(do_name =
Expand Down Expand Up @@ -887,6 +860,24 @@ map_disease_ontology <- function(
## HER2-receptor negative breast cancer
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0060080",
"C5238910", as.character(cui))) |>
## Diffuse Midline Glioma, H3 K27M-mutant
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0080684",
"C4289688", as.character(cui))) |>
## Diffuse large B-cell lymphoma activated B-cell type
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0080996",
"C1333296", as.character(cui))) |>
## Oligodendroglioma
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:3181",
"C0028945", as.character(cui))) |>
## B-cell Acute Lymphoblastic Leukemia
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0080638",
"C1292769", as.character(cui))) |>
## B-cell Adult Acute Lymphocytic Leukemia
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0060592",
"C0279593", as.character(cui))) |>
## Diffuse Glioma, H3 G34 Mutant
dplyr::mutate(cui = dplyr::if_else(do_id == "DOID:0080880",
"C5669880", as.character(cui))) |>

dplyr::bind_rows(
data.frame(do_id = "DOID:1788",
Expand Down Expand Up @@ -988,6 +979,34 @@ map_disease_ontology <- function(
cui = "C0007129", do_cancer_slim = T,
stringsAsFactors = F))


do_map_cui_name_matched <- do_map |>
dplyr::select(do_id, do_name) |>
dplyr::left_join(
umls_map_lower,
by = c("do_name" = "cui_name_lc"),
multiple = "all", relationship = "many-to-many") |>
dplyr::filter(!is.na(cui)) |>
dplyr::select(do_id, cui) |>
dplyr::distinct()

#do_map <- dplyr::left_join(do_map, do_map_cui_name_matched)

if (skip_non_cui_mapped == T) {
do_map1 <- do_map |>
dplyr::filter(!is.na(cui)) |>
dplyr::distinct()
do_map2 <- do_map |>
dplyr::filter(is.na(cui)) |>
dplyr::select(-c(cui)) |>
dplyr::inner_join(
do_map_cui_name_matched,
by = c("do_id"),
multiple = "all", relationship = "many-to-many")

do_map <- dplyr::bind_rows(do_map1, do_map2)
}

return(do_map)
}

Expand Down

0 comments on commit 889b403

Please sign in to comment.