Skip to content

Commit af991c9

Browse files
authored
Merge pull request #948 from adilraza99/GH947-fst-zscore-zero-se
Fix Fst Z-score calculation when standard error is zero
2 parents d316582 + 449a66c commit af991c9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

malariagen_data/anoph/fst.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,10 @@ def plot_pairwise_average_fst(
539539
if annotation == "standard error":
540540
fig_df.loc[cohort1, cohort2] = se
541541
elif annotation == "Z score":
542-
try:
543-
zs = fst / se
544-
fig_df.loc[cohort1, cohort2] = zs
545-
except ZeroDivisionError:
542+
if se == 0:
546543
fig_df.loc[cohort1, cohort2] = np.nan
544+
else:
545+
fig_df.loc[cohort1, cohort2] = fst / se
547546
else:
548547
fig_df.loc[cohort1, cohort2] = fst
549548

0 commit comments

Comments
 (0)