Add age of death for each HPO ID. AgeOfDeath IDs and assigned "AgeOfDeath_score" values:
HP:0005268 "Miscarriage" (AgeOfDeath_score=1)
HP:0003826 "Stillbirth" (AgeOfDeath_score=1)
HP:0034241 "Prenatal death" (AgeOfDeath_score=1)
HP:0003811 "Neonatal death" (AgeOfDeath_score=2)
HP:0001522 "Death in infancy" (AgeOfDeath_score=3)
HP:0003819 "Death in childhood" (AgeOfDeath_score=4)
HP:0011421 "Death in adolescence" (AgeOfDeath_score=5)
HP:0100613 "Death in early adulthood" (AgeOfDeath_score=6)
HP:0033764 "Death in middle age" (AgeOfDeath_score=7)
HP:0033763 "Death in adulthood" (AgeOfDeath_score=7)
HP:0033765 "Death in late adulthood" (AgeOfDeath_score=8)
add_death(
phenos,
keep_deaths = NULL,
all.x = TRUE,
allow.cartesian = FALSE,
agg_by = NULL,
verbose = TRUE
)
dataframe of phenotypes and values / parameters.
The age of death associated with each HPO ID to keep. If >1 age of death is associated with the term, only the earliest age is considered. See add_death for details.
logical; if TRUE
, then extra rows will be added to the
output, one for each row in x
that has no matching row in y
.
These rows will have 'NA's in those columns that are usually filled with values
from y
. The default is FALSE
, so that only rows with data from both
x
and y
are included in the output.
See allow.cartesian
in [.data.table
.
Column to aggregate age of death metadata by.
Print messages.
phenos data.table with extra columns:
"AgeOfDeath": AgeOfDeath HPO IDs of disease phenotypes associated with the target hpo_id phenotype.
"AgeOfDeath_names": AgeOfDeath HPO names of disease phenotypes associated with the target hpo_id phenotype.
"AgeOfDeath_counts": The number of times each term in "AgeOfDeath_names" appears across associated disease phenotypes.
"AgeOfDeath_score_mean": Mean age of death score.
"AgeOfDeath_score_min": Minimum age of death score.
"AgeOfDeath_top": The most common age of death term.
"AgeOfDeath_earliest": The earliest age of death.
"AgeOfDeath_latest": The latest age of death.
phenos <- example_phenos()
#> ℹ All local files already up-to-date!
phenos2 <- add_death(phenos = phenos)
#> Annotating phenos with AgeOfDeath.
#> Annotating phenos with Disease
#> Reading cached RDS file: phenotype.hpoa
#> + Version: v2023-10-09