accessOntology: Access Ontologies

View source: R/accessOntology.R

accessOntologyR Documentation

Access Ontologies

Description

Access ontologies by id and list their content.

Usage

accessOntology(
  api.key,
  ontology = NA_character_,
  item = NA_character_,
  sub = NA_character_,
  output.mode = "content",
  page.index = 1,
  page.size = 50
)

Arguments

api.key

character. An API Key is required to access any API call. It is used within cedarr as a header for http requests. An API key is linked to a CEDAR account (https://cedar.metadatacenter.org/profile)

ontology

character. Ontology name to display. In this context, ontology can be set to NA: this will list all the ontologies registered in CEDAR.

item

character. What ontology items shall be retrieved: none, its classes or its properties? (resp. NA, "classes" or "properties")

sub

character. At which level item shall be fetched: all or only root? (resp. NA or "roots"). This parameter will only be evaluated if item is filled.

output.mode

character. "full" will return the whole response object (from httr) or "content" will fetch the interest values from the response object. Getting the whole object might be interesting to have a look at system metadata, or in case of error to debug the connection. (defaults to "content")

page.index

integer. Index of the page to be returned (defaults to 1st page).

page.size

integer. Number of results per page, capped at 50. (defaults to 50).

Details

This function matches the following queries from the Swagger UI (https://terminology.metadatacenter.org/api/#/):

  • /ontologies

  • /ontologies/{ontology}

  • /ontologies/{ontology}/classes

  • /ontologies/{ontology}/classes/roots

  • /ontologies/{ontology}/properties

  • /ontologies/{ontology}/properties/roots

These differents requests are differenciated by the item and sub arguments. The requests for item = "properties" are identical to some available in accessProperty().

Value

  • If no ontology ID is provided: returns a list of all ontologies registered in CEDAR.

  • If an ontology ID is provided: returns an entry for this ontology.

  • If an ontology ID is provided with item = "classes": returns either a list of the classes in this ontology, or at the root of this ontology if provided with sub = "roots".

  • If an ontology ID is provided with item = "properties": returns either a list of the properties in this ontology, or at the root of this ontology if provided with sub = "roots".

If output.mode = "full", the whole http response object (see httr::response). It is structured as a list with response metadata wrapping the content item which contains the wanted result.

If output.mode = "content", the content item is directly returned, containing database metadata and the interesting information in the collection subitem.

Examples

## Not run: 
my.api.key <- readline()

# Find the root classes of ENVO
result <- cedarr::accessOntology(
  my.api.key,
  "ENVO",
  item = "classes",
  sub = "roots"
)

View(result)

## End(Not run)


earnaud/cedarr documentation built on Oct. 25, 2022, 6:27 a.m.