Jupyter Notebook Binder

CellTypist

Cell types classify cells based on public and private knowledge from studying transcription, morphology, function & other properties. Established cell types have well-characterized markers and properties; however, cell subtypes and states are continuously being discovered, refined and better understood.

In this notebook, we register the immune cell type vocabulary from CellTypist, a computational tool used for cell type classification in scRNA-seq data.

In the following Standardize metadata on-the-fly notebook, we’ll demonstrate how to annotate datasets analyzed with CellTypist enrichment analysis and track the dataset with LaminDB.

Setup

!lamin load use-cases-registries
Hide code cell output
💡 connected lamindb: testuser1/use-cases-registries
Hide code cell content
# filter warnings from celltypist
import warnings

warnings.filterwarnings("ignore", message=".*The 'nopython' keyword.*")
import lamindb as ln
import bionty as bt
💡 connected lamindb: testuser1/use-cases-registries

Access CellTypist records

As a first step we will read in CellTypist’s immune cell encyclopedia

import pandas as pd
description = "CellTypist Pan Immune Atlas v2: basic cell type information"
celltypist_source_v2_url = "https://github.com/Teichlab/celltypist_wiki/raw/main/atlases/Pan_Immune_CellTypist/v2/tables/Basic_celltype_information.xlsx"

celltypist_df = pd.read_excel(celltypist_source_v2_url)

It provides an ontology_id of the public Cell Ontology for the majority of records.

celltypist_df.head()
High-hierarchy cell types Low-hierarchy cell types Description Cell Ontology ID Curated markers
0 B cells B cells B lymphocytes with diverse cell surface immuno... CL:0000236 CD79A, MS4A1, CD19
1 B cells Follicular B cells resting mature B lymphocytes found in the prim... CL:0000843 CXCR5, TNFRSF13B, CD22
2 B cells Proliferative germinal center B cells proliferating germinal center B cells CL:0000844 MKI67, SUGCT, AICDA
3 B cells Germinal center B cells proliferating mature B cells that undergo soma... CL:0000844 POU2AF1, CD40, SUGCT
4 B cells Memory B cells long-lived mature B lymphocytes which are form... CL:0000787 CR2, CD27, MS4A1

The “Cell Ontology ID” is associated with multiple “Low-hierarchy cell types”:

celltypist_df.set_index(["Cell Ontology ID", "Low-hierarchy cell types"]).head(10)
High-hierarchy cell types Description Curated markers
Cell Ontology ID Low-hierarchy cell types
CL:0000236 B cells B cells B lymphocytes with diverse cell surface immuno... CD79A, MS4A1, CD19
CL:0000843 Follicular B cells B cells resting mature B lymphocytes found in the prim... CXCR5, TNFRSF13B, CD22
CL:0000844 Proliferative germinal center B cells B cells proliferating germinal center B cells MKI67, SUGCT, AICDA
Germinal center B cells B cells proliferating mature B cells that undergo soma... POU2AF1, CD40, SUGCT
CL:0000787 Memory B cells B cells long-lived mature B lymphocytes which are form... CR2, CD27, MS4A1
Age-associated B cells B cells CD11c+ T-bet+ memory B cells associated with a... FCRL2, ITGAX, TBX21
CL:0000788 Naive B cells B cells mature B lymphocytes which express cell-surfac... IGHM, IGHD, TCL1A
CL:0000818 Transitional B cells B cells immature B cell precursors in the bone marrow ... CD24, MYO1C, MS4A1
CL:0000817 Large pre-B cells B-cell lineage proliferative B lymphocyte precursors derived ... MME, CD24, MKI67
Small pre-B cells B-cell lineage non-proliferative B lymphocyte precursors deri... MME, CD24, IGLL5

Validate CellTypist records

For any cell type record that can be validated against the public Cell Ontology, we’d like to ensure that it’s actually validated.

This will avoid that we’ll refer to the same cell type with different identifiers.

We need a Bionty object for this:

bionty = bt.CellType.public()
bionty
PublicOntology
Entity: CellType
Organism: all
Source: cl, 2024-02-13
#terms: 2918

We can now validate the "Cell Ontology ID" column:

