Skip to content

Commit

Permalink
Minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Sep 1, 2023
1 parent fcda0a8 commit e47d9d2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/tests/beagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,17 +428,17 @@ def compute_state_probability_matrix(fm, bm, ref_h, query_h):

def interpolate_allele_probabilities(sm, ref_h, genotyped_pos, imputed_pos):
"""
Compute the interpolated allele probabilities at imputed markers
of a query haplotype following Equation 1 of BB2016.
Compute the interpolated allele probabilities at imputed markers of
a query haplotype following Equation 1 of BB2016.
Assuming all biallelic sites, the interpolated allele probability matrix
is of size (x, 2), where x is the number of imputed markers.
This function takes the output of `compute_state_probability_matrix`.
Note that this function takes:
1. HMM state probability matrix across genotyped markers (size of m).
2. reference haplotypes subsetted to imputed markers (size of x).
1. HMM state probability matrix across genotyped markers of size (m, h).
2. reference haplotypes subsetted to imputed markers of size (x, h).
:param numpy.ndarray sm: HMM state probability matrix at genotyped markers.
:param numpy.ndarray ref_h: Reference haplotypes subsetted to imputed markers.
Expand All @@ -447,15 +447,15 @@ def interpolate_allele_probabilities(sm, ref_h, genotyped_pos, imputed_pos):
:return: Interpolated allele probabilities.
:rtype: numpy.ndarray
"""
h = ref_h.shape[1]
m = len(genotyped_pos)
x = len(imputed_pos)
assert sm.shape == (m, h)
assert ref_h.shape == (x, h)
h = ref_h.shape[1]
assert (m, h) == sm.shape
assert (x, h) == ref_h.shape
genotyped_cm = convert_to_genetic_map_position(genotyped_pos)
imputed_cm = convert_to_genetic_map_position(imputed_pos)
weights = get_weights(genotyped_pos, imputed_pos)
assert len(weights) == x
assert x == len(weights)
p = np.zeros((x, 2), dtype=np.float64)

def _compute_allele_probabilities(a):
Expand Down

0 comments on commit e47d9d2

Please sign in to comment.