[Python] Uniprot Id To Gene Name
2
8
Entering edit mode
13.6 years ago
Yo_O ▴ 130

Hi, I've got a huge list of Uniprot IDs and I want to get the matching gene names. Do you know how to do that in python ? (I'm currently searching with Biopython...) Thanks !

Yo.

uniprot biopython python • 19k views
ADD COMMENT
1
Entering edit mode

See related post here.

ADD REPLY
3
Entering edit mode
13.6 years ago
Jerven ▴ 660

You can do this using the retrieve function at www.uniprot.org (4th tab element in the top bar)

Upload your list of ID's.

Look for the small blue UniProtKB (number of retrieved) entries link. Click this. Then use the customize display to select only gene names. Then click download as tab.

Ok, not very pythonic, but a few http calls from python would work.

ADD COMMENT
1
Entering edit mode
13.6 years ago
Chris ★ 1.6k

Perhaps sth like this:

for record in SwissProt.parse(open('uniprot_sprot.dat')):
  accessions = record.accessions
  gene_name = record.gene_name

Chris

ADD COMMENT
1
Entering edit mode

Well, my code snippet was rather meant as an inspiration of how to access the uniprot_id and corresponding gene_name from swissprot. Once you have that mapping (e.g. as a dictionary) it should be easy to do the mapping from that to your problem setting.

ADD REPLY
1
Entering edit mode

Yep. I got what I wanted with this :

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

query=uniprot_id params = {'from':'ACC','to':'ENSEMBL_ID','format':'tab','query':query} data = urllib.urlencode(params) request = urllib2.Request(url, data) response = urllib2.urlopen(request) page = response.read(200000)

Then I've got an homemade dictionary id_Ensembl <-> geneName

Thanks a lot for your answers guys !

Yo.

ADD REPLY
0
Entering edit mode

It's a good beginning I think. But my input file is like this : "Uniprot_ID--->position", one per line. So I just want to translate Uniprot_ID to Gene_name in output. Does anything exist yet ? Thx a lot !

ADD REPLY
0
Entering edit mode

Oups, I don't know how to paste code here...if an admin can edit it..thanks

ADD REPLY

Login before adding your answer.

Traffic: 1421 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6