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_bt = bt.Disease()

disease_bt


Disease
Species: all
Source: mondo, 2023-04-04
#terms: 23078

๐Ÿ“– 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_bt.df().head()
name definition synonyms parents
ontology_id
MONDO:0000001 disease A Disease Is A Disposition To Undergo Patholog... disorder|medical condition|disorders|disease o... []
MONDO:0000004 adrenocortical insufficiency An Endocrine Or Hormonal Disorder That Occurs ... adrenal cortical insufficiency|corticoadrenal ... [MONDO:0002816]
MONDO:0000005 alopecia, isolated None None [MONDO:0021034]
MONDO:0000009 inherited bleeding disorder, platelet-type None bleeding disorder, platelet-type [MONDO:0002245, MONDO:0002243, MONDO:0003847]
MONDO:0000014 colorblindness, partial None None [MONDO:0001703]
lookup = disease_bt.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="Alzheimer's disease|Alzheimer's dementia|Alzheimers dementia|Alzheimers disease|Alzheimer dementia|Alzheimer disease|presenile and senile dementia|AD", parents=array(['MONDO:0001627', 'MONDO:0005574'], 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
"Alzheimer's disease|Alzheimer's dementia|Alzheimers dementia|Alzheimers disease|Alzheimer dementia|Alzheimer disease|presenile and senile dementia|AD"

Parents with distance=1 can be directly accessed:

lookup_record.parents
array(['MONDO:0001627', 'MONDO:0005574'], dtype=object)

.pronto: Pronto Ontology#

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

pronto_object = disease_bt.ontology
๐Ÿ’พ Downloading Disease ontology source file...


pronto_object
Ontology('/home/runner/work/bionty/bionty/bionty/_dynamic/ontology_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#

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

  • molecule

  • instrument

  • measurement

readout_bt = bt.ExperimentalFactor()


readout_bt.df().head()
name definition synonyms parents 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 [EFO:0007658] None None carrier status
EFO:0011022 BRCA2 mutation carier statu Determination Of The Presence Or Absence Of Kn... BRCA2 carrier status|BRCA2 mutation status [EFO:0007658] None None carrier status
EFO:0700000 spatial proteomics An Assay That Allows For Visualization And Qua... None [EFO:0001458] protein assay None None
EFO:0700001 PhenoCycler-Fusion A Spatial Discovery System Where Whole-Slide S... None [EFO:0700000] protein assay None None
EFO:0700002 PhenoCycler An Automated Fluidics System That Uses Oligonu... None [EFO:0700000] protein assay None None
lookup = readout_bt.lookup()

Look up a molecular readout:

lookup_record = lookup.single_cell_rna_sequencing
lookup_record
ExperimentalFactor(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='single-cell RNA-seq|single-cell transcriptome sequencing|scRNA-seq|single cell RNA sequencing', parents=array(['EFO:0007832', 'EFO:0001457'], 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
ExperimentalFactor(ontology_id='EFO:0004134', name='tumor size', definition='The Physical Size Of A Tumor.', synonyms='size of tumor', parents=array(['EFO:0001444'], dtype=object), molecule=None, instrument=None, measurement='tumor size')