Skip to content
Permalink
Browse files

Merge pull request #284 from nextstrain/export_legend

Allow Legend Order to be Set by User
  • Loading branch information...
rneher committed May 22, 2019
2 parents cec062c + 09698a3 commit e9c0cf7169c7a9cdfc09d4743731533fe1ae8a88
Showing with 5 additions and 0 deletions.
  1. +5 −0 augur/utils.py
@@ -264,6 +264,10 @@ def add_line(line):
if not hex_code.startswith("#") or len(hex_code) != 7:
print("WARNING: Color map file contained this invalid hex code: ", hex_code)
return
# If was already added, delete entirely so order can change to order in user-specified file
# (even though dicts shouldn't be relied on to have order)
if (trait, trait_value) in colors:
del colors[(trait, trait_value)]
colors[(trait, trait_value)] = hex_code


@@ -283,6 +287,7 @@ def add_line(line):
color_map = defaultdict(list)
for (trait, trait_value), hex_code in colors.items():
color_map[trait].append((trait_value, hex_code))

return color_map

def write_VCF_translation(prot_dict, vcf_file_name, ref_file_name):

0 comments on commit e9c0cf7

Please sign in to comment.
You can’t perform that action at this time.