Skip to content

Commit

Permalink
Add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jan 14, 2024
1 parent 3205ee9 commit 778a449
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/tests/beagle_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,19 @@ def interpolate_allele_prob(
alleles = np.arange(4) # ACGT
ref_panel_size = ref_h.shape[1]
x = len(ungenotyped_pos)
weights, marker_interval_start = get_weights(
weights, left_idx = get_weights(
genotyped_pos, ungenotyped_pos, genotyped_cm, ungenotyped_cm
)
p = np.zeros((x, len(alleles)), dtype=np.float32)
for i in range(x):
k = marker_interval_start[i]
m = left_idx[i]
for j in range(ref_panel_size):
for a in alleles:
if ref_h[i, j] == a:
p[i, a] += weights[i] * sm[k, j]
p[i, a] += (1 - weights[i]) * sm[k + 1, j]
p[i, a] += weights[i] * sm[m, j]
p[i, a] += (1 - weights[i]) * sm[m + 1, j]
# Rescale probabilities.
# TODO: Check if this is necessary. Could this be a subtle source of error?
p_rescaled = p / np.sum(p, axis=1)[:, np.newaxis]
return p_rescaled

Expand Down

0 comments on commit 778a449

Please sign in to comment.