bionty.inspect(celltypist_df["Cell Ontology ID"], bionty.ontology_id);

This looks good!

But when inspecting the names, most of them don’t validate:

bionty.inspect(celltypist_df["Low-hierarchy cell types"], bionty.name);
97 terms (99.00%) are not validated for name: B cells, Follicular B cells, Proliferative germinal center B cells, Germinal center B cells, Memory B cells, Age-associated B cells, Naive B cells, Transitional B cells, Large pre-B cells, Small pre-B cells, Pre-pro-B cells, Pro-B cells, Cycling B cells, Cycling DCs, Cycling gamma-delta T cells, Cycling monocytes, Cycling NK cells, Cycling T cells, DC, DC1, ...
   detected 6 terms with synonyms: DC1, DC2, ETP, ILC2, ILC3, pDC
→  standardize terms via .standardize()

A search tells us that terms that are named in plural in Cell Typist occur with a name in singular in the Cell Ontology:

celltypist_df["Low-hierarchy cell types"][0]
'B cells'
bionty.search(celltypist_df["Low-hierarchy cell types"][0]).head(2)
ontology_id definition synonyms parents __agg__ __ratio__
name
B cell CL:0000236 A Lymphocyte Of B Lineage That Is Capable Of B... B-cell|B-lymphocyte|B lymphocyte [CL:0000945] b cell 92.307692
B-2 B cell CL:0000822 A Conventional B Cell Subject To Antigenic Sti... B2 B-cell|B-2 B-cell|B2 B cell|B2 B-lymphocyte... [CL:0000785] b-2 b cell 85.714286

Let’s try to strip "s" and inspect if more names are now validated. Yes, there are!

bionty.inspect(
    [i.rstrip("s") for i in celltypist_df["Low-hierarchy cell types"]],
    bionty.name,
);
93 terms (94.90%) are not validated for name: Follicular B cell, Proliferative germinal center B cell, Germinal center B cell, Memory B cell, Age-associated B cell, Naive B cell, Transitional B cell, Large pre-B cell, Small pre-B cell, Pre-pro-B cell, Pro-B cell, Cycling B cell, Cycling DC, Cycling gamma-delta T cell, Cycling monocyte, Cycling NK cell, Cycling T cell, DC, DC1, DC2, ...
   detected 31 terms with inconsistent casing/synonyms: Follicular B cell, Germinal center B cell, Memory B cell, Naive B cell, Transitional B cell, Small pre-B cell, Pro-B cell, DC1, DC2, Endothelial cell, Epithelial cell, Erythrocyte, ETP, Fibroblast, Granulocyte, Neutrophil, ILC2, ILC3, NK cell, Alveolar macrophage, ...
→  standardize terms via .standardize()

Every “low-hierarchy cell type” has an ontology id and most “high-hierarchy cell types” also appear as “low-hierarchy cell types” in the Cell Typist table. Four, however, don’t, and therefore don’t have an ontology ID.

high_terms = celltypist_df["High-hierarchy cell types"].unique()
low_terms = celltypist_df["Low-hierarchy cell types"].unique()

high_terms_nonval = set(high_terms).difference(low_terms)
high_terms_nonval
{'B-cell lineage', 'Cycling cells', 'Erythroid', 'T cells'}

Register CellTypist records

Let’s first add the “High-hierarchy cell types” as a column "parent".

This enables LaminDB to populate the parents and children fields, which will enable you to query for hierarchical relationships.

celltypist_df["parent"] = celltypist_df.pop("High-hierarchy cell types")

# if high and low terms are the same, no parents
celltypist_df.loc[
    (celltypist_df["parent"] == celltypist_df["Low-hierarchy cell types"]), "parent"
] = None

# rename columns, drop markers
celltypist_df.drop(columns=["Curated markers"], inplace=True)
celltypist_df.rename(
    columns={"Low-hierarchy cell types": "ct_name", "Cell Ontology ID": "ontology_id"},
    inplace=True,
)
celltypist_df.columns = celltypist_df.columns.str.lower()

