Recursive function to extract (ancestor, offspring) pairs

getAncestors(GO_IDs, onto = c("BP", "CC", "MF"))

Arguments

GO_IDs

The Gene ontology term ids

onto

The category of the GO ids. It should be one of "BP", "CC", or "MF".

Value

A data frame with columns ancestor and offspring

Examples

ids <- c(
    "GO:0099536", "GO:0099537", "GO:0007268",
    "GO:0098916", "GO:0050804", "GO:0099177"
)
df <- getAncestors(ids, onto = "BP")
head(df)
#>     ancestor  offspring
#> 1 GO:0007154 GO:0099536
#> 2 GO:0007267 GO:0099536
#> 3 GO:0008150 GO:0099536
#> 4 GO:0009987 GO:0099536
#> 5 GO:0023052 GO:0099536
#> 6 GO:0050789 GO:0099536