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}.to_pronto()
import bionty.base 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
public = bt.Disease()
public
PublicOntology
Entity: Disease
Organism: all
Source: mondo, 2024-06-04
#terms: 28029
public.df().head()
name | definition | synonyms | parents | |
---|---|---|---|---|
ontology_id | ||||
MONDO:0000001 | disease | A Disease Is A Disposition To Undergo Patholog... | disease or disorder, non-neoplastic|disease or... | [] |
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 ... | corticoadrenal insufficiency|adrenocortical in... | [MONDO:0002816] |
MONDO:0000005 | alopecia, isolated | None | None | [MONDO:0100118, MONDO:0004907] |
lookup = public.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="Alzheimers disease|Alzheimer's dementia|Alzheimer's disease|Alzheimers dementia|AD|presenile and senile dementia|Alzheimer dementia|Alzheimer disease", 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
"Alzheimers disease|Alzheimer's dementia|Alzheimer's disease|Alzheimers dementia|AD|presenile and senile dementia|Alzheimer dementia|Alzheimer disease"
Parents with distance=1 can be directly accessed:
lookup_record.parents
array(['MONDO:0001627', 'MONDO:0005574'], dtype=object)
.to_pronto()
: Pronto Ontology露
More hierarchical information can be accessed from the Pronto Ontology object:
pronto_object = public.to_pronto()
馃挕 downloading Disease ontology source file...
馃挕 downloading Disease source file from: http://purl.obolibrary.org/obo/mondo/releases/2024-06-04/mondo.owl
pronto_object
Ontology('/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/bionty/base/_dynamic/ontology_all__mondo__2024-06-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
public = bt.ExperimentalFactor()
public.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 = public.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 RNA-seq|single-cell transcriptome sequencing', 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.base.PublicOntology.diff()
to determine a diff between two ontology versions.
disease_old = bt.Disease(source="mondo", version="2023-04-04")
disease_new = bt.Disease(source="mondo", version="2023-02-06")
new_entries, modified_entries = disease_old.diff(disease_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... |