ontology_index: Create 'ontology_index' object from vectors and lists of term...

Description Usage Arguments Examples

View source: R/data.R

Description

Create ontology_index object from vectors and lists of term properties

Usage

1
2
3
4
5
6
7
8
ontology_index(
  parents,
  id = names(parents),
  name = id,
  obsolete = setNames(nm = id, rep(FALSE, length(id))),
  version = NULL,
  ...
)

Arguments

parents

List of character vectors of parents per term.

id

Character vector of term IDs. Defaults to the "names" attribute of the parents argument and must be the same length as parents.

name

Character vector of term labels.

obsolete

Logical vector indicating whether given terms are obsolete.

version

Version information about the ontology.

...

Additional arguments, each of which should be either a vector or list of term properties, each with the same length as id.

Examples

1
2
3
animal_superclasses <- list(animal=character(0), mammal="animal", cat="mammal", fish="animal")
animal_ontology <- ontology_index(parents=animal_superclasses)
unclass(animal_ontology)

Example output

$id
  animal   mammal      cat     fish 
"animal" "mammal"    "cat"   "fish" 

$name
  animal   mammal      cat     fish 
"animal" "mammal"    "cat"   "fish" 

$parents
$parents$animal
character(0)

$parents$mammal
[1] "animal"

$parents$cat
[1] "mammal"

$parents$fish
[1] "animal"


$children
$children$animal
[1] "mammal" "fish"  

$children$mammal
[1] "cat"

$children$cat
character(0)

$children$fish
character(0)


$ancestors
$ancestors$animal
[1] "animal"

$ancestors$mammal
[1] "animal" "mammal"

$ancestors$cat
[1] "animal" "mammal" "cat"   

$ancestors$fish
[1] "animal" "fish"  


$obsolete
animal mammal    cat   fish 
 FALSE  FALSE  FALSE  FALSE 

ontologyIndex documentation built on Feb. 4, 2021, 1:06 a.m.