During domain architecture fetching certain UniProt IDs will lead to a KeyError associated with retrieving domain information and order. The error is consistent across these as lacking a key with the value of 0 (See 1st and 2nd screenshot). It is arising from the get_domains_from_response function in the InterPro module when calling the return_expanded_domains (See 3rd screenshot).
Screenshots
Example error
Commonality of the KeyError
Code associated with the errors
Files
Interpro.py in the get_domains_from_response function
x = InterPro.fetch_InterPro_json(["A0A075B6H7","A6NN92",'A0A087WV53'])
d_dict = {}
for p in ["A0A075B6H7","A6NN92",'A0A087WV53']:
inner_dict = {}
for i,entry in enumerate(x[p]['results']):
#print(entry) #Use this to see the actual entry values
if entry['metadata']['type'] == 'domain':
inner_dict[i] = InterPro.collect_data(entry)
d_dict[p] = inner_dict
Looking at each entry they lack a 0 key as it appears that these have a InterPro domain family as the first entry, which through enumerate is no longer the 0th entry in the d_dict variable.
Expected behavior
Should be fetching domain architectures without issue.
Tasks
Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at, if known
[ ] At ~line 235 either create a separate indexing variable that increases for each domain encountered to ensure a 0 start or a lowest key entry value to be passed on.
[ ] At ~line 236 resolve the dictionary call based on the solution to the above task
Description
During domain architecture fetching certain UniProt IDs will lead to a KeyError associated with retrieving domain information and order. The error is consistent across these as lacking a key with the value of 0 (See 1st and 2nd screenshot). It is arising from the get_domains_from_response function in the InterPro module when calling the return_expanded_domains (See 3rd screenshot).
Screenshots
Example error
Commonality of the KeyError
Code associated with the errors
Files
Interpro.py in the get_domains_from_response function
To Reproduce
Steps to reproduce the behavior:
Diagnostic Code to determine error source
Looking at each entry they lack a 0 key as it appears that these have a InterPro domain family as the first entry, which through enumerate is no longer the 0th entry in the d_dict variable.
Expected behavior
Should be fetching domain architectures without issue.
Tasks
Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at, if known