I have a protein refseq (eg, NP_000029). How can I get the corresponding gene ID (ag, APC) from NCBI using an R package?
$\begingroup$ Hi @ElizaGanguly Is efetch not appropriate here? $\endgroup$– M__ ♦Dec 4, 2020 at 15:32
You can do this with the reutils package, which provides an API to NCBI's E-utilities. Here's an example for your specific question:
install.packages("reutils") library(reutils) # Get universal identifier uid <- esearch("NP_000029", db = "gene") # Fetch summary sm <- esummary(uid, db = "gene") # Extract specific tag sm$xmlValue("//Name")