Access ontologies#

When it comes to ontology defined vocabularies, such as cell type, tissue, disease, and phenotype, Pronto Ontology object can be accessed via {entity}.ontology

import bionty as bt

Basic fields: name, ontology_id, definition, synonyms, children#

These fields are parsed into the DataFrame(df()) and lookup object to be directly accessible

disease_bionty = bt.Disease()

disease_bionty
๐Ÿ’พ Downloading Disease ontology source file...
๐Ÿ’พ Downloading Disease source file from: http://purl.obolibrary.org/obo/mondo/releases/2023-04-04/mondo.owl


Disease
Species: all
Source: mondo, 2023-04-04

๐Ÿ“– Disease.df(): ontology reference table
๐Ÿ”Ž Disease.lookup(): autocompletion of terms
๐ŸŽฏ Disease.search(): free text search of terms
๐Ÿง Disease.inspect(): check if identifiers are mappable
๐Ÿ‘ฝ Disease.map_synonyms(): map synonyms to standardized names
๐Ÿ”— Disease.ontology: Pronto.Ontology object
disease_bionty.df().head()
name definition synonyms children
ontology_id
MONDO:0000001 disease A Disease Is A Disposition To Undergo Patholog... other disease|disease or disorder|disease|diso... [MONDO:0005583, MONDO:0700096]
MONDO:0000004 adrenocortical insufficiency An Endocrine Or Hormonal Disorder That Occurs ... adrenal cortical hypofunction|hypocortisolemia... [MONDO:0043370, MONDO:0015129]
MONDO:0000005 alopecia, isolated None None [MONDO:0007082, MONDO:0012899, MONDO:0007184, ...
MONDO:0000009 inherited bleeding disorder, platelet-type None bleeding disorder, platelet-type [MONDO:0009885, MONDO:0018794, MONDO:0030996, ...
MONDO:0000014 colorblindness, partial None None [MONDO:0010564]
lookup = disease_bionty.lookup()
lookup_record = lookup.alzheimer_disease

lookup_record
Disease(ontology_id='MONDO:0004975', name='Alzheimer disease', definition='A Progressive, Neurodegenerative Disease Characterized By Loss Of Function And Death Of Nerve Cells In Several Areas Of The Brain Leading To Loss Of Cognitive Function Such As Memory And Language.', synonyms="AD|Alzheimers dementia|Alzheimer dementia|Alzheimer disease|presenile and senile dementia|Alzheimer's disease|Alzheimers disease|Alzheimer's dementia", children=array(['MONDO:0014316', 'MONDO:0100087', 'MONDO:0014036', 'MONDO:0014265',
       'MONDO:0010422'], dtype=object))
lookup_record.definition
'A Progressive, Neurodegenerative Disease Characterized By Loss Of Function And Death Of Nerve Cells In Several Areas Of The Brain Leading To Loss Of Cognitive Function Such As Memory And Language.'

Synonyms are concatenated into a string with bars |:

lookup_record.synonyms
"AD|Alzheimers dementia|Alzheimer dementia|Alzheimer disease|presenile and senile dementia|Alzheimer's disease|Alzheimers disease|Alzheimer's dementia"

Children with distance=1 can be directly accessed:

lookup_record.children
array(['MONDO:0014316', 'MONDO:0100087', 'MONDO:0014036', 'MONDO:0014265',
       'MONDO:0010422'], dtype=object)

.pronto: Pronto Ontology#

More hierarchical information can be accessed from the Pronto Ontology object:

pronto_object = disease_bionty.ontology
pronto_object
Ontology('/home/runner/work/bionty/bionty/bionty/_dynamic/all___mondo___2023-04-04___Disease', timeout=100)
term = pronto_object.get_term("MONDO:0004975")

term
Term('MONDO:0004975', name='Alzheimer disease')
list(term.subclasses(distance=2, with_self=False))
[Term('MONDO:0010422', name='Alzheimer disease 16'),
 Term('MONDO:0014036', name='Alzheimer disease 17'),
 Term('MONDO:0014265', name='Alzheimer disease 18'),
 Term('MONDO:0014316', name='Alzheimer disease 19'),
 Term('MONDO:0100087', name='familial Alzheimer disease'),
 Term('MONDO:0007089', name='Alzheimer disease 2'),
 Term('MONDO:0015140', name='early-onset autosomal dominant Alzheimer disease')]

Extra fields#

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

  • molecule

  • instrument

  • measurement

readout_bionty = bt.Readout()


readout_bionty.df().head()
name definition synonyms children molecule instrument measurement
ontology_id
EFO:0011021 BRCA1 mutation carier status Determination Of The Presence Or Absence Of Kn... BRCA1 mutation status|BRCA1 carrier status [] None None carrier status
EFO:0011022 BRCA2 mutation carier statu Determination Of The Presence Or Absence Of Kn... BRCA2 carrier status|BRCA2 mutation status [] None None carrier status
EFO:0700000 spatial proteomics An Assay That Allows For Visualization And Qua... None [EFO:0700001, EFO:0700002] protein assay None None
EFO:0700001 PhenoCycler-Fusion A Spatial Discovery System Where Whole-Slide S... None [] protein assay None None
EFO:0700002 PhenoCycler An Automated Fluidics System That Uses Oligonu... None [] protein assay None None
lookup = readout_bionty.lookup()

Look up a molecular readout:

lookup_record = lookup.single_cell_rna_sequencing
lookup_record
Readout(ontology_id='EFO:0008913', name='single-cell RNA sequencing', definition='A Protocol That Provides The Expression Profiles Of Single Cells Via The Isolation And Barcoding Of Single Cells And Their Rna, Reverse Transcription, Amplification, Library Generation And Sequencing.', synonyms='scRNA-seq|single-cell RNA-seq|single-cell transcriptome sequencing|single cell RNA sequencing', children=array(['EFO:0005685', 'EFO:0008440', 'EFO:0008441', 'EFO:0700004',
       'EFO:0005684', 'EFO:0700003', 'EFO:0030060', 'EFO:0030059'],
      dtype=object), molecule='RNA assay', instrument='single cell sequencing', measurement=None)
lookup_record.molecule
'RNA assay'
lookup_record.instrument
'single cell sequencing'

Lookup a phenotypic readout:

lookup.tumor_size
Readout(ontology_id='EFO:0004134', name='tumor size', definition='The Physical Size Of A Tumor.', synonyms='size of tumor', children=array([], dtype=object), molecule=None, instrument=None, measurement='tumor size')