Access ontologies: cell type, tissue, disease, phenotype#

When it comes to ontology defined vocabularies, such as cell type, tissue, disease, and phenotype, the entity class extends to have the ontology accessible via {entity}.ontology

import bionty as bt

All available ontologies and their versions can be printed with:

bt.display_available_versions()
                                                Available versions                                                 
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┓
┃                         Ontology                                           URL  Bionty …  Databas…  All ve… ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━┩
│                          Ensembl            https://www.ensembl.org/index.html   Species   ensembl  releas… │
│                                                                                                             │
│                          Ensembl            https://www.ensembl.org/index.html      Gene   ensembl  releas… │
│                                                                                                             │
│                          Ensembl            https://www.ensembl.org/index.html      Gene   ensembl  releas… │
│                                                                                                     releas… │
│                                                                                                             │
│                          Uniprot                      https://www.uniprot.org/   Protein   uniprot  2022-04 │
│                                                                                                             │
│                          Uniprot                      https://www.uniprot.org/   Protein   uniprot  2022-04 │
│                                                                                                     2022-03 │
│                                                                                                             │
│                       CellMarker   http://bio-bigdata.hrbmu.edu.cn/CellMarker/  CellMar…  cellmar…      2.0 │
│                                                                                                             │
│               Cell Line Ontology  https://bioportal.bioontology.org/ontologie…  CellLine       clo  2022-0… │
│                                                                                                             │
│                    Cell Ontology  https://obophenotype.github.io/cell-ontolog…  CellType        cl  2023-0… │
│                                                                                                             │
│                    Cell Ontology  https://obophenotype.github.io/cell-ontolog…  CellType        cl  2023-0… │
│                                                                                                     2022-0… │
│                                                                                                             │
│        Human Cell Atlas Ontology    https://github.com/HumanCellAtlas/ontology  CellType        ca  2022-1… │
│                                                                                                             │
│ Uberon multi-species anatomy on…         http://obophenotype.github.io/uberon/    Tissue    uberon  2023-0… │
│                                                                                                             │
│ Uberon multi-species anatomy on…         http://obophenotype.github.io/uberon/    Tissue    uberon  2023-0… │
│                                                                                                     2022-0… │
│                                                                                                             │
│           Mondo Disease Ontology          https://mondo.monarchinitiative.org/   Disease     mondo  2023-0… │
│                                                                                                             │
│           Mondo Disease Ontology          https://mondo.monarchinitiative.org/   Disease     mondo  2023-0… │
│                                                                                                     2022-1… │
│                                                                                                             │
│           Human Disease Ontology                 https://disease-ontology.org/   Disease      doid  2023-0… │
│                                                                                                             │
│ The Experimental Factor Ontology  https://bioportal.bioontology.org/ontologie…   Readout       efo   3.48.0 │
│                                                                                                             │
│         Human Phenotype Ontology                          https://hpo.jax.org/  Phenoty…        hp  2023-0… │
│                                                                                                             │
│                 Pathway Ontology       https://www.ebi.ac.uk/ols/ontologies/pw   Pathway        pw     7.78 │
│                                                                                                             │
│                 Pathway Ontology       https://www.ebi.ac.uk/ols/ontologies/pw   Pathway        pw     7.78 │
│                                                                                                        7.74 │
│                                                                                                             │
│          Bioinformatics Pipeline                              https://lamin.ai  BFXPipe…     lamin    1.0.0 │
│                                                                                                             │
└──────────────────────────────────┴──────────────────────────────────────────────┴──────────┴──────────┴─────────┘

The currently used versions can be shown with:

bt.display_active_versions()
Currently used versions in ._current.yaml 
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃      Entity    Database      Version ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│     Species     ensembl  release-108 │
│        Gene     ensembl  release-108 │
│     Protein     uniprot      2022-04 │
│  CellMarker  cellmarker          2.0 │
│    CellLine         clo   2022-03-21 │
│    CellType          cl   2023-02-15 │
│      Tissue      uberon   2023-02-14 │
│     Disease       mondo   2023-02-06 │
│     Readout         efo       3.48.0 │
│   Phenotype          hp   2023-01-27 │
│     Pathway          pw         7.78 │
│ BFXPipeline       lamin        1.0.0 │
└─────────────┴────────────┴─────────────┘

Cell Type#

Here we look at cell type as an example:

ct = bt.CellType()
df = ct.df()
df.head()
name
ontology_id
CL:0000000 cell
CL:0000001 primary cultured cell
CL:0000002 obsolete immortal cell line cell
CL:0000003 native cell
CL:0000004 obsolete cell by organism

again you may look up the vocabulary using .lookup by tab completion

lookup = bt.CellType().lookup()
lookup.astrocyte
cell_type(ontology_id='CL:0000127', name='astrocyte')

Cell type ontology is accessible via pronto Ontology as .ontology

ct.ontology
Ontology('/home/runner/work/bionty/bionty/.nox/build-package-bionty/lib/python3.9/site-packages/bionty/_dynamic/human___cl___2023-02-15___CellType', timeout=100)
len(ct.ontology.terms())
4168
term = ct.ontology["CL:0000128"]
term.definition
Definition('A class of large neuroglial (macroglial) cells in the central nervous system. Form the insulating myelin sheath of axons in the central nervous system.', xrefs={Xref('http://en.wikipedia.org/wiki/Oligodendrocyte'), Xref('MESH:D009836')})
term.is_leaf()
True

tissue, disease, and phenotype work similary

Tissue#

tissue = bt.Tissue()
df = tissue.df()
df.head()
name
ontology_id
UBERON:0000000 processual entity
UBERON:0000002 uterine cervix
UBERON:0000003 naris
UBERON:0000004 nose
UBERON:0000005 chemosensory organ
lookup = tissue.lookup()
lookup.kidney
tissue(ontology_id='UBERON:0002113', name='kidney')

Disease#

disease = bt.Disease()
df = disease.df()
df.head()
name
ontology_id
http://identifiers.org/hgnc/10001 RGS5
http://identifiers.org/hgnc/10004 RGS9
http://identifiers.org/hgnc/10006 RHAG
http://identifiers.org/hgnc/10012 RHO
http://identifiers.org/hgnc/10013 GRK1
lookup = disease.lookup()
lookup.chronic_kidney_disease
disease(ontology_id='MONDO:0005300', name='chronic kidney disease')

Phenotype#

phenotype = bt.Phenotype()
df = phenotype.df()
df.head()
name
ontology_id
BFO:0000001 entity
BFO:0000002 continuant
BFO:0000003 occurrent
BFO:0000004 independent continuant
BFO:0000006 spatial region
lookup = phenotype.lookup()
lookup.cerebral_nerve_fasciculus
phenotype(ontology_id='UBERON:0022248', name='cerebral nerve fasciculus')

Readout#

Readout parses Experimental Factor Ontology to the following categories for describing biological experiments:

  • efo_id

  • name

  • molecule

  • instrument

  • measurement

The columns are reflected in the readout table in lnschema-wetlab.

readout = bt.Readout()
df = readout.df()
df.head()
ontology_id name
0 EFO:0000001 experimental factor
1 EFO:0000002 CS57511
2 EFO:0000003 CS57512
3 EFO:0000004 CS57515
4 EFO:0000005 CS57520

Search for a molecular readout:

readout.get("EFO:0010891")
{'ontology_id': 'EFO:0010891',
 'name': 'scATAC-seq',
 'molecule': 'DNA assay',
 'instrument': 'assay by high throughput sequencer',
 'measurement': None}

Searching for a non-molecular readout:

readout.get("EFO:0004134")
{'ontology_id': 'EFO:0004134',
 'name': 'tumor size',
 'molecule': None,
 'instrument': None,
 'measurement': 'tumor size'}