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:
#!/usr/bin/python
"""
Derived from:
http://www.uniprot.org/help/programmatic_access#id_mapping_python_example
"""
import urllib
import urllib2
url = 'http://www.uniprot.org/mapping/'
params = {
'from':'P_REFSEQ_AC',
'to':'ACC',
'format':'tab',
'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.
http://www.uniprot.org/uniprot/?query=reviewed:yes+AND+organism:9606#customize-columns
I am happy to use a resource other than Uniprot.