Commit 2a28e3c3 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Fix bug: ec number retriever uses dbxref instead of id for identity field

parent 95aadf02
...@@ -45,14 +45,14 @@ def retrieve(dbxrefs, basic=True, references=True): ...@@ -45,14 +45,14 @@ def retrieve(dbxrefs, basic=True, references=True):
html = HTML.document_fromstring(ls).head.text_content() html = HTML.document_fromstring(ls).head.text_content()
# when everything is fine an exception was thrown for # when everything is fine an exception was thrown for
# the last line # the last line
output = {'dbxref': entry['dbxref']} output = {'id': entry['dbxref']}
output['message'] = html output['message'] = html
if output['message'] == ' 500 Internal Server Error ': if output['message'] == ' 500 Internal Server Error ':
output['message'] = '500 Internal Server Error; probably invalid ID' output['message'] = '500 Internal Server Error; probably invalid ID'
documents.append(output) documents.append(output)
except: except:
retrieved_entry = parse_flat_file(r.text) retrieved_entry = parse_flat_file(r.text)
retrieved_entry['dbxref'] = entry['dbxref'] retrieved_entry['id'] = entry['dbxref']
documents.append(retrieved_entry) documents.append(retrieved_entry)
return documents return documents
......
...@@ -4,7 +4,7 @@ from dbxref import retriever, resolver ...@@ -4,7 +4,7 @@ from dbxref import retriever, resolver
class TestDbxrefResolve(unittest.TestCase): class TestDbxrefResolve(unittest.TestCase):
def test_different_case_database_prefix(self): def test_different_case_database_prefix(self):
entries = resolver.convert_to_dbxrefs(['PFAM:PF00002','Pfam:PF00002','pfam:PF00002']) entries = resolver.convert_to_dbxrefs(['PFAM:PF00002','Pfam:PF00002','pfam:PF00002', 'EC:2.7.7.1'])
documents = retriever.retrieve(entries) documents = retriever.retrieve(entries)
for d in documents: for d in documents:
with self.subTest(d=d): with self.subTest(d=d):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment