Usage
Utilities for interacting with OntoPortal.
- class AgroPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for AgroPortal.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class BioDivPortal(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for biodiversity ontologies in BioDivPortal.
Create an account and get an API key by starting at https://biodivportal.gfbio.org/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class BioPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for BioPortal.
To get an API key, follow the sign-up process at https://bioportal.bioontology.org/account.
See API documentation at https://data.bioontology.org/documentation.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class EarthPortal(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for biodiversity ontologies in EarthPortal.
Create an account and get an API key by starting at https://earthportal.eu/accounts/new.
Warning
This resource is dead
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class EcoPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for EcoPortal.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class IndustryPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for industrial ontologies in IndustryPortal.
Create an account and get an API key by starting at https://industryportal.enit.fr/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class LovPortal(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for semantic web ontologies in LovPortal.
Create an account and get an API key by starting at https://lovportal.lirmm.fr/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class MatPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for materials science ontologies in MatPortal.
Create an account and get an API key by starting at https://matportal.org/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class MedPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for medical ontologies in MedPortal.
Create an account and get an API key by starting at https://medportal.bmicc.cn/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class OntoPortalClient(api_key: str, base_url: str)[source]
A client for an OntoPortal site, like BioPortal.
Instantiate the OntoPortal client.
- Parameters:
api_key – The API key for the OntoPortal instance
base_url – The base URL for the OntoPortal instance, e.g.,
https://data.bioontology.orgfor BioPortal.
- get_json(path: str, params: dict[str, Any] | None = None, **kwargs: Any) Any[source]
Get the response JSON.
- get_response(path: str, params: dict[str, Any] | None = None, raise_for_status: bool = True, timeout: int | None = None, **kwargs: Any) Response[source]
Send a GET request the given endpoint on the OntoPortal site.
- Parameters:
path – The path to query following the base URL, e.g.,
/ontologies. If this starts with the base URL, it gets stripped.params – Parameters to pass through to
requests.get()raise_for_status – If true and the status code isn’t 200, raise an exception
timeout – A configurable timeout for sending the request
kwargs – Keyword arguments to pass through to
requests.get()
- Returns:
The response from
requests.get()
The rate limit is 15 queries per second. See: https://www.bioontology.org/wiki/Annotator_Optimizing_and_Troublehooting
- get_ontologies(summary_only: bool | None = None, notes: bool | None = None) list[dict[str, Any]][source]
Get ontologies.
- get_latest_submission(ontology: str, display: str | None = None) dict[str, Any][source]
Get the latest version of the given ontology.
- annotate(text: str, ontology: str | None = None, require_exact_match: bool = True) list[dict[str, Any]][source]
Annotate the given text.
- search(text: str, ontology: str | None = None) Iterable[dict[str, Any]][source]
Search the given text and unroll the paginated results.
- search_paginated(text: str, ontology: str | None = None, start: str = '1') Iterable[dict[str, Any]][source]
Search the given text.
- class OntoportalAstroClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for astrophysics ontologies in OntoPortal-Astro.
Create an account and get an API key by starting at https://ontoportal-astro.eu/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class PreconfiguredOntoPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for an OntoPortal site, like BioPortal.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class SIFRBioPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for French biomedical ontologies in SIFR BioPortal.
Create an account and get an API key by starting at http://bioportal.lirmm.fr/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class SocioPortal(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for sociology ontologies in SocioPortal.
Create an account and get an API key by starting at https://socioportal.org/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key
- class TechnoPortal(api_key: str | None = None, value_key: str = 'api_key')[source]
A client for engineering and technology ontologies in TechnoPortal.
Create an account and get an API key by starting at https://technoportal.hevs.ch/accounts/new.
Instantiate the OntoPortal Client.
- Parameters:
api_key –
The API key for the instance. If not given, use
pystowto read the configuration in one of the following ways. Using BioPortal as an example, where the subclass ofPreconfiguredOntoPortalClientsets the class variablename = "bioportal", the configuration can be set in the following ways:From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY
From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key
value_key – The name of the key to use. By default, uses
api_key