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
)

Arguments

phenos

dataframe of phenotypes and values / parameters.

keep_deaths

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.

all.x

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.

allow.cartesian

See allow.cartesian in [.data.table.

agg_by

Column to aggregate age of death metadata by.

verbose

Print messages.

Value

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.

Examples

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