Converts GO identifiers to/from GO terms, either explicitly or by checking if (any items in) the input contains "GO:".

goIdToTerm(x, names = TRUE, keepNA = TRUE)

goTermToId(x, names = TRUE, keepNA = TRUE)

flipGoTermId(x, names = TRUE, keepNA = TRUE)

prettyGoTermId(x)

Arguments

x

A character of GO ids or terms.

names

Should a named character be returned? Default is TRUE.

keepNA

Should any GO term/id names that are missing or obsolete be replaced with a NA? Default is TRUE. If FALSE then the GO term/id names is kept.

Value

A character of GO terms (ids) if x were ids (terms).

Author

Laurent Gatto

Examples

goIdToTerm("GO:0000001")
#>                  GO:0000001 
#> "mitochondrion inheritance" 
goIdToTerm("GO:0000001", names = FALSE)
#> [1] "mitochondrion inheritance"
goIdToTerm(c("GO:0000001", "novalid"))
#>                  GO:0000001                     novalid 
#> "mitochondrion inheritance"                          NA 
goIdToTerm(c("GO:0000001", "GO:0000002", "notvalid"))
#>                         GO:0000001                         GO:0000002 
#>        "mitochondrion inheritance" "mitochondrial genome maintenance" 
#>                           notvalid 
#>                                 NA 
goTermToId("mitochondrion inheritance")
#> mitochondrion inheritance 
#>              "GO:0000001" 
goTermToId("mitochondrion inheritance", name = FALSE)
#> [1] "GO:0000001"
goTermToId(c("mitochondrion inheritance", "notvalid"))
#> mitochondrion inheritance                  notvalid 
#>              "GO:0000001"                        NA 
prettyGoTermId("mitochondrion inheritance")
#> [1] "mitochondrion inheritance (GO:0000001)"
prettyGoTermId("GO:0000001")
#> [1] "mitochondrion inheritance (GO:0000001)"
flipGoTermId("mitochondrion inheritance")
#> mitochondrion inheritance 
#>              "GO:0000001" 
flipGoTermId("GO:0000001")
#>                  GO:0000001 
#> "mitochondrion inheritance" 
flipGoTermId("GO:0000001", names = FALSE)
#> [1] "mitochondrion inheritance"