olsTerms: Ontology Terms

olsTermsR Documentation

Ontology Terms

Description

The 'olsTerm' class describes an ontology term. A set of terms are instantiated as a 'olsTerms' class.

Usage

## S4 method for signature 'character'
olsTerms(object, pagesize = 1000, obsolete = NULL)

## S4 method for signature 'olsOntology'
olsTerms(object, pagesize = 1000, obsolete = NULL)

## S4 method for signature 'character'
olsTerm(object, id)

## S4 method for signature 'olsOntology'
olsTerm(object, id)

children(object)

parents(object)

ancestors(object)

descendants(object)

## S4 method for signature 'olsTerm'
show(object)

## S4 method for signature 'olsTerms'
show(object)

## S4 method for signature 'olsTerm'
termSynonym(object)

## S4 method for signature 'olsTerms'
termSynonym(object)

## S4 method for signature 'olsTerm'
isObsolete(object)

## S4 method for signature 'olsTerms'
isObsolete(object)

## S4 method for signature 'olsTerm'
isRoot(object)

## S4 method for signature 'olsTerms'
isRoot(object)

## S4 method for signature 'olsTerm'
termLabel(object)

## S4 method for signature 'olsTerms'
termLabel(object)

## S4 method for signature 'olsTerm'
termId(object)

## S4 method for signature 'olsTerms'
termId(object)

## S4 method for signature 'olsTerm'
termLinks(object)

## S4 method for signature 'olsTerm'
termPrefix(object)

## S4 method for signature 'olsTerms'
termPrefix(object)

## S4 method for signature 'olsTerm'
termDesc(object)

## S4 method for signature 'olsTerms'
termDesc(object)

## S4 method for signature 'olsTerm'
termOntology(object)

## S4 method for signature 'olsTerms'
termOntology(object)

## S4 method for signature 'olsTerm'
termNamespace(object)

## S4 method for signature 'olsTerms'
termNamespace(object)

## S4 method for signature 'olsTerms'
length(x)

## S4 method for signature 'olsTerms'
unique(x)

## S4 method for signature 'olsTerms'
x[i, j = "missing", drop = "missing"]

## S4 method for signature 'olsTerms'
x[[i, j = "missing", drop = "missing"]]

## S4 method for signature 'olsTerms'
lapply(X, FUN, ...)

as.olsTerm.data.frame(x)

as.olsTerms.data.frame(x)

Arguments

object

generally an instance of class 'olsTerms' or 'olsTerm'. In some cases, an ontology identifier is applicable.

pagesize

'numeric(1)', converted to an integer, defining the response page size. Default is 1000.

obsolete

'NULL' or 'logical(1)' defining whether obsolete terms ('TRUE'), current terms ('FALSE') or all ('NULL', default) should be returned.

id

‘character(1)' with the term’s identifier.

x

a 'olsTerms' object.

i

index of elecements to subset.

j

ignored.

drop

ignored.

X

'olsTerms' object.

FUN

a 'function' to be applied to each 'olsTerm' element of 'X'.

...

additional arguments passed to 'FUN'.

Contructors

Objects can be created using the 'olsTerm()' and 'olsTerms()' constructers. The latter is used with an object of class 'olsOntology' or a 'character' describing a valid ontology prefix to download and instantiate all terms of an ontology of interest. The former takes an 'olsOntology' object (or an ontology prefix) and a term identifer to instantiate that specific term.

For any given 'olsTerm' object, the 'children', 'parents', 'ancestors' and 'descendants' terms can be generated with the 'children()', 'parents()', 'ancestor()' and 'descendants()' function. 'olsTerms' instances can be subset with '[' and '[[' and iterated over with 'lapply'.

Accessors

- 'isObsolete(object = "olsTerm")' returns a 'TRUE' if the term is obsolete, 'FALSE' otherwise. Also works on 'olsTerms' instances.

- 'isRoot(object = "olsTerm")' returns a 'TRUE' if the term is a root term, 'FALSE' otherwise. Also works on 'olsTerms' instances.

- 'termDesc(object = "olsTerm")' returns a 'character' with the term's description. Also works on 'olsTerms' instances.

- ‘termId(object = "olsTerm")' returns a 'character' with the term’s identifier. Also works on 'olsTerms' instances.

- 'termLabel(object = "olsTerm")' returns a 'character' with the term's label. Also works on 'olsTerms' instances.

- 'termNamespace(object = "olsTerm")' returns a 'character' with the term's namespace. Also works on 'olsTerms' instances.

- 'termOntology(object = "olsTerm")' returns a 'character' with the term's ontology (where it was retrieved from). Also works on 'olsTerms' instances.

- 'termPrefix(object = "olsTerm")' returns a 'character' with the term's (ontology) prefix (where it was retrieved from). Also works on 'olsTerms' instances.

- 'termSynonym(object = "olsTerm")' returns a 'character' with the term's synpnym(s). Also works on 'olsTerms' instances.

- 'termLinks(object = "olsTerm")' returns a named 'character' with hyperlink to/from the term.

Related terms

- 'children(object = "olsTerm")' returns a new 'olsTerms' instance with the ‘object'’s children or 'NULL' if there are no children.

- 'parents(object = "olsTerm")' returns a new 'olsTerms' instance with the ‘object'’s parents or 'NULL' if there are no parents.

- 'ancestors(object = "olsTerm")' returns a new 'olsTerms' instance with the ‘object'’s ancestors or 'NULL' if there are no ancestors.

- 'descendants(object = "olsTerm")' returns a new 'olsTerms' instance with the ‘object'’s descendants or 'NULL' if there are no descendants.

Coercion

- 'as(x, "data.fram")' coerces a 'olsTerm' or 'olsTerms' instance into a 'data.frame' of length 1 (for the former) or length 'length(x)' for the latter. The result will contain the following columns: id, label, description of the term(s), their ontology, whether they are obsolete, have children or are root node, the first synonym only, their iri and whether they are defining the ontology. Any missing value will be reported as 'NA'.

Author(s)

Laurent Gatto

References

- OLS3 API (the OLS4 API should function identically to the OLS3): <http://www.ebi.ac.uk/ols4/ols3help>

- REST API for OLS: <https://www.ebi.ac.uk/ols4/swagger-ui/index.html>

Examples


## Alzheimer's Disease Ontology (ADO)
(adoterms <- olsTerms('ado'))

## Focus on squamous epithelium
(trm <- adoterms[["UBERON:0006914"]])

## Accessors
termLabel(trm)
head(termLabel(adoterms))
termId(trm)
termDesc(trm)
termOntology(trm)
termNamespace(trm)
termSynonym(trm) ## none

## Related terms
children(trm)
descendants(trm) ## includes child

parents(trm)
ancestors(trm) ## includes parent

## A single term from an ontology
olsTerm("ado", "ADO:0000090")

lgatto/rols documentation built on April 29, 2024, 12:20 p.m.