[Biopython] Error in Querying the KEGG API

ning luwen bioinformaticsing at gmail.com
Mon Aug 10 09:58:45 UTC 2015


Thank you, Peter. That works.

Luwen

On Fri, Aug 7, 2015 at 5:14 PM, Peter Cock <p.j.a.cock at googlemail.com>
wrote:

> Dear Iuwen,
>
> Thank you for emailing us. This example looks wrong, or at least
> out of sync with the actual code. The handle style is also quite
> old (not explicitly closing the file handles).
>
> I've not worked out what happened, but Biopython 1.65 added
> Bio.KEGG.REST as a new module for using the KEGG online
> API. This has an equivalent kegg_get function which you could
> use as follows:
>
> from Bio.KEGG.REST import kegg_get
> from Bio.KEGG import Enzyme
> with open("ec:5.4.2.2.txt", "w") as out_handle:
>     out_handle.write(kegg_get("ec:5.4.2.2").read())
> with open("ec:5.4.2.2.txt") as in_handle:
>     records = list(Enzyme.parse(in_handle))
> record = records[0]
> print(record.classname)
> print(record.entry)
>
> Again, the output should be:
>
> ['Isomerases;', 'Intramolecular transferases;', 'Phosphotransferases
> (phosphomutases)']
> 5.4.2.2
>
> I've filed an issue to remind us to look at this:
> https://github.com/biopython/biopython/issues/592
>
> Peter
>
> On Fri, Aug 7, 2015 at 3:56 AM, ning luwen <bioinformaticsing at gmail.com>
> wrote:
> > Dear All,
> >
> > I followed the tutorial
> > http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc231 to learn
> KEGG
> > things in biopython, but without lucky, any suggestion?
> >
> >>>> from Bio import KEGG
> >>>> from Bio.KEGG import Enzyme
> >>>> request = KEGG.get("ec:5.4.2.2")
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > AttributeError: 'module' object has no attribute 'get'
> >>>> import Bio
> >>>> print Bio.__version__
> > 1.65
> >
> >
> > --
> > regards,
> > luwen ning
> >
> > _______________________________________________
> > Biopython mailing list  -  Biopython at mailman.open-bio.org
> > http://mailman.open-bio.org/mailman/listinfo/biopython
>



-- 
regards,
luwen ning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20150810/84b8523e/attachment.html>


More information about the Biopython mailing list