Make a dataframe from a subset of the Human Phenotype Ontology.

make_phenos_dataframe(
  ancestor = NULL,
  hpo = get_hpo(),
  phenotype_to_genes = load_phenotype_to_genes(),
  adjacency = NULL,
  add_ont_lvl_absolute = TRUE,
  add_ont_lvl_relative = FALSE,
  add_info_contents = FALSE,
  add_description = TRUE,
  add_disease_data = FALSE,
  add_ndiseases = add_disease_data,
  add_onsets = add_disease_data,
  add_deaths = add_disease_data,
  add_pheno_frequencies = add_disease_data,
  add_tiers = add_disease_data,
  add_severities = add_disease_data,
  add_hoverboxes = FALSE,
  columns = list_columns(),
  interactive = TRUE,
  verbose = TRUE
)

Arguments

ancestor

The ancestor to get all descendants of. If NULL, returns the entirely ontology.

hpo

Human Phenotype Ontology object, loaded from ontologyIndex.

phenotype_to_genes

Output of load_phenotype_to_genes mapping phenotypes to gene annotations.

adjacency

An adjacency matrix generated by adjacency_matrix.

add_ont_lvl_absolute

Add the absolute ontology level of each HPO term. See get_ont_lvls for more details.

add_ont_lvl_relative

Add the relative ontology level of each HPO term. See get_ont_lvls for more details.

add_info_contents

Add information content column for each phenotype.

add_description

Whether to get the phenotype descriptions as well (slower).

add_disease_data

Add all disease metadata columns. This will expand the data using allow.cartesian=TRUE.

add_ndiseases

Add the number of diseases per phenotype.

add_onsets

Add age of onset columns using add_onset.

add_deaths

Add age of death columns using add_death.

add_pheno_frequencies

Add the frequency of each phenotype in each disease.

add_tiers

Add severity Tiers column using add_tier.

add_severities

Add severity column using add_severity.

add_hoverboxes

Add hoverdata with make_hoverboxes.

columns

A named vector of columns in phenos to add to the hoverdata via make_hoverboxes.

interactive

Make the plot interactive with ggplotly.

verbose

Print messages.

Value

The HPO in dataframe format.

Examples

phenos <- make_phenos_dataframe(ancestor = "Neurodevelopmental delay")
#>  All local files already up-to-date!
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2023-10-09
#> Extracting data for 23 descendents.
#> Computing gene counts.
#> Getting absolute ontology level for 23 HPO IDs.
#> Computing ontology level / gene count ratio.
#> Adding term definitions.
#>  All local files already up-to-date!
#> Adding level-3 ancestor to each HPO ID.
#>  All local files already up-to-date!