get_hierarchy
- get_hierarchy(prefix, *, extra_relations=None, properties=None, **kwargs)[source]
Get hierarchy of parents as a directed graph.
- Parameters:
prefix (str) – The name of the namespace.
include_part_of – Add “part of” relations. Only works if the relations are properly defined using bfo:0000050 ! part of or bfo:0000051 ! has part
include_has_member – Add “has member” relations. These aren’t part of the BFO, but are hacked into PyOBO using
pyobo.struct.typedef.has_memberfor relationships like from protein families to their actual proteins.extra_relations (Iterable[ReferenceHint] | None) – Other relations that you want to include in the hierarchy. For example, it might be useful to include the positively_regulates
properties (Iterable[ReferenceHint] | None) – Properties to include in the data part of each node. For example, might want to include SMILES strings with the ChEBI tree.
force – should the resources be reloaded when extracting relations?
kwargs (Unpack[HierarchyKwargs])
- Returns:
A directional graph representing the hierarchy
- Return type:
nx.DiGraph[Reference]
This function thinly wraps
_get_hierarchy_helper()to make it easier to work with the lru_cache mechanism.