Skip to content

Commit

Permalink
adding error checking for taxon normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Oct 24, 2024
1 parent 4c831e6 commit 1446738
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parsers/LitCoin/src/bagel/bagel.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def augment_results(terms, nameres, taxes):
resp = requests.get(f"{NODE_NORMALIZATION_URL}get_normalized_nodes?curie="+tax_id)
if resp.status_code == 200:
result = resp.json()
tax_name = result[tax_id]["id"]["label"]
try:
tax_name = result[tax_id]["id"]["label"]
except (TypeError, KeyError):
tax_name = f'Taxon name failed for {tax_id}'
taxes[tax_id] = tax_name
tax_name = taxes[tax_id]
annotation["label"] = f"{annotation['label']} ({tax_name})"
Expand Down

0 comments on commit 1446738

Please sign in to comment.