Skip to content

Commit

Permalink
Made constellation regex validation more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
btski committed Nov 6, 2023
1 parent 7936ce6 commit 0baf6c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion octofludb/domain_flu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
p_internal_gene = p.regex("PB2|PB1|PA|NP") ^ p_ns ^ p_m

p_segment = p_internal_gene ^ p.string("HA") ^ p.string("NA")
p_constellation = p.regex("[TPVHX-]{6}|MIXED")
p_constellation = p.regex("[A-Z-]{6}|MIXED|mixed")
p_segment_number = p.regex("[1-8]")
p_segment_subtype = p_segment ^ p_HA ^ p_NA

Expand Down
3 changes: 3 additions & 0 deletions octofludb/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def _make_constellations(rows: List[Tuple[str, str, str]]) -> List[Tuple[str, st
# add flexible matching
for c_lookup, c_letter in clade_lookup.items():
if c_lookup.lower() in clade.lower():
log(
f"{bad('WARNING:')} closest match found is partial and/or case-insensitive, {str((strain, clade, c_lookup))}"
)
char = c_letter
break
else:
Expand Down

0 comments on commit 0baf6c5

Please sign in to comment.