Get Parent GO terms of GO term vector?
To answer @RickBeeloo's comment above I decided to include an answer with some detailed code. Basically to obtain the ancestors of any Gene Ontology (GO) term using the Bioconductor package GO.db we need a call to the AnnDbBimap object for the adequate ontology. For example if we want it for Molecular Function (MF) we would use GOMFANCESTOR like in the example:

library(GO.db)

terms &lt;- c("GO:0008022","GO:0001071")
as.list(GOMFANCESTOR[terms])

$`GO:0008022`
[1] "GO:0005515" "GO:0003674" "GO:0005488" "all"       

$`GO:0001071`
[1] "GO:0003674" "all"       


Similar objects can be used for Biological process (BP) and Cellular compartment (CC): GOBPANCESTOR and GOCCANCESTOR. The only limiation is that you cannot mix terms from different ontologies (i.e. all BP, MF or CC). There are similar options to obtain the children of any given GO term (e.g. GOCCCHILDREN). The description of each term can be obtained with:

Term(GOTERM[terms])
                   GO:0008022                                           GO:0001071 
 "protein C-terminus binding" "nucleic acid binding transcription factor activity" 


All available mappings can be listed calling GO():

GO()

Quality control information for GO:


This package has the following mappings:

GOBPANCESTOR has 28477 mapped keys (of 28477 keys)
GOBPCHILDREN has 16829 mapped keys (of 28477 keys)
GOBPOFFSPRING has 16829 mapped keys (of 28477 keys)
GOBPPARENTS has 28477 mapped keys (of 28477 keys)
GOCCANCESTOR has 3897 mapped keys (of 3897 keys)
GOCCCHILDREN has 1317 mapped keys (of 3897 keys)
GOCCOFFSPRING has 1317 mapped keys (of 3897 keys)
GOCCPARENTS has 3897 mapped keys (of 3897 keys)
GOMFANCESTOR has 10021 mapped keys (of 10021 keys)
GOMFCHILDREN has 2046 mapped keys (of 10021 keys)
GOMFOFFSPRING has 2046 mapped keys (of 10021 keys)
GOMFPARENTS has 10021 mapped keys (of 10021 keys)
GOOBSOLETE has 2012 mapped keys (of 2012 keys)
GOTERM has 42396 mapped keys (of 42396 keys)


Additional Information about this package:

DB schema: GO_DB
DB schema version: 2.1
Date for GO data: 20160305