I am trying to obtain a mapping for RefSeq Accession Numbers to Uniprot Accession Numbers.

I can write a script to do this for a list of RefSeq ACs like this:


Derived from:

import urllib
import urllib2

url = 'http://www.uniprot.org/mapping/'

params = {
    'query':'NP_511114.2 NP_004295.2 NP_031465.2 XP_004934106.1',

data = urllib.urlencode(params)
request = urllib2.Request(url, data)

# Please set your email address here to help us debug in case of problems.
contact = "email@example.com"
request.add_header('User-Agent', 'Python %s' % contact)
response = urllib2.urlopen(request)
page = response.read(200000)
print page

I am curious if there is a way to request the entire mapping of human genes to proteins.

I have tried to configure a query from the Uniprot resources, but I can't see how to get RefSeq data from this tool.


I am happy to use a resource other than Uniprot.

  • $\begingroup$ You can use BioMart. Have a look at this answer. $\endgroup$
    Feb 11, 2016 at 3:46

1 Answer 1


You have a bunch of options:

  1. You can use Biomart. Biomart is a standalone tool, but also have a pyton and R libraries. So it gives you more options depending on your preferred programming language. This is a widely used tool and in general works well.

  2. Use a python library called pyEntrezID https://pypi.python.org/pypi/pyEntrezId/1.4.7 You can do all sort of conversions of ids, however I've never tried it.

  3. You can try NCBI eutils or one of the Ensembl REST API endpoints


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.