Get Pronto ontology objects#
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
Organism: all
Source: mondo, 2023-08-02
#terms: 26509
📖 Disease.df(): ontology reference table
🔎 Disease.lookup(): autocompletion of terms
🎯 Disease.search(): free text search of terms
✅ Disease.validate(): strictly validate values
🧐 Disease.inspect(): full inspection of values
👽 Disease.standardize(): convert to standardized names
🪜 Disease.diff(): difference between two versions
🔗 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... | medical condition|diseases and disorders|other... | [] |
MONDO:0000002 | obsolete 46,XX sex reversal | None | None | [] |
MONDO:0000003 | obsolete 17-hydroxysteroid dehydrogenase defic... | None | None | [] |
MONDO:0000004 | adrenocortical insufficiency | An Endocrine Or Hormonal Disorder That Occurs ... | adrenocortical insufficiency|adrenal cortical ... | [MONDO:0002816] |
MONDO:0000005 | alopecia, isolated | None | None | [MONDO:0021034] |
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 dementia|Alzheimer disease|Alzheimer's disease|presenile and senile dementia|Alzheimers disease|Alzheimer's dementia|Alzheimers 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 dementia|Alzheimer disease|Alzheimer's disease|presenile and senile dementia|Alzheimers disease|Alzheimer's dementia|Alzheimers 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-08-02__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:0000001 | experimental factor | An Experimental Factor In Array Express Which ... | ExperimentalFactor | [] | None | None | None |
EFO:0000002 | CS57511 | Cs57511 Is An Arabidopsis Thaliana Strain As D... | None | [] | None | None | None |
EFO:0000003 | CS57512 | Cs57512 Is An Arabidopsis Thaliana Strain As D... | None | [] | None | None | None |
EFO:0000004 | CS57515 | Cs57515 Is An Arabidopsis Thaliana Strain As D... | None | [] | None | None | None |
EFO:0000005 | CS57520 | Cs57520 Is An Arabidopsis Thaliana Strain As D... | None | [] | None | 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='scRNA-seq|single cell RNA sequencing|single-cell transcriptome sequencing|single-cell RNA-seq', parents=array(['EFO:0001457', 'EFO:0007832'], 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')
Comparing ontology versions#
Bionty provides bionty.Bionty.diff()
to determine a diff between two ontology versions.
disease_bt_old = bt.Disease(source="mondo", version="2023-04-04")
disease_bt_new = bt.Disease(source="mondo", version="2023-02-06")
new_entries, modified_entries = disease_bt_old.diff(disease_bt_new)
new_entries.head()
name | definition | synonyms | parents | |
---|---|---|---|---|
ontology_id | ||||
MONDO:0000001 | disease | A Disease Is A Disposition To Undergo Patholog... | disorders|medical condition|other disease|dise... | NaN |
MONDO:0000437 | cerebellar ataxia | A Neurological Syndrome Characterised By Clums... | spinocerebellar Degeneration|ataxia syndrome | NaN |
MONDO:0000476 | generalized dystonia | None | dystonia deformans progressiva|generalized iso... | NaN |
MONDO:0000866 | hereditary myoglobinuria | None | None | NaN |
MONDO:0001142 | salivary gland disorder | A Disease Involving The Saliva-Secreting Gland. | salivary gland disorder|disease of saliva-secr... | NaN |
modified_entries.head()
name | definition | synonyms | ||||
---|---|---|---|---|---|---|
self | other | self | other | self | other | |
ontology_id | ||||||
MONDO:0000001 | disease | disease or disorder | NaN | NaN | NaN | NaN |
MONDO:0000437 | NaN | NaN | NaN | NaN | spinocerebellar Degeneration|ataxia syndrome | spinocerebellar Degeneration|ataxia|ataxia syn... |
MONDO:0000476 | NaN | NaN | NaN | NaN | dystonia deformans progressiva|generalized iso... | dystonia deformans progressiva |
MONDO:0000866 | hereditary myoglobinuria | myoglobinuria | NaN | NaN | NaN | NaN |
MONDO:0001142 | NaN | NaN | NaN | NaN | salivary gland disorder|disease of saliva-secr... | salivary gland disorder|disease of saliva-secr... |