Closed taoualiw closed 1 year ago
@taoualiw thanks. I have fixed the issue locally with a new tests and will push a release during the day. thanks again for reporting this issue. I'll close the issue once the new release is available on pypi
Thanks @cokelaer for the quick fix and release. Everything works fine now. However, I would like to bring to your attention that the newly added regression test wasn't exercising the issue. The failing example was u.mapping("UniProtKB_AC-ID", "KEGG", "P43403")
( not u.mapping("UniProtKB_AC-ID", "KEGG", "P43403,P123456")
).
@taoualiw thanks for the feedback. I improved the test
res = uniprot.mapping("UniProtKB_AC-ID", "KEGG",' P43403,P123456")
assert res['failedIds']
# here no failedId but we expect an empty failedIds in the returned dictionary (empty list)
res = uniprot.mapping("UniProtKB_AC-ID", "KEGG", "P43403")
assert res['failedIds'] == []
Bug introduced in v1.11.0
It seems that the result of
http_get(f"idmapping/status/{job_id}", frmt="json")
does not contain thefailedIds
key if there are no failed ids: https://github.com/cokelaer/bioservices/blob/07577b67a58e45fccc9bb8a94d6aa41b62787031/src/bioservices/uniprot.py#L476The changes introduced in the most recent release
v1.11.0, 16 hours ago
result in aKeyError
bug when that happens and the line responsible for that is the following: https://github.com/cokelaer/bioservices/blob/07577b67a58e45fccc9bb8a94d6aa41b62787031/src/bioservices/uniprot.py#L482See the following example
Unfortunately, the existing test does not exercise the case where there are no failed ids: https://github.com/cokelaer/bioservices/blob/cce05ab8e6b0530c3e3200ff143844b7a6865cfc/test/webservices/test_uniprot.py#L46-L52