What is the best way to convert uniprot accessions to entrez gene identifiers?
What is the best way to reverse the map org.Hs.eg.db::org.Hs.egUNIPROT ?
Is there any better approach (a pity there is no 'org.Hs.uniprot.db' package)?
What is the best way to convert uniprot accessions to entrez gene identifiers?
What is the best way to reverse the map org.Hs.eg.db::org.Hs.egUNIPROT ?
Is there any better approach (a pity there is no 'org.Hs.uniprot.db' package)?
You could either use the UniProt.ws package, or as you note, you could use the org.Hs.eg.db package. But you don't have to reverse any maps, as the BiMap interface is simply an artifact of a bygone era. These days the cool kids use select()
.
> uniprots <- Rkeys(org.Hs.egUNIPROT)[1:5] > select(org.Hs.eg.db, uniprots, "ENTREZID", "UNIPROT") UNIPROT ENTREZID 1 P04217 1 2 V9HWD8 1 3 P01023 2 4 P18440 9 5 Q400J6 9
OR UniProt
> library(UniProt.ws) Loading required package: RCurl Loading required package: bitops > up <- UniProt.ws(taxId=9606) > select(up, uniprots, "ENTREZ_GENE") Getting mapping data for P04217 ... and P_ENTREZGENEID UNIPROTKB ENTREZ_GENE 1 P04217 1 2 V9HWD8 1 3 P01023 2 4 P18440 9 5 Q400J6 9 >
The org.Hs.eg.db package is just a wrapper to allow easy interrogation of an underlying SQLite database. So if you need that package specifically, then I would just put it in your Depends field.
You should note that select() will return duplicates for any one-to-many mappings. So as an example, say you have a UniProt ID that maps to two Entrez Gene IDs (this may or may not occur - I haven't checked). In that situation you will return a data.frame like
UNIPROT ENTREZID P12345 23434 P12345 321234
And if you are naive about things, and expect just one Entrez ID to be returned, then you will have problems. If you are just mapping from one ID to another, you can use mapIds()
, with multiVals = "first". Or something different, depending on how you want to do things. But that is an easy way to control for one-to-many mappings.
And back to the question at hand, if you are only using select()
or mapIds()
, then you can just importFrom, rather than importing the whole namespace.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Just discovered revmap()
revmap()
is part of the old BiMap interface. You will be better served usingselect()
.