Skip to content

Commit

Permalink
Fix bug in logic
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Aug 31, 2023
1 parent 66d006e commit 1abdf52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/tests/beagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_weights(genotyped_pos, imputed_pos):
elif imputed_cm[i] > genotyped_cm[-1]:
m = -2
else:
m = np.min(np.where(genotyped_cm > imputed_cm[i]))
m = np.max(np.where(genotyped_cm > imputed_cm[i])[0])
weights[i] = 0
cm_mP1_x = genotyped_cm[m + 1] - imputed_cm[i]
cm_mP1_m = np.max(genotyped_cm[m + 1] - genotyped_cm[m], MIN_CM_DIST)
Expand Down Expand Up @@ -379,7 +379,7 @@ def _interpolate_allele_probabilities(
elif imputed_cm[i] > genotyped_cm[-1]:
m = -2
else:
m = np.min(np.where(genotyped_cm > imputed_cm[i]))
m = np.max(np.where(genotyped_cm > imputed_cm[i])[0])
# Vectorised over the allelic states
i_hap_probs[i, :] = weights[i] * bwd_hap_probs[m, :]
i_hap_probs[i, :] += (1 - weights[i]) * fwd_hap_probs[m, :]
Expand Down Expand Up @@ -466,7 +466,7 @@ def _compute_allele_probabilities(a):
elif imputed_cm[i] > genotyped_cm[-1]:
_m = -2
else:
_m = np.min(np.where(genotyped_cm > imputed_cm[i]))
_m = np.max(np.where(genotyped_cm > imputed_cm[i])[0])
for j in np.arange(h):
if ref_h[i, j] == a:
p[i, a] += weights[i] * sm[_m, j]
Expand Down

0 comments on commit 1abdf52

Please sign in to comment.