Learn R Programming

rols (version 2.0.2)

Ontology-class: Class "Ontology"

Description

Ontologies are stored as Ontology and Ontologies instances, and contain various information as provided by the Ontology Lookup Service.

Arguments

Objects from the Class

Objects can be created in multiple ways. The Ontologies function will initialise all available ontolgies as an Ontologies object, while a call to Ontology with an ontology namespace or prefix (but see Details section) as argument will initialise the ontology of interest as an Ontology instance.

Ontolgies instances can be subset with [ and [[ (using their namespace, see Details) and iterated over with lapply. Ontolgies can be converted into a simple data.frame containing the ontology prefixes, namespaces and titles using as(., "data.frame")). An Ontologies can also be coerced to lists of Ontology ojects with as(., "list").

Details

Ontologies are referred to by their namespace, which is lower case: the Gene Onology is "go", the Mass spectrometry ontology is "ms", etc. The ontologies also have prefixes, which are upper case: the Gene Onology prefix "GO", the Mass spectrometry ontology prefix "MS". The only exception to this rule is the Drosophila Phenotype Ontology, whose namespace and prefix are "dpo" and "FBcv" respectively. This is particularly confusing as the FlyBase Controlled Vocabulary has "fbcv" and "FBcv" as namespace and prefix respectively.

When using a character to initialise an ontology or query a term, "fbcv" (this is case insensitive) will refer to the the FlyBase Controlled Vocabulary. The the Drosophila Phenotype Ontology will have to be referred as "dpo" (also case insensitive).

Examples

Run this code
## Get all ontolgies
ol <- Ontologies()
ol

head(as(ol, "data.frame"))
length(ol)

## Individual ontologies
(go <- ol[["go"]]) 
(efo <- ol[["efo"]])

## some basic information
olsVersion(go)
olsDesc(go)
olsTitle(go)
olsPrefix(go)
olsNamespace(go)

olsRoot(go)

## works with Ontology objects or their namespace
identical(olsRoot("go"), olsRoot(go))
identical(olsVersion("go"), olsVersion(go))

## Directly initialise a single ontology
go1 <- Ontology("go") ## using the namespace (preferred)
go2 <- Ontology("GO") ## using the prefix (see Details)
all.equal(go, go1)
all.equal(go, go2)

Run the code above in your browser using DataLab