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

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

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

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

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

children(object)

parents(object)

ancestors(object)

descendants(object)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

# S4 method for class 'olsTerms'
[(x, i, j = "missing", drop = "missing")

# S4 method for class 'olsTerms'
[[(x, i, j = "missing", drop = "missing")

# S4 method for class '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.

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`.

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>

Author

Laurent Gatto

Examples


## Alzheimer's Disease Ontology (ADO)
(adoterms <- olsTerms('ado'))
#> ⠙ Iterating 1 done (0.16/s) | 6.4s
#> ⠹ Iterating 2 done (0.21/s) | 9.5s
#> Object of class 'olsTerms' with 1963 entries
#>  From the ADO ontology
#>   OGG:3000002185, OGG:3000002222 ... OGG:3000002081, OGG:3000002099 

## Focus on squamous epithelium
(trm <- adoterms[["UBERON:0006914"]])
#> A olsTerm from the ADO ontology: UBERON:0006914 
#>  Label: squamous epithelium
#>   An epithelium characterised by its most superficial layer consisting of
#>   squamous epithelial cells.

## Accessors
termLabel(trm)
#> [1] "squamous epithelium"
head(termLabel(adoterms))
#> OGG:3000002185 OGG:3000002222 OGG:3000002224 OGG:3000002308 OGG:3000002332 
#>        "PTK2B"        "FDFT1"         "FDPS"        "FOXO1"         "FMR1" 
#> OGG:3000002339 
#>         "FNTA" 
termId(trm)
#> [1] "UBERON:0006914"
termDesc(trm)
#> [1] "An epithelium characterised by its most superficial layer consisting of squamous epithelial cells."
termOntology(trm)
#> [1] "ado"
termNamespace(trm)
#> [1] "uberon"
termSynonym(trm) ## none
#> NULL

## Related terms
children(trm)
#> Object of class 'olsTerms' with 1 entries
#>  From the ADO ontology
#> UBERON:0000487 
descendants(trm) ## includes child
#> Object of class 'olsTerms' with 2 entries
#>  From the ADO ontology
#> UBERON:0000487, UBERON:0001986 

parents(trm)
#> Object of class 'olsTerms' with 1 entries
#>  From the ADO ontology
#> UBERON:0000483 
ancestors(trm) ## includes parent
#> Object of class 'olsTerms' with 10 entries
#>  From the ADO ontology
#>   UBERON:0000483, UBERON:0000479 ... BFO:0000001, UBERON:0001062 

## A single term from an ontology
olsTerm("ado", "ADO:0000090")
#> A olsTerm from the ADO ontology: ADO:0000090 
#>  Label: total tau
#>   A protein that is regarded as a general marker of neurodegeneration for
#>   evaluation in future population-based studies and represents the total
#>   tau concentration in a given sample.