Learn R Programming

rols (version 2.0.2)

Term-class: Class "Term"

Description

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

Arguments

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.

Examples

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

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

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


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

isObsolete(gotrms[["GO:0030533"]])
isObsolete(gotrms[["GO:0005563"]])

isRoot(gotrms[["GO:0030533"]])

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:0008308"]])
partOf(term("BTO", "BTO:0000142"))

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

Run the code above in your browser using DataLab