get_hierarchy

pyobo.get_hierarchy(prefix, *, include_part_of=True, include_has_member=False, extra_relations=None, properties=None, use_tqdm=False, force=False, version=None)[source]

Get hierarchy of parents as a directed graph.

Parameters:
  • prefix (str) – The name of the namespace.

  • include_part_of (bool) – 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 (bool) – Add “has member” relations. These aren’t part of the BFO, but are hacked into PyOBO using pyobo.struct.typedef.has_member for relationships like from protein families to their actual proteins.

  • extra_relations (Optional[Iterable[TypeDef]]) – Other relations that you want to include in the hierarchy. For example, it might be useful to include the positively_regulates

  • properties (Optional[Iterable[str]]) – Properties to include in the data part of each node. For example, might want to include SMILES strings with the ChEBI tree.

  • use_tqdm (bool) – Show a progress bar

  • force (bool) – should the resources be reloaded when extracting relations?

Return type:

DiGraph

Returns:

A directional graph representing the hierarchy

This function thinly wraps _get_hierarchy_helper() to make it easier to work with the lru_cache mechanism.