Age of Death associated with each disease, and by extension, each phenotype.
data("hpo_deaths")
data.table
terms <- simona::dag_offspring(get_hpo(), term = "HP:0011420")
aod <- lapply(stats::setNames(terms, terms),
function(hpo_id){
message("Extracting API data for",hpo_id)
d <- hpo_api(hpo_id = hpo_id, type = "diseases")$diseases
}) |> data.table::rbindlist(fill = TRUE,
use.names = TRUE,
idcol = "AgeOfDeath")
aod$AgeOfDeath_name <- map_phenotypes(terms = aod$AgeOfDeath)
#### Convert AoD to numeric scores ####
dict <- HPOExplorer:::hpo_dict(type="AgeOfDeath")
aod$AgeOfDeath_score <- dict[aod$AgeOfDeath_name]
data.table::setnames(aod,
c("diseaseId","diseaseName"),
c("disease_id","disease_name"))
hpo_deaths <- aod
usethis::use_data(hpo_deaths, overwrite = TRUE)