Skip to content

Commit e5e0400

Browse files
committed
Correct updating of forward probabilities at first site
1 parent 4dbe639 commit e5e0400

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

python/tests/beagle_numba.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,9 @@ def compute_forward_matrix(ref_h, query_h, trans_probs, mismatch_probs):
357357
if query_a == ref_a:
358358
em_prob = 1.0 - mismatch_probs[i]
359359
fwd_mat[i, j] = em_prob
360-
if i == 0:
361-
fwd_mat[i, j] *= 1.0 / h # Prior probabilities.
362-
else:
363-
fwd_mat[i, j] *= scale * fwd_mat[i - 1, j] + shift
360+
fwd_mat[i, j] *= scale * fwd_mat[i - 1, j] + shift
364361
site_sum = np.sum(fwd_mat[i, :])
362+
# Prior probabilities are multiplied when i = 0.
365363
last_sum = site_sum / h if i == 0 else site_sum
366364
return fwd_mat
367365

0 commit comments

Comments
 (0)