Extract the OBO ontology prefix from IRIs

obo_prefix(x)

Arguments

x

a list or vector of IRIs, and/or objects that have an "id" key.

Value

A character vector of the same length as the input vector or list, with NA in the positions where extracting the OBO ontology prefix failed.

Examples

tt <- c("http://purl.obolibrary.org/obo/UBERON_0011618",
        "http://purl.obolibrary.org/obo/PATO_0002279",
        "http://purl.obolibrary.org/obo/VTO_0071642",
        "http://purl.obolibrary.org/obo/MP_0030825",
        "http://purl.obolibrary.org/obo/NCBITaxon_7955")
obo_prefix(tt)
#> [1] "UBERON"    "PATO"      "VTO"       "MP"        "NCBITaxon"