@@ -2240,18 +2240,15 @@ def plot_haplotype_network(
2240
2240
color_discrete_map_display = None
2241
2241
ht_color_counts = None
2242
2242
if color is not None :
2243
- # sanitise color column - necessary to avoid grey pie chart segments
2244
- df_haps ["partition" ] = df_haps [color ].str .replace (r"\W" , "" , regex = True )
2245
-
2246
- # extract all unique values of the color column
2247
- color_values = df_haps ["partition" ].fillna ("<NA>" ).unique ()
2248
- color_values_mapping = dict (zip (df_haps ["partition" ], df_haps [color ]))
2243
+ df_haps ["_partition" ] = df_haps [color ].str .replace (r"\\W" , "" , regex = True )
2244
+ color_values = df_haps ["_partition" ].fillna ("<NA>" ).unique ()
2245
+ color_values_mapping = dict (zip (df_haps ["_partition" ], df_haps [color ]))
2249
2246
color_values_mapping ["<NA>" ] = "black"
2250
2247
color_values_display = [color_values_mapping [c ] for c in color_values ]
2251
2248
2252
2249
# count color values for each distinct haplotype
2253
2250
ht_color_counts = [
2254
- df_haps .iloc [list (s )]["partition " ].value_counts ().to_dict ()
2251
+ df_haps .iloc [list (s )]["_partition " ].value_counts ().to_dict ()
2255
2252
for s in ht_distinct_sets
2256
2253
]
2257
2254
@@ -2262,7 +2259,7 @@ def plot_haplotype_network(
2262
2259
category_orders_prepped ,
2263
2260
) = self ._setup_sample_colors_plotly (
2264
2261
data = df_haps ,
2265
- color = "partition " ,
2262
+ color = "_partition " ,
2266
2263
color_discrete_map = color_discrete_map ,
2267
2264
color_discrete_sequence = color_discrete_sequence ,
2268
2265
category_orders = category_orders ,
0 commit comments