laminlabs / bionty

Registries for biological entities, coupled to public ontologies.
Apache License 2.0
11 stars 2 forks source link

displaying children of Cell Ontology term #36

Closed indapa closed 2 months ago

indapa commented 9 months ago

Hi,

I am new to lamin. I have some code that tries to display the ontology tree of Cell Ontology terms:

`!lamin init --storage ./Lamin/test-cell-type --schema bionty

import lnschema_bionty as lb
import pandas as pd

public = lb.CellType.public()

lookup = public.lookup()
lookup_dict = lookup.dict()

dch_cell = lb.CellType(lookup_dict["dendritic cell"])

dch_cell.view_parents( with_children=True)`

Does the view_parents function display any grand children of the cell ontology term? The reason I ask is CellXGene does a cell type [rollup] (https://cellxgene.cziscience.com/docs/04__Analyze%20Public%20Data/4_2__Gene%20Expression%20Documentation/4_2_3__Gene%20Expression%20Data%20Processing) and I would like to display the ontology tree with bionty for all the cell type descendants of a cell type (not just the first one)

image

sunnyosun commented 9 months ago

Hi @indapa,

Thank you for your question! Passing with_children=True will show children from all distances.

However, we currently only offer view_parents() for records registered in your lamindb instance. Based on what you shared above, it seems that other children of "dendritic cell" have not yet been saved to your registry.

You can check out our public laminlabs/cellxgene instance via:

!lamin load laminlabs/cellxgene

import lamindb as ln
import lnschema_bionty as lb

dch_cell = lb.CellType.filter(name="dendritic cell").one()
dch_cell.view_parents(with_children=True)

Note when saving a record to lamindb registries, only parents are by default saved, not children.

We are discussing internally to improve the UX so that you can view all public ontologies more easily. I'll keep you updated soon!

sunnyosun commented 2 months ago

You can now use CellType.import_from_source to bulk add all records into LaminDB. If you do so, all parents and children will be populated.