accessProperty: Access Properties

View source: R/accessProperty.R

accessPropertyR Documentation

Access Properties

Description

Function to access the CEDAR properties suite.

Usage

accessProperty(
  api.key,
  ontology,
  id = NA_character_,
  sub = NA_character_,
  output.mode = "content"
)

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. Name of the ontology to query properties from.

id

character. Either NA to list properties, "roots" to get the root properties of the ontology or a property ID (at URL format), to find a precise property.

sub

character. Either NA to get the precise property alone, or one among "tree", "children", "descendants", "parents" to get related properties according to this value. Not evaluated if id is set to NA or "roots".

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")

Details

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

  • /ontologies/{ontology}/properties

  • /ontologies/{ontology}/properties/roots

  • /ontologies/{ontology}/properties/{id}

  • /ontologies/{ontology}/properties/{id}/tree

  • /ontologies/{ontology}/properties/{id}/children

  • /ontologies/{ontology}/properties/{id}/descendants

  • /ontologies/{ontology}/properties/{id}/parents

These differents requests are differenciated by the id and sub arguments.

Value

  • If no property ID is provided: list all of the properties, or all the ontology's root properties if sub = "roots".

  • If a property ID is provided: an entry for the corresponding property, or the roots properties if sub = "tree", the properties defined at the level under the target property if sub = "children", the lowest properties defined under the target property if sub = "descendants" or the properties defined previously to the one targeted if sub = "parents".

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()

# Query 1: list the roots properties in ENVO

result1 <- cedarr::accessProperty(
  my.api.key,
  "ENVO",
  id = "roots",
  sub = "smurf" # ignored
)

View(result1)


# Query 2: get the parents properties for "alternative term" in ENVO

result2 <- cedarr::accessProperty(
  my.api.key,
  "ENVO",
  id = "http://purl.obolibrary.org/obo/IAO_0000118",
  sub = "parents"
)

View(result2)

## End(Not run)


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