Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[genome builds] Fix coloring assignment for division #132

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion scripts/assign-colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,19 @@ def index_of(search_list, search_value, not_found_value):
observations.sort(key=lambda x: index_of(ordering[category], x, len(ordering[category])))
if (missing:=set(observations) - set(ordering[category])):
print(f"WARNING: For trait {category} we encountered {len(missing)} value(s) not present in the ordering TSV: {missing}", file=stderr)
# -- temporory --
# reduce the values we provide colorings for to just those present in the orderings TSV
# (values pruned out here will still be shown in Auspice, but they'll be grey)
# This addresses bug <https://github.com/nextstrain/avian-flu/issues/131> where
# we had more division values than colors and thus the pipeline failed
# Hopefully the underlying cause will be fixed by improvements in how we ingest data, e.g.
# <https://github.com/nextstrain/augur/issues/1578>
# and we can remove this restriction.
observations = [obs for obs in observations if obs in ordering[category]]
print(f"These will not be assigned colors and thus will appear grey in Auspice", file=stderr)
try:
hexes = schemes[len(observations)]
except IndexError:
except KeyError:
raise Exception(f"Ordering '{category}' had {len(observations)} values but the color-schemes don't go this high!")
for pair in zip(observations, hexes):
tsv_writer.writerow([category, *pair])
Expand Down