[Biopython] problem with KEGG.REST.kegg_conv
Peter Cock
p.j.a.cock at googlemail.com
Tue Dec 15 11:17:56 UTC 2015
On Tue, Dec 15, 2015 at 10:34 AM, Felix Heeger <fheeger at mi.fu-berlin.de> wrote:
> Hi,
>
> first of all thanks for the awesome library.
>
> Here is my problem: I am trying to to use the KEGG.REST.kegg_conv
> function to translate NCBI GIs to kegg gene names.
>
> For example I think this should work:
>
>> kegg_conv("genes","ncbi-gi:16130957")
>
> But I get an error from Biopython:
>
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/local/lib/python2.7/dist-packages/Bio/KEGG/REST.py", line 252, in kegg_conv
>> raise Exception("Bad argument target_db or source_db for kegg conv request.")
>> Exception: Bad argument target_db or source_db for kegg conv request.
>
> Looking at the code, I think the only accepted input for the function
> would look something like this:
>
>> kegg_conv("genes","ncbi-gi")
>
> This does indeed not cause a error from Biopython, but is clearly
> missing the information *which* GI I want to convert and also gives my
> a HTTP Error because Kegg does not accept the resulting URL
> (http://rest.kegg.jp/conv/genes/ncbi-gi).
>
> Is this a problem with the kegg_conv function or am I missing something?
>
> Cheers,
> felix
Hi Felix,
Looking at the API documentation http://www.kegg.jp/kegg/rest/keggapi.html
genes to ncbi-geneid should work, they give this example:
/conv/genes/ncbi-geneid:3113320 conversion from NCBI GeneID to KEGG
ID when the organism code is not known
In my browser or at the command line that returns:
$ curl http://rest.kegg.jp/conv/genes/ncbi-geneid:3113320
ncbi-geneid:3113320 lpf:lpl0407
Within Biopython, I would have guessed this would work:
kegg_conv("genes", ["ncbi-geneid:3113320"])
This looks like a problem with how the source/target database
names are checked (it doesn't remove the :id part). I think the
Biopython wrapper currently only supports the first form of the
conv API.
I have filed this as a bug:
https://github.com/biopython/biopython/issues/729
Thanks for reporting this Felix,
Peter
Note they do not list ncbi-gi as an external database name.
Peter
More information about the Biopython
mailing list