Recursive function to extract (ancestor, offspring) pairs
getAncestors(GO_IDs, onto = c("BP", "CC", "MF"))A data frame with columns ancestor and offspring
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