Skip to content

Commit 1cba09b

Browse files
authored
Merge pull request #769 from malariagen/GH768-Null-se-can-raise-error
Handle ZeroDivisionError in plot_pairwise_average_fst
2 parents 511f0b1 + ad9e69e commit 1cba09b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

malariagen_data/anoph/fst.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,11 @@ def plot_pairwise_average_fst(
539539
if annotation == "standard error":
540540
fig_df.loc[cohort1, cohort2] = se
541541
elif annotation == "Z score":
542-
zs = fst / se
543-
fig_df.loc[cohort1, cohort2] = zs
542+
try:
543+
zs = fst / se
544+
fig_df.loc[cohort1, cohort2] = zs
545+
except ZeroDivisionError:
546+
fig_df.loc[cohort1, cohort2] = np.nan
544547
else:
545548
fig_df.loc[cohort1, cohort2] = fst
546549

0 commit comments

Comments
 (0)