Hi!
I am having a problem retrieving enzyme data with biopython.
I import the necessary packages:
from Bio.KEGG import REST
from Bio.KEGG import Enzyme
For some cases the parser works eg:
request = REST.kegg_get("ec:2.3.1.237")
open("ec_2.3.1.237.txt",'w').write(request.read())
records = Enzyme.parse(open("ec_2.3.1.237.txt"))
record = list(records)[0]
print(record.genes)
[('SEN', ['SACE_5532']), ('SAQ', ['Sare_4951', 'ACTN:', 'L083_3191'])]
But for others, unfortunately, it doesn't. Here is an example:
request = REST.kegg_get("ec:2.3.1.246")
open("ec_2.3.1.246.txt",'w').write(request.read())
records = Enzyme.parse(open("ec_2.3.1.246.txt"))
record = list(records)[0]
print(record.genes)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-37-0e0367f55487> in <module>()
2 open("ec_2.3.1.246.txt",'w').write(request.read())
3 records = Enzyme.parse(open("ec_2.3.1.246.txt"))
----> 4 record = list(records)[0]
5 print(record.genes)
/anaconda/lib/python3.5/site-packages/Bio/KEGG/Enzyme/__init__.py in parse(handle)
267 record.genes.append(row)
268 else:
--> 269 row = record.genes[-1]
270 key, values = row
271 for value in data.split():
IndexError: list index out of range
I have been trying to look at both cases but I cannot spot a difference.
Thank you in advance.