"Term"
Term-class.Rd
The Term
class describes an ontology term. A set of terms are
instantiated as a Terms
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
.
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"
~~
signature(object = "Ontology", id = "character")
:
...
signature(x = "Ontology", pagesize = "numeric")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: ...
signature(object = "Term")
: Returns a new
Terms
instance with the object
's
children. NULL
if there are not children.
signature(object = "Term")
: Returns a new
Terms
instance with the object
's
parents. NULL
if there are not parents.
signature(object = "Term")
: Returns a new
Terms
instance with the object
's
ancestors. NULL
if there are not ancestors.
signature(object = "Term")
: Returns a new
Terms
instance with the object
's
descendants. NULL
if there are not descendants.
signature(object = "Term")
: Returns a new
Terms
instance with terms the object
's is a part
of. NULL
if none.
signature(object = "Term")
: Returns a new
Terms
instance with terms the object
's is derived
from. NULL
if none.
signature(object = "Term")
: ...
signature(object = "Terms")
: ...
signature(target = "Term", current =
"Term")
: ...
signature(target = "Terms", current =
"Terms")
: ...
signature(object = "Terms")
: returns the number
of ontolgies described by the Terms
object.
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
.
## (all) terms
(gotrms <- terms("go", pagesize = 10000))
#> Warning: Internal Server Error (HTTP 500).
#> No encoding supplied: defaulting to UTF-8.
#> Object of class 'Terms' with 20000 entries
#> From the GO ontology
#> GO:0005230, GO:0015276 ... GO:0055127, GO:0055124
if (FALSE) {
## or, using on ontology object
go <- Ontology("go")
gotrms <- terms(go, pagesize = 10000)
}
as(gotrms[1:10], "data.frame") ## data,frame with 10 rows
#> id
#> GO:0005230 GO:0005230
#> GO:0015276 GO:0015276
#> GO:0005231 GO:0005231
#> GO:0005232 GO:0005232
#> NULL <NA>
#> GO:0005234 GO:0005234
#> GO:0044832 GO:0044832
#> GO:0050776 GO:0050776
#> GO:0001819 GO:0001819
#> GO:0044831 GO:0044831
#> label
#> GO:0005230 extracellular ligand-gated ion channel activity
#> GO:0015276 ligand-gated ion channel activity
#> GO:0005231 excitatory extracellular ligand-gated ion channel activity
#> GO:0005232 GO_0005232
#> NULL Thing
#> GO:0005234 extracellularly glutamate-gated ion channel activity
#> GO:0044832 induction by virus of host cytokine production
#> GO:0050776 regulation of immune response
#> GO:0001819 positive regulation of cytokine production
#> GO:0044831 modulation by virus of host cytokine production
#> description ontology is_obsolete has_children is_root first_synonym
#> GO:0005230 NA go FALSE TRUE FALSE NA
#> GO:0015276 NA go FALSE TRUE FALSE NA
#> GO:0005231 NA go FALSE TRUE FALSE NA
#> GO:0005232 NA go TRUE FALSE TRUE NA
#> NULL NA go FALSE FALSE TRUE NA
#> GO:0005234 NA go FALSE TRUE FALSE NA
#> GO:0044832 NA go FALSE FALSE FALSE NA
#> GO:0050776 NA go FALSE TRUE FALSE NA
#> GO:0001819 NA go FALSE TRUE FALSE NA
#> GO:0044831 NA go FALSE TRUE FALSE NA
#> iri is_defining_ontology
#> GO:0005230 http://purl.obolibrary.org/obo/GO_0005230 TRUE
#> GO:0015276 http://purl.obolibrary.org/obo/GO_0015276 TRUE
#> GO:0005231 http://purl.obolibrary.org/obo/GO_0005231 TRUE
#> GO:0005232 http://purl.obolibrary.org/obo/GO_0005232 TRUE
#> NULL http://www.w3.org/2002/07/owl#Thing FALSE
#> GO:0005234 http://purl.obolibrary.org/obo/GO_0005234 TRUE
#> GO:0044832 http://purl.obolibrary.org/obo/GO_0044832 TRUE
#> GO:0050776 http://purl.obolibrary.org/obo/GO_0050776 TRUE
#> GO:0001819 http://purl.obolibrary.org/obo/GO_0001819 TRUE
#> GO:0044831 http://purl.obolibrary.org/obo/GO_0044831 TRUE
## (one) term
(trm <- gotrms[[1]])
#> A Term from the GO ontology: GO:0005230
#> Label: extracellular ligand-gated ion channel activity
#> No description
termPrefix(trm)
#> [1] "GO"
gotrms[1:3]
#> Object of class 'Terms' with 3 entries
#> From the GO ontology
#> GO:0005230, GO:0015276, GO:0005231
gotrms[["GO:0005230"]]
#> A Term from the GO ontology: GO:0005230
#> Label: extracellular ligand-gated ion channel activity
#> No description
as(trm, "data.frame") ## data,frame with 1 row
#> id label description
#> 1 GO:0005230 extracellular ligand-gated ion channel activity NA
#> ontology is_obsolete has_children is_root first_synonym
#> 1 go FALSE TRUE FALSE NA
#> iri is_defining_ontology
#> 1 http://purl.obolibrary.org/obo/GO_0005230 TRUE
## using an Ontology object
go <- Ontology("GO")
term(go, "GO:0032801")
#> A Term from the GO ontology: GO:0032801
#> Label: receptor catabolic process
#> No description
## using an ontology prefix
term("GO", "GO:0032801")
#> A Term from the GO ontology: GO:0032801
#> Label: receptor catabolic process
#> No description
isObsolete(gotrms[["GO:0005230"]])
#> [1] FALSE
isObsolete(gotrms[["GO:0005232"]])
#> [1] TRUE
isRoot(gotrms[["GO:0005230"]])
#> [1] FALSE
isRoot(gotrms[["GO:0005232"]])
#> [1] TRUE
i <- isRoot(gotrms) & !isObsolete(gotrms)
gotrms[i]
#> Object of class 'Terms' with 4 entries
#> From the GO ontology
#> NULL, GO:0008150, GO:0003674, GO:0005575
for (ii in which(i))
show(gotrms[[ii]])
#> A Term from the GO ontology:
#> Label: Thing
#> No description
#> A Term from the GO ontology: GO:0008150
#> Label: biological_process
#> No description
#> A Term from the GO ontology: GO:0003674
#> Label: molecular_function
#> No description
#> A Term from the GO ontology: GO:0005575
#> Label: cellular_component
#> No description
## or, directly querying the ontology
olsRoot(go)
#> Object of class 'Terms' with 3 entries
#> From the GO ontology
#> GO:0003674, GO:0008150, GO:0005575
parents(trm)
#> Object of class 'Terms' with 1 entries
#> From the GO ontology
#> GO:0015276
ancestors(trm)
#> Object of class 'Terms' with 12 entries
#> From the GO ontology
#> GO:0015276, GO:0022834 ... GO:0015318, GO:0015075
children(trm)
#> Object of class 'Terms' with 5 entries
#> From the GO ontology
#> GO:0036081, GO:0036082 ... GO:0005237, GO:0005231
descendants(trm)
#> Object of class 'Terms' with 20 entries
#> From the GO ontology
#> GO:0005231, GO:0005234 ... GO:0036082, GO:0036081
partOf(gotrms[["GO:0044429"]])
#> No 'part of' terms.
#> NULL
partOf(term("BTO", "BTO:0000142"))
#> Object of class 'Terms' with 2 entries
#> From the BTO ontology
#> BTO:0000227, BTO:0000282
derivesFrom(term("BTO", "BTO:0002600"))
#> Object of class 'Terms' with 1 entries
#> From the BTO ontology
#> BTO:0000099
derivesFrom(term("BTO", "BTO:0001023"))
#> Object of class 'Terms' with 1 entries
#> From the BTO ontology
#> BTO:0000975