TermController API Wrapper
OntologyLookup.TermController.get_hierarchical_parent
— Methodget_hierarchical_parent(term::Term; preferred_parent::Union{Missing,Term}=missing)
Fetches the hierarchical parent of a given term.
Arguments
term::Term
: The term for which to fetch the hierarchical parent.preferred_parent::Union{Missing,Term}
(optional): The preferred parent term to be returned, if multiple parents are found.encode_iri::Bool
(optional): Whether to encode the IRI before making the request. Default istrue
since IRI are usually stored non-encode in Term struct.
Returns
- If a single parent is found, returns the hierarchical parent as a
Term
object. - If multiple parents are found and a preferred parent is specified, returns the preferred parent as a
Term
object. - If multiple parents are found and no preferred parent is specified, returns the first parent as a
Term
object. - If an error occurs while fetching the parents, returns
missing
.
OntologyLookup.TermController.get_parents
— Methodget_parents(term::Term)
Fetches the parent terms for a given term.
Arguments
term::Term
: The term for which to fetch the parent terms.encode_iri::Bool
(optional): Whether to encode the IRI before making the request. Default istrue
since IRI are usually stored non-encode in Term struct.
Returns
An array of Term
objects representing the parent terms of the given term, or missing
if an error occurs.
OntologyLookup.TermController.onto_term
— Methodonto_term(ontogy_id::AbstractString, iri::AbstractString; [lang="en", encode_iri=true])
Fetches the term information from the specified ontology using the given IRI.
Arguments
ontogy_id::AbstractString
: The name of the ontology.iri::AbstractString
: The IRI (Internationalized Resource Identifier) of the term.lang::AbstractString
: (optional) The language code for the term description. Default is "en".encode_iri::Bool
(optional): Whether to encode the IRI before making the request. Default istrue
.
Returns
- If the term is found, returns a
Term
object containing the term information. - If there is an error fetching the term, a warning is issued and
missing
is returned.
OntologyLookup.TermController.onto_terms
— Methodonto_terms(ontogy_id::AbstractString;
[id::AbstractString="",
iri::AbstractString="",
short_from::AbstractString="",
obo_id="",
obsoletes::Bool=false,
lang::AbstractString="en"])
Fetches ontology terms from the OLS API based on the specified parameters.
Arguments
ontogy_id::AbstractString
: The name of the ontology to fetch terms from.id::AbstractString
: (optional) The ID of the term.iri::AbstractString
: (optional) The IRI of the term.short_from::AbstractString
: (optional) The short form of the term.obo_id
: (optional) The OBO ID of the term.obsoletes::Bool
: (optional) Whether to include obsoleted terms. Default isfalse
.lang::AbstractString
: (optional) The language of the term. Default is"en"
.
Returns
A dictionary of terms, where the keys are the OBO IDs of the terms and the values are Term
objects.