Functions to filter data.table objects.
filter_descendants(
phenos,
keep_descendants = NULL,
remove_descendants = NULL,
hpo = get_hpo()
)
A data.table containing HPO IDs and other metadata.
Terms whose descendants should be kept
(including themselves).
Set to NULL
(default) to skip this filtering step.
Terms whose descendants should be removed
(including themselves).
Set to NULL
(default) to skip this filtering step.
Human Phenotype Ontology object, loaded from get_ontology.
Filtered data.
data.table of phenotypes, with additional columns: "ancestor", "ancestor_id"
filter_descendants()
: filter_
Filter descendants
Subset a phenos
data.table to only
descendants of an ancestor HPO ID term.
phenos <- make_phenos_dataframe(ancestor = "Neurodevelopmental delay")
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2024-12-12
#> Extracting data for 24 descendents.
#> Computing gene counts.
#> Adding term definitions.
#> Adding level-2 ancestor to each HPO ID.
#> Adding ancestor metadata.
#> Ancestor metadata already present. Use force_new=TRUE to overwrite.
#> 24 associations remain after filtering.
#> Getting absolute ontology level for 19,025 IDs.
#> Computing ontology level / gene count ratio.
phenos2 <- filter_descendants(phenos = phenos,
keep_descendants = "Motor delay")
#> Translating ontology terms to ids.
#> Keeping descendants of 1 term(s).
#> 10 terms remain after filtering.
#> 10 associations remain after filtering.