Overview

This vignette demonstrates how to easily use the topOnto.HDO.db package. The topOnto.HDO.db package is use to represent an ontology. Terms in ontology are organized in Directed Acyclic Graph (DAG) that represent the content through Bimap object. To start with, type following code below:

library(topOnto.HDO.db)
help(topOnto.HDO.db)

Fetch terms

In topOnto.HDO.db, ONTTermsAnnDbBimap object(a sub-class of Bimap) ONTTERM represet the whole terms. Meanwhile a class named ONTTerms represents with six slots. Six S4 methods ID,Definition,Ontology,Term,Synonym,Secondary are defned in topOnto.HDO.db to fetch the corresponding attribute for a term node, they can work on ONTTermsAnnDbBimap, ONTTerms and character classes.

Here is an example of how to use these objects and functions, it fetchs the first 10 records and turn them to list object, then use the four S4 methods to fetch the corresponding attribute. Here is the code and result:

FirstTenBimap <- ONTTERM[1:10]
class(FirstTenBimap)
xx <- as.list(FirstTenBimap)
ID(xx[[2]])
Definition(xx[[2]])
Ontology(xx[[2]])
Term(xx[[2]])
Synonym(xx[[2]])
Secondary(xx[[2]])

Fetch the relationship between DO terms

In this section, we will introduce four Bimap objects which represent relationship between ontology terms. There are ONTANCESTOR,ONTPARENTS,ONTOFFSPRING and ONTCHILDREN . we will introduce them in the following sub-sections.

ONTANCESTOR

This data set describes associations between terms and their ancestor terms, based on the directed acyclic graph (DAG) defned by the ontology. The format is an R object mapping the ontology terms to all ancestor terms, where an ancestor term is a more general term that precedes the given term in the DAG (in other words, the parents, and all their parents, etc.). For example, to fetch all the ONTANCESTOR in a list object and display the first 4 terms' ancestors, here is the code:

xx <- as.list(ONTANCESTOR)
xx <- xx[!is.na(xx)]
xx[1:4]

ONTPARENTS

This data set describes associations between terms and their direct parent terms,based on the directed acyclic graph (DAG) defned by the ontology. The format is an R object mapping the ontology terms to all direct parent terms, where a direct parent term is a more general term that immediately precedes the given term in the DAG. For example, to fetch all the ONTPARENTS in a list object and display the first 4 terms' parents, here is the code:

xx <- as.list(ONTPARENTS)
xx <- xx[!is.na(xx)]
xx[1:4]

ONTOFFSPRING

This data set describes associations between terms and their offspring terms, based on the directed acyclic graph (DAG) defned by the ontology. The format is an R object mapping the ontology terms to all offspring terms, where an ancestor term is a more specific term that is preceded by the given term in the DAG (in other words, the children and all their children, etc.). For example, to fetch all the ONTOFFSPRING in a list object and display the first terms' offsprings, here is the code:

xx <- as.list(ONTOFFSPRING)
xx <- xx[!is.na(xx)]
xx[1:4]

ONTCHILDREN

This data set describes associations between terms and their direct children terms, based on the directed acyclic graph (DAG) defned by the ontology. The format is an R object mapping the terms to all direct children terms, where a direct child term is a more specific term that is immediately preceded by the given term in the DAG. For example, to fetch all the ONTCHILDREN in a list object and display the first 4 terms' children, here is the code:

xx <- as.list(ONTCHILDREN)
xx <- xx[!is.na(xx)]
xx[1:4]

Others

In this section, we will introduce the schema of database and number of mapped keys for the maps in topOnto.HDO.db. To get the schema, type following:

ONT_dbschema()

And to get the number of mapped keys for the maps in the database, type following:

ONTMAPCOUNTS


hxin/topOnto documentation built on May 17, 2019, 9:15 p.m.