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