# add standardize names for each ontology_id
celltypist_df["name"] = bionty.df().loc[celltypist_df["ontology_id"]].name.values
celltypist_df.head(2)
ct_name description ontology_id parent name
0 B cells B lymphocytes with diverse cell surface immuno... CL:0000236 None B cell
1 Follicular B cells resting mature B lymphocytes found in the prim... CL:0000843 B cells follicular B cell

Now, let’s create records from the public ontology:

public_records = bt.CellType.from_values(
    celltypist_df.ontology_id, bt.CellType.ontology_id
)
ln.save(public_records)
❗ now recursing through parents: this only happens once, but is much slower than bulk saving

Let’s now amend public ontology records so that they maintain additional annotations that Cell Typist might have.

public_records_dict = {r.ontology_id: r for r in public_records}

for _, row in celltypist_df.iterrows():
    record = public_records_dict[row["ontology_id"]]
    try:
        record.add_synonym(row["ct_name"])
    except SystemExit:
        pass
Hide code cell output
❌ input synonyms ['DC2'] already associated with the following records:
created_at created_by_id run_id updated_at id uid name ontology_id abbr synonyms description public_source_id
0 2024-06-19 23:17:02.663794+00:00 1 None 2024-06-19 23:17:02.663855+00:00 126 3JO0EdVd plasmacytoid dendritic cell CL:0000784 None pDC|type 2 DC|plasmacytoid T cell|T-associated... A Dendritic Cell Type Of Distinct Morphology, ... 29
❌ input synonyms ['ILC2'] already associated with the following records:
created_at created_by_id run_id updated_at id uid name ontology_id abbr synonyms description public_source_id
0 2024-06-19 23:16:53.928524+00:00 1 None 2024-06-19 23:16:53.928583+00:00 112 4ny4oBnr group 2 innate lymphoid cell CL:0001069 None natural helper cell|ILC2|nuocyte An Innate Lymphoid Cell That Is Capable Of Pro... 29
❌ input synonyms ['ILC3'] already associated with the following records:
created_at created_by_id run_id updated_at id uid name ontology_id abbr synonyms description public_source_id
0 2024-06-19 23:16:54.742256+00:00 1 None 2024-06-19 23:16:54.742318+00:00 113 3tILnbqv group 3 innate lymphoid cell CL:0001071 None ILC3 An Innate Lymphoid Cell That Constituitively E... 29
❌ input synonyms ['pDC'] already associated with the following records:
created_at created_by_id run_id updated_at id uid name ontology_id abbr synonyms description public_source_id
0 2024-06-19 23:17:02.663794+00:00 1 None 2024-06-19 23:17:02.663855+00:00 126 3JO0EdVd plasmacytoid dendritic cell CL:0000784 None pDC|type 2 DC|plasmacytoid T cell|T-associated... A Dendritic Cell Type Of Distinct Morphology, ... 29

Add parent-child relationship of the records from Celltypist

We still need to add the renaming 4 High hierarchy terms:

list(high_terms_nonval)
['T cells', 'Erythroid', 'B-cell lineage', 'Cycling cells']

Let’s get the top hits from a search:

for term in list(high_terms_nonval):
    print(f"Term: {term}")
    display(bionty.search(term).head(2))
Term: T cells
ontology_id definition synonyms parents __agg__ __ratio__
name
T cell CL:0000084 A Type Of Lymphocyte Whose Defining Characteri... T-lymphocyte|T lymphocyte|T-cell [CL:0000542] t cell 92.307692
exhausted T cell CL:0011025 None An effector T cell that displays impaired effe... [CL:0000911] exhausted t cell 80.000000
Term: Erythroid
ontology_id definition synonyms parents __agg__ __ratio__
name
erythroid progenitor cell CL:0000038 A Progenitor Cell Committed To The Erythroid L... None [CL:0000764, CL:0000839] erythroid progenitor cell 90.0
megakaryocyte-erythroid progenitor cell CL:0000050 A Progenitor Cell Committed To The Megakaryocy... colony forming unit erythroid megakaryocyte|CF... [CL:0002032, CL:0011026, CL:0000763] megakaryocyte-erythroid progenitor cell 90.0
Term: B-cell lineage
ontology_id definition synonyms parents __agg__ __ratio__
name
obsolete cell by lineage CL:0000220 None None [] obsolete cell by lineage 73.684211
obsolete cell line cell CL:0007014 Obsolete: A Cultured Cell That Has Been Passag... passaged cultured cell [] obsolete cell line cell 64.864865
Term: Cycling cells
ontology_id definition synonyms parents __agg__ __ratio__
name
circulating cell CL:0000080 A Cell Which Moves Among Different Tissues Of ... None [CL:0000000] circulating cell 75.862069
lining cell CL:0000213 A Cell Within An Epithelial Cell Sheet Whose M... boundary cell [CL:0000215] lining cell 75.000000

