Skip to content

Commit

Permalink
add some error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kjwinfield committed Jan 3, 2025
1 parent 759d601 commit e9e23b1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions resources/home/dnanexus/get_variant_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,21 @@ def look_up_id_in_refseq_mane_conversion_file(conversion, query_id, id_type):
matched_id (str): Matched ID or None if no match found.
'''
matched_id = None
matches = []
for line in conversion:
if query_id in line:
matches = [x for x in line.split() if x.startswith(id_type)]
if matches != []:
matched_id = matches[0]
break

if matches != []:
if len(matches) == 1:
matched_id = matches[0]
else:
print(
f"Multiple matches for {query_id} found {matches.join(', ')}."
"\nUnable to assign a match to this transcript."
)

return matched_id


Expand Down

0 comments on commit e9e23b1

Please sign in to comment.