View source: R/accessProperty.R
accessProperty | R Documentation |
Function to access the CEDAR properties suite.
accessProperty( api.key, ontology, id = NA_character_, sub = NA_character_, output.mode = "content" )
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 |
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") |
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.
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.