3
$\begingroup$

I have a list of >1000 "ordered locus names" from the STRING database (also called gene numbers, ORF numbers, or CDS numbers by uniprot). They're in the form of 'b0014', 'b0015', etc. I'd like to convert them all to Uniprot protein IDs.

I know how to do it in a non-batch way, since searching Uniprot for 'b0014' returns what (I think) is a protein ID. However I'd like a batch solution since there are so many IDs that need converting.

$\endgroup$
3

2 Answers 2

6
$\begingroup$

ID mapping

This is called ID mapping. It used to be a headache as programmatic sequence comparisons were the only real way, but it is pretty trivial these days.

As mentioned in the comments, by far the most popular and easy method is to use Uniprot's list uploader for mapping. The corresponding publication can be found here.

Example

Programmatic access

The web user interface will work for thousands of IDs, but is like to result in errors for queries exceeding 10,000 IDs. In that case programmatic queries are probably better. I've slightly modified this from the Uniprot docs so that the IDs are queried 1 at a time to avoid any errors in exceeding query size. The python code would be:

import urllib,urllib2

list_to_convert = ["b0014", "b0015"]
url = 'http://www.uniprot.org/mapping/'

print "From To"
for genename_id in list_to_convert:
    params = {
    'from':'GENENAME',
    'to':'ACC',
    'format':'tab',
    'query':genename_id
    }

    data = urllib.urlencode(params)
    request = urllib2.Request(url, data)
    contact = "" # Please set your email address here.
    request.add_header('User-Agent', 'Python %s' % contact)
    response = urllib2.urlopen(request)
    page = response.read(200000)
    print page.splitlines()[1] #Ignores the header line returned by uniprot

The output from this looks like:

From    To
b0014   P0A6Y8
b0015   P08622

Web GUI

b0014 and b0015 aren't actually STRING IDs. They are IDs referred to as gene names and are used across a variety of databases including Uniprot.

The mapper:

screen-shot of query being entered to Uniprot mapper

Note in section 2 of the ID mapping that I have set the left option to "gene name". "STRING" won't work.

The result is below:

screen-shot of the result of query

$\endgroup$
2
$\begingroup$

The first answer is good! Here I want to suggest another useful tool when you are thinking about ID Mapping. That is bioDBnet: db2db, which is used for "Database to Database Conversions". The introduction of this tool is:

db2db allows for conversions of identifiers from one database to other database identifiers or annotations. To use db2db select the input type of your data, changing the input type automatically changes the output options to the ones specific for the input selected. Then select one or more output types and add your identifiers in the ID list box. Set the remove duplicate values to 'No' if you do not want duplicates to be removed. Clicking on submit then returns a table of your inputs matched against all the outputs selected in the exact order as entered. Results can be limited to a particular taxon by entering it's Taxon ID. The performance will vary widely depending on the number of outputs and the options selected. Conversions to a single output with the default options should complete in a few seconds

The above is my favorite tool, and sometimes using from ensemble will help you solve the problem in a more efficient way if you are dealing with model organism, like mouse and human.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .