Term-class: Class '"Term"'

Term-classR Documentation

Class "Term"

Description

The Term class describes an ontology term. A set of terms are instantiated as a Terms class.

Objects from the Class

Objects can be created using the term and terms functions. The latter is used with an object of class Ontology or a character describing a valid ontology prefix to download and instantiate all terms of an ontology of interest. The former takes an Ontology object (or an ontology prefix) and a term identifer to instantiate that specific term. See also the 'Methods and functions' sections.

For any given Term object, the children, parents, ancestors, descendants, partOf and derivesFrom terms can be generated and returned as Terms objects.

Terms instances can be subset with [ and [[ and iterated over with lapply.

Slots

iri:

Object of class "character" ~~

label:

Object of class "character" ~~

description:

Object of class "NullOrList" ~~

annotation:

Object of class "list" ~~

synonym:

Object of class "NullOrList" ~~

ontology_name:

Object of class "character" ~~

ontology_prefix:

Object of class "character" ~~

ontology_iri:

Object of class "character" ~~

is_obsolete:

Object of class "logical" ~~

is_defining_ontology:

Object of class "logical" ~~

has_children:

Object of class "logical" ~~

is_root:

Object of class "logical" ~~

short_form:

Object of class "character" ~~

obo_id:

Object of class "NullOrChar" ~~

links:

Object of class "list" ~~

Methods and functions

term

signature(object = "Ontology", id = "character"): ...

terms

signature(x = "Ontology", pagesize = "numeric"): ...

termDesc

signature(object = "Term"): ...

termLabel

signature(object = "Term"): ...

termPrefix

signature(object = "Term"): ...

termSynonym

signature(object = "Term"): ...

termNamespace

signature(object = "Term"): ...

termOntology

signature(object = "Term"): ...

isRoot

signature(object = "Term"): ...

isObsolete

signature(object = "Term"): ...

termId

signature(object = "Term"): ...

children

signature(object = "Term"): Returns a new Terms instance with the object's children. NULL if there are not children.

parents

signature(object = "Term"): Returns a new Terms instance with the object's parents. NULL if there are not parents.

ancestors

signature(object = "Term"): Returns a new Terms instance with the object's ancestors. NULL if there are not ancestors.

descendants

signature(object = "Term"): Returns a new Terms instance with the object's descendants. NULL if there are not descendants.

partOf

signature(object = "Term"): Returns a new Terms instance with terms the object's is a part of. NULL if none.

derivesFrom

signature(object = "Term"): Returns a new Terms instance with terms the object's is derived from. NULL if none.

show

signature(object = "Term"): ...

show

signature(object = "Terms"): ...

all.equal

signature(target = "Term", current = "Term"): ...

all.equal

signature(target = "Terms", current = "Terms"): ...

length

signature(object = "Terms"): returns the number of ontolgies described by the Terms object.

unique

signature(x = "Terms"): returns a new Terms object where all duplicated Term instances, i.e. those with the same term id (even when stemming from different ontologies), have been removed (only the first occurence is retained).

as(x, "data.fram")

Coerces a single Term or Terms 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 <lg390@cam.ac.uk>

Examples


## (all) terms
(gotrms <- terms("go", pagesize = 10000))

## Not run: 
    ## or, using on ontology object
    go <- Ontology("go")
    gotrms <- terms(go, pagesize = 10000)

## End(Not run)

as(gotrms[1:10], "data.frame") ## data,frame with 10 rows

## (one) term
(trm <- gotrms[[1]])
termPrefix(trm)
gotrms[1:3]
gotrms[["GO:0005230"]]

as(trm, "data.frame") ## data,frame with 1 row

## using an Ontology object
go <- Ontology("GO")
term(go, "GO:0032801")
## using an ontology prefix
term("GO", "GO:0032801")

isObsolete(gotrms[["GO:0005230"]])
isObsolete(gotrms[["GO:0005232"]])

isRoot(gotrms[["GO:0005230"]])
isRoot(gotrms[["GO:0005232"]])

i <- isRoot(gotrms) & !isObsolete(gotrms)
gotrms[i]
for (ii in which(i))
    show(gotrms[[ii]])

## or, directly querying the ontology
olsRoot(go)

parents(trm)
ancestors(trm)
children(trm)
descendants(trm)

partOf(gotrms[["GO:0044429"]])
partOf(term("BTO", "BTO:0000142"))

derivesFrom(term("BTO", "BTO:0002600"))
derivesFrom(term("BTO", "BTO:0001023"))


lgatto/rols documentation built on May 28, 2022, 8:24 a.m.