Skip to content

Commit 89e2869

Browse files
committed
Implement skip when no particular allele is observed
1 parent 9895525 commit 89e2869

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/tests/beagle_numba.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,13 @@ def interpolate_allele_probs(
561561
w = weights[i]
562562
for a in alleles:
563563
is_a_in_ref_h = ref_h[i, :] == a
564+
if np.sum(is_a_in_ref_h) == 0:
565+
continue
564566
if use_threshold:
565567
# TODO: Check whether this is implemented correctly. Not used by default.
566568
# Threshold based on "the number of subsets in the partition Am of H".
567-
threshold_Am = np.sum(is_a_in_ref_h)
568-
_MIN_THRESHOLD = min(0.005, 1 / threshold_Am)
569+
threshold_Am = 1 / np.sum(is_a_in_ref_h)
570+
_MIN_THRESHOLD = min(0.005, threshold_Am)
569571
if k == 0:
570572
# See 'setFirstAlleleProbs' in 'LSHapBaum.java'.
571573
assert w == 1.0, "Weight should be 1.0."

0 commit comments

Comments
 (0)