lamindb.core.HasParents

class lamindb.core.HasParents

Bases: object

Base class for hierarchical registries (ontologies).

Methods

query_children()

Query children in an ontology.

Return type:

QuerySet

query_parents()

Query parents in an ontology.

Return type:

QuerySet

view_parents(field=None, with_children=False, distance=5)

View parents in an ontology.

Parameters:
  • field (str | DeferredAttribute | None, default: None) – Field to display on graph

  • with_children (bool, default: False) – Whether to also show children.

  • distance (int, default: 5) – Maximum distance still shown.

Ontological hierarchies: ULabel (project & sub-project), CellType (cell type & subtype).

Examples

>>> import bionty as bt
>>> bt.Tissue.from_source(name="subsegmental bronchus").save()
>>> record = bt.Tissue.get(name="respiratory tube")
>>> record.view_parents()
>>> tissue.view_parents(with_children=True)