So we decide to:

  • Add the “T cells” to the synonyms of the public “T cell” record

  • Create the remaining 3 terms only using their names (we think “B cell flow” shouldn’t be identified with “B cell”)

for name in high_terms_nonval:
    if name == "T cells":
        record = bt.CellType.from_public(name="T cell")
        record.add_synonym(name)
        record.save()
    elif name == "Erythroid":
        record = bt.CellType.from_public(name="erythroid lineage cell")
        record.add_synonym(name)
        record.save()
    else:
        record = bt.CellType(name=name)
        record.save()
❗ records with similar names exist! did you mean to load one of them?
uid name ontology_id abbr synonyms description public_source_id run_id created_by_id updated_at
id
1 ryEtgi1y B cell CL:0000236 None B cells|B-cell|B-lymphocyte|Cycling B cells|B ... A Lymphocyte Of B Lineage That Is Capable Of B... 29 None 1 2024-06-19 23:17:11.679931+00:00
2 2EhFTUoZ follicular B cell CL:0000843 None follicular B lymphocyte|Follicular B cells|Fo ... A Resting Mature B Cell That Has The Phenotype... 29 None 1 2024-06-19 23:17:11.466799+00:00
3 4IowPafD germinal center B cell CL:0000844 None Germinal center B cells|GC B-cell|germinal cen... A Rapidly Cycling Mature B Cell That Has Disti... 29 None 1 2024-06-19 23:17:11.505371+00:00
4 2cUPBtY8 memory B cell CL:0000787 None memory B-lymphocyte|memory B lymphocyte|memory... A Memory B Cell Is A Mature B Cell That Is Lon... 29 None 1 2024-06-19 23:17:11.543840+00:00
5 3jdCg7zi naive B cell CL:0000788 None naive B-cell|Naive B cells|naive B lymphocyte|... A Naive B Cell Is A Mature B Cell That Has The... 29 None 1 2024-06-19 23:17:11.562809+00:00
6 75GaqGOI transitional stage B cell CL:0000818 None Transitional B cells|transitional B cell|trans... An Immature B Cell Of An Intermediate Stage Be... 29 None 1 2024-06-19 23:17:11.581442+00:00
9 1gKQ0rC2 pro-B cell CL:0000826 None progenitor B lymphocyte|pro-B-cell|progenitor ... A Progenitor Cell Of The B Cell Lineage, With ... 29 None 1 2024-06-19 23:17:11.661235+00:00
16 1lOJ8BJ3 immature conventional dendritic cell CL:0000840 None Transitional DC An Immature Cell Of The Conventional Dendritic... 29 None 1 2024-06-19 23:17:11.893921+00:00
17 3O0icKg6 common dendritic progenitor CL:0001029 None common dendritic precursor|pro-DCs|DC precurso... Common Dendritic Precursor Is A Hematopoietic ... 29 None 1 2024-06-19 23:17:11.914603+00:00
20 VEvqzCKG megakaryocyte progenitor cell CL:0000553 None megacaryoblast|Early MK|Meg-CFC|megakaryocytic... The Earliest Cytologically Identifiable Precur... 29 None 1 2024-06-19 23:17:12.748655+00:00
24 2KfvYuU7 erythroid lineage cell CL:0000764 None Late erythroid|Mid erythroid|Early erythroid|E... A Immature Or Mature Cell In The Lineage Leadi... 29 None 1 2024-06-19 23:17:13.733868+00:00
29 1HNi1cpn common myeloid progenitor CL:0000049 None CMP|common myeloid precursor A Progenitor Cell Committed To Myeloid Lineage... 29 None 1 2024-06-19 23:17:12.196490+00:00
31 6xDuAGup granulocyte monocyte progenitor cell CL:0000557 None granulocyte-macrophage progenitor|granulocyte/... A Hematopoietic Progenitor Cell That Is Commit... 29 None 1 2024-06-19 23:17:12.258614+00:00
32 5aRkGEwL hematopoietic multipotent progenitor cell CL:0000837 None hemopoietic progenitor cell|HSC/MPP|MPP A Hematopoietic Multipotent Progenitor Cell Is... 29 None 1 2024-06-19 23:17:12.283678+00:00
33 223zBABS megakaryocyte-erythroid progenitor cell CL:0000050 None megakaryocyte/erythroid progenitor cell|MEMP|C... A Progenitor Cell Committed To The Megakaryocy... 29 None 1 2024-06-19 23:17:12.326343+00:00
34 2NvA9f4y neutrophil progenitor cell CL:0000834 None Neutrophil-myeloid progenitor A Progenitor Cell Of The Neutrophil Lineage. 29 None 1 2024-06-19 23:17:12.349049+00:00
49 6UmKFrzn classical monocyte CL:0000860 None inflammatory monocyte|Classical monocytes A Monocyte That Responds Rapidly To Microbial ... 29 None 1 2024-06-19 23:17:12.854155+00:00
53 2nPA0h4F plasma cell CL:0000786 None Plasma cells|plasmacyte|plasmocyte|plasma B ce... A Terminally Differentiated, Post-Mitotic, Ant... 29 None 1 2024-06-19 23:17:12.975576+00:00
60 3muVF5Bn mature NK T cell CL:0000814 None mature NK T-lymphocyte|mature natural killer T... A Mature Alpha-Beta T Cell Of A Distinct Linea... 29 None 1 2024-06-19 23:17:13.182811+00:00
69 7GpphKmr lymphocyte of B lineage CL:0000945 None None A Lymphocyte Of B Lineage With The Commitment ... 29 None 1 2024-06-19 23:16:28.137831+00:00
❗ records with similar names exist! did you mean to load one of them?
uid name ontology_id abbr synonyms description public_source_id run_id created_by_id updated_at
id
1 ryEtgi1y B cell CL:0000236 None B cells|B-cell|B-lymphocyte|Cycling B cells|B ... A Lymphocyte Of B Lineage That Is Capable Of B... 29 None 1 2024-06-19 23:17:11.679931+00:00
2 2EhFTUoZ follicular B cell CL:0000843 None follicular B lymphocyte|Follicular B cells|Fo ... A Resting Mature B Cell That Has The Phenotype... 29 None 1 2024-06-19 23:17:11.466799+00:00
3 4IowPafD germinal center B cell CL:0000844 None Germinal center B cells|GC B-cell|germinal cen... A Rapidly Cycling Mature B Cell That Has Disti... 29 None 1 2024-06-19 23:17:11.505371+00:00
4 2cUPBtY8 memory B cell CL:0000787 None memory B-lymphocyte|memory B lymphocyte|memory... A Memory B Cell Is A Mature B Cell That Is Lon... 29 None 1 2024-06-19 23:17:11.543840+00:00
5 3jdCg7zi naive B cell CL:0000788 None naive B-cell|Naive B cells|naive B lymphocyte|... A Naive B Cell Is A Mature B Cell That Has The... 29 None 1 2024-06-19 23:17:11.562809+00:00
6 75GaqGOI transitional stage B cell CL:0000818 None Transitional B cells|transitional B cell|trans... An Immature B Cell Of An Intermediate Stage Be... 29 None 1 2024-06-19 23:17:11.581442+00:00
7 4rQVc1EA precursor B cell CL:0000817 None Small pre-B cells|Large pre-B cells A Precursor B Cell Is A B Cell With The Phenot... 29 None 1 2024-06-19 23:17:11.623369+00:00
8 2FWj3GpL early pro-B cell CL:0002046 None Pre-pro-B cells A Pro-B Cell That Is Cd22-Positive, Cd34-Posit... 29 None 1 2024-06-19 23:17:11.642281+00:00
9 1gKQ0rC2 pro-B cell CL:0000826 None progenitor B lymphocyte|pro-B-cell|progenitor ... A Progenitor Cell Of The B Cell Lineage, With ... 29 None 1 2024-06-19 23:17:11.661235+00:00
10 5tVkOPwK dendritic cell, human CL:0001056 None Cycling DCs|Migratory DCs|DC3|DC A Dendritic Cell With The Phenotype Hla-Dra-Po... 29 None 1 2024-06-19 23:17:11.873059+00:00
11 1HuNn2EP gamma-delta T cell CL:0000798 None CRTAM+ gamma-delta T cells|gamma-delta T-cell|... A T Cell That Expresses A Gamma-Delta T Cell R... 29 None 1 2024-06-19 23:17:13.121453+00:00
12 28V22coI monocyte CL:0000576 None Cycling monocytes|Monocyte precursor|Monocytes Myeloid Mononuclear Recirculating Leukocyte Th... 29 None 1 2024-06-19 23:17:12.893964+00:00
13 37mWPv6o natural killer cell CL:0000623 None NK cells|NK cell|Cycling NK cells|CD16- NK cel... A Lymphocyte That Can Spontaneously Kill A Var... 29 None 1 2024-06-19 23:17:12.486086+00:00
14 22LvKd01 T cell CL:0000084 None T cells|CD8a/a|T-cell|T-lymphocyte|T lymphocyt... A Type Of Lymphocyte Whose Defining Characteri... 29 None 1 2024-06-19 23:17:13.716774+00:00
15 1uF1evnz conventional dendritic cell CL:0000990 None DC1|type 1 DC|dendritic reticular cell|cDC Conventional Dendritic Cell Is A Dendritic Cel... 29 None 1 2024-06-19 23:17:11.816544+00:00
16 1lOJ8BJ3 immature conventional dendritic cell CL:0000840 None Transitional DC An Immature Cell Of The Conventional Dendritic... 29 None 1 2024-06-19 23:17:11.893921+00:00
17 3O0icKg6 common dendritic progenitor CL:0001029 None common dendritic precursor|pro-DCs|DC precurso... Common Dendritic Precursor Is A Hematopoietic ... 29 None 1 2024-06-19 23:17:11.914603+00:00
18 1egQcee5 double negative thymocyte CL:0002489 None Double-negative thymocytes|double negative T c... A Thymocyte That Lacks Expression Of Cd4 And Cd8. 29 None 1 2024-06-19 23:17:11.934917+00:00
19 A8rr1lm9 double-positive, alpha-beta thymocyte CL:0000809 None double-positive, alpha-beta immature T lymphoc... A Thymocyte Expressing The Alpha-Beta T Cell R... 29 None 1 2024-06-19 23:17:11.954115+00:00
20 VEvqzCKG megakaryocyte progenitor cell CL:0000553 None megacaryoblast|Early MK|Meg-CFC|megakaryocytic... The Earliest Cytologically Identifiable Precur... 29 None 1 2024-06-19 23:17:12.748655+00:00
high_terms_nonval
{'B-cell lineage', 'Cycling cells', 'Erythroid', 'T cells'}
bt.CellType(name="B-cell lineage").save()
💡 returning existing CellType record with same name: 'B-cell lineage'

Now let’s add the parent records:

celltypist_df["parent"] = bt.CellType.standardize(celltypist_df["parent"])
for _, row in celltypist_df.iterrows():
    record = public_records_dict[row["ontology_id"]]
    if row["parent"] is not None:
        parent_record = bt.CellType.filter(name=row["parent"]).one()
        record.parents.add(parent_record)

Access the registry

The previously added CellTypist ontology registry is now available in LaminDB. To retrieve the full ontology table as a Pandas DataFrame we can use .filter:

bt.CellType.df()
uid name ontology_id abbr synonyms description public_source_id run_id created_by_id updated_at
id
139 5gxL2SWr B-cell lineage None None None None NaN None 1 2024-06-19 23:17:13.798531+00:00
140 5jshKSVL Cycling cells None None None None NaN None 1 2024-06-19 23:17:13.776940+00:00
24 2KfvYuU7 erythroid lineage cell CL:0000764 None Late erythroid|Mid erythroid|Early erythroid|E... A Immature Or Mature Cell In The Lineage Leadi... 29.0 None 1 2024-06-19 23:17:13.733868+00:00
14 22LvKd01 T cell CL:0000084 None T cells|CD8a/a|T-cell|T-lymphocyte|T lymphocyt... A Type Of Lymphocyte Whose Defining Characteri... 29.0 None 1 2024-06-19 23:17:13.716774+00:00
68 7j3YpGzu T-helper 17 cell CL:0000899 None Type 17 helper T cells|Th17 CD4+ T cell|Th17 T... Cd4-Positive, Alpha-Beta T Cell With The Pheno... 29.0 None 1 2024-06-19 23:17:13.546078+00:00
... ... ... ... ... ... ... ... ... ... ...
71 2Jgr5Xx4 mononuclear cell CL:0000842 None mononuclear leukocyte A Leukocyte With A Single Non-Segmented Nucleu... 29.0 None 1 2024-06-19 23:16:29.719396+00:00
70 X6c7osZ5 lymphocyte CL:0000542 None None A Lymphocyte Is A Leukocyte Commonly Found In ... 29.0 None 1 2024-06-19 23:16:28.939966+00:00
69 7GpphKmr lymphocyte of B lineage CL:0000945 None None A Lymphocyte Of B Lineage With The Commitment ... 29.0 None 1 2024-06-19 23:16:28.137831+00:00
38 1aLpWgJc group 3 innate lymphoid cell, human CL:0001078 None ILC3, human A Group 3 Innate Lymphoid Cell In The Human Wi... 29.0 None 1 2024-06-19 23:16:27.458204+00:00
37 6NmzCwsn group 2 innate lymphoid cell, human CL:0001081 None ILC2, human A Group 2 Innate Lymphoid Cell In The Human Wi... 29.0 None 1 2024-06-19 23:16:27.458111+00:00

140 rows × 10 columns

This enables us to look for cell types by creating a lookup object from our new CellType registry.

db_lookup = bt.CellType.lookup()
db_lookup.memory_b_cell
CellType(uid='2cUPBtY8', name='memory B cell', ontology_id='CL:0000787', synonyms='memory B-lymphocyte|memory B lymphocyte|memory B-cell|Age-associated B cells|Memory B cells', description='A Memory B Cell Is A Mature B Cell That Is Long-Lived, Readily Activated Upon Re-Encounter Of Its Antigenic Determinant, And Has Been Selected For Expression Of Higher Affinity Immunoglobulin. This Cell Type Has The Phenotype Cd19-Positive, Cd20-Positive, Mhc Class Ii-Positive, And Cd138-Negative.', created_by_id=1, public_source_id=29, updated_at='2024-06-19 23:17:11 UTC')

See cell type hierarchy:

db_lookup.memory_b_cell.view_parents()
_images/ac7a9c5f45efa72a97e79f5f19d3e6632f2c782695292dac0532667d16d1319d.svg

Access parents of a record:

db_lookup.memory_b_cell.parents.list()
[CellType(uid='ryEtgi1y', name='B cell', ontology_id='CL:0000236', synonyms='B cells|B-cell|B-lymphocyte|Cycling B cells|B lymphocyte', description='A Lymphocyte Of B Lineage That Is Capable Of B Cell Mediated Immunity.', created_by_id=1, public_source_id=29, updated_at='2024-06-19 23:17:11 UTC'),
 CellType(uid='71xItrKo', name='mature B cell', ontology_id='CL:0000785', synonyms='mature B lymphocyte|mature B-cell|mature B-lymphocyte', description='A B Cell That Is Mature, Having Left The Bone Marrow. Initially, These Cells Are Igm-Positive And Igd-Positive, And They Can Be Activated By Antigen.', created_by_id=1, public_source_id=29, updated_at='2024-06-19 23:16:33 UTC')]

Move on to the next registry: GO pathways