artic-network / civet

Cluster Investigation & Virus Epidemiology Tool
https://cov-lineages.org/resources/civet.html
GNU General Public License v3.0
49 stars 14 forks source link

report breaks colouring by trait defaults #76

Closed aineniamh closed 4 years ago

aineniamh commented 4 years ago

---------------------------------------------------------------------------KeyError Traceback (most recent call last) in

----> 1 too_tall_trees, overall_tree_number, colour_dict_dict, overall_df_dict, tree_order, too_large_tree_dict, tallest_height,tree_to_num_tips = tree_viz.make_all_of_the_trees(treedir, tree_name_stem, full_tax_dict, query_dict, tree_fields, label_fields, colour_by, tree_to_all_tip, tree_to_tip, inserted_node_dict, svg_figdir, safety_level=safety_level) ~/.conda/envs/civet/lib/python3.6/site- packages/reportfunk/funks/tree_functions.py in make_all_of_the_trees(input_dir, tree_name_stem, taxon_dict, query_dict, desired_fields, custom_tip_labels, graphic_dict, tree_to_all_tip, tree_to_querys, inserted_node_dict, svg_figdir, safety_level, min_uk_taxa) 383 overall_df_dict[treename] = df_dict 384 --> 385 make_scaled_tree(tree, treename, inserted_node_dict, len(tips), colour_dict_dict, desired_fields, tallest_height, taxon_dict, query_dict, custom_tip_labels, graphic_dict, safety_level, svg_figdir) 386 387 else: ~/.conda/envs/civet/lib/python3.6/site- packages/reportfunk/funks/tree_functions.py in make_scaled_tree(My_Tree, tree_name, inserted_node_dict, num_tips, colour_dict_dict, desired_fields, tallest_height, taxon_dict, query_dict, custom_tip_labels, graphic_dict, safety_level, figdir) 213 My_Tree.plotTree(ax, colour_function=c_func, x_attr=x_attr, y_attr=y_attr, branchWidth=b_func) 214 --> 215 My_Tree.plotPoints(ax, x_attr=x_attr, colour_function=cn_func,y_attr=y_attr, size_function=s_func, outline_colour=outline_colour_func) 216 My_Tree.plotPoints(ax, x_attr=x_attr, colour_function=co_func, y_attr=y_attr, size_function=so_func, outline_colour=outline_colour_func) 217 ~/.conda/envs/civet/lib/python3.6/site- packages/reportfunk/funks/baltic.py in plotPoints(self, ax, x_attr, y_attr, target, size_function, colour_function, zorder, outline, outline_size, outline_colour, **kwargs) 806 xs.append(x_attr(k)) 807 ys.append(y_attr(k)) --> 808 colours.append(colour_function(k)) 809 sizes.append(size_function(k)) 810 ~/.conda/envs/civet/lib/python3.6/site- packages/reportfunk/funks/tree_functions.py in (k) 187 first_trait = trait 188 colour_dict = colour_dict_dict[trait] --> 189 cn_func = lambda k: colour_dict[query_dict[k.name].attribute_dict[trait]] if k.name in query_dict.keys() else 'dimgrey' 190 co_func=lambda k: colour_dict[query_dict[k.name].attribute_dict[trait]] if k.name in query_dict.keys() else 'dimgrey' 191 outline_colour_func = lambda k: colour_dict[query_dict[k.name].attribute_dict[trait]] if k.name in query_dict.keys() else 'dimgrey' KeyError: 'Illinois'