Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Sep 1, 2023
1 parent 00e40e3 commit 62064c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/tests/beagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ def get_mismatch_prob(pos, miscall_rate):
Set mismatch probabilities at genotyped markers.
In BEAGLE, the mismatch probability is dominated by the allelic miscall rate.
By default, it is set to 0.0001. Also, it is capped at 0.5.
By default, it is set to 0.0001 and capped at 0.50.
:param numpy.ndarray pos: Site positions.
:param float miscall_rate: Allelic miscall rate.
:return: Mismatch probabilities.
:rtype: numpy.ndarray
"""
assert isinstance(miscall_rate, float)
assert 0 <= miscall_rate <= 0.5
if miscall_rate >= 0.5:
miscall_rate = 0.5
mu = np.zeros(len(pos), dtype=np.float64) + miscall_rate
return mu

Expand Down Expand Up @@ -239,6 +240,7 @@ def compute_backward_probability_matrix(ref_h, query_h, rho, mu):
sum_site = np.sum(bm[i, :])
scale = (1 - rho[i + 1]) / sum_site
shift = rho[i + 1] / h
print(str(sum_site) + " " + str(scale) + " " + str(shift))
for j in np.arange(h):
bm[i, j] = scale * bm[i, j] + shift
return bm
Expand Down

0 comments on commit 62064c9

Please sign in to comment.