Let's start with a mapping of Ensembl gene identifiers to Entrez gene identifiers:
xs <- structure(
c("7105", "64102", "9093", "9093"),
.Names = c("ENSG00000000003", "ENSG00000000005", "ENSG00000103423", "ENSG00000276726")
)
xsENSG00000000003 ENSG00000000005 ENSG00000103423 ENSG00000276726
"7105" "64102" "9093" "9093"
Here's a common way to reverse the mapping. Notice that we have two items with the same name:
rxs <- names(xs)
names(rxs) <- xs
rxs 7105 64102 9093 9093
"ENSG00000000003" "ENSG00000000005" "ENSG00000103423" "ENSG00000276726"
class(rxs)[1] "character"
If we use the reverseSplit() function from BioBase, we get a slightly different result:
reverseSplit(xs)$`64102`
[1] "ENSG00000000005"
$`7105`
[1] "ENSG00000000003"
$`9093`
[1] "ENSG00000103423" "ENSG00000276726"
class(reverseSplit(xs))[1] "list"