Skip to content

Commit 1da4a14

Browse files
authored
Merge pull request #1287 from suhr25/fix/empty-gwss-plot-guard
fix: raise ValueError when iHS/XP-EHH arrays are empty after filtering
2 parents e48d75b + fb79a35 commit 1da4a14

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

malariagen_data/anopheles.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,12 @@ def plot_ihs_gwss_track(
970970
inline_array=inline_array,
971971
)
972972

973+
if len(x) == 0:
974+
raise ValueError(
975+
"No iHS values remain after filtering. "
976+
"Try relaxing filter_min_maf or min_ehh parameters."
977+
)
978+
973979
# determine X axis range
974980
x_min = x[0]
975981
x_max = x[-1]
@@ -1494,6 +1500,12 @@ def plot_xpehh_gwss_track(
14941500
inline_array=inline_array,
14951501
)
14961502

1503+
if len(x) == 0:
1504+
raise ValueError(
1505+
"No XP-EHH values remain after filtering. "
1506+
"Try relaxing filter_min_maf or min_ehh parameters."
1507+
)
1508+
14971509
# determine X axis range
14981510
x_min = x[0]
14991511
x_max = x[-1]

0 commit comments

Comments
 (0)