@@ -622,13 +622,27 @@ def plot_frequencies_interactive_map(
622622 variants = ds ["variant_label" ].values
623623 taxa = ds ["cohort_taxon" ].to_pandas ().dropna ().unique () # type: ignore
624624 periods = ds ["cohort_period" ].to_pandas ().dropna ().unique () # type: ignore
625+
626+ if len (variants ) == 0 :
627+ raise ValueError ("No variants available in dataset." )
628+ if len (taxa ) == 0 :
629+ raise ValueError ("No taxons available in dataset." )
630+ if len (periods ) == 0 :
631+ raise ValueError ("No periods available in dataset." )
632+
625633 controls = ipywidgets .interactive (
626634 self .plot_frequencies_map_markers ,
627635 m = ipywidgets .fixed (freq_map ),
628636 ds = ipywidgets .fixed (ds ),
629- variant = ipywidgets .Dropdown (options = variants , description = "Variant: " ),
630- taxon = ipywidgets .Dropdown (options = taxa , description = "Taxon: " ),
631- period = ipywidgets .Dropdown (options = periods , description = "Period: " ),
637+ variant = ipywidgets .Dropdown (
638+ options = variants , value = variants [0 ], description = "Variant: "
639+ ),
640+ taxon = ipywidgets .Dropdown (
641+ options = taxa , value = taxa [0 ], description = "Taxon: "
642+ ),
643+ period = ipywidgets .Dropdown (
644+ options = periods , value = periods [0 ], description = "Period: "
645+ ),
632646 clear = ipywidgets .fixed (True ),
633647 )
634648
0 commit comments