Skip to content

Commit f02f1a2

Browse files
committed
Rename function and improve docs
1 parent 29c3d12 commit f02f1a2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

python/tests/test_beagle.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,26 +325,27 @@ def compute_state_probability_matrix(fm, bm, ref_h, query_h, rho, mu):
325325
return (sm, fwd_hap_probs, bwd_hap_probs)
326326

327327

328-
def interpolate_haplotype_probability_matrix(
328+
def interpolate_allele_probabilities(
329329
fwd_hap_probs, bwd_hap_probs, genotyped_pos, imputed_pos
330330
):
331331
"""
332-
Compute the interpolated haplotype probability matrix of a query haplotype.
332+
Compute the interpolated allele probabilities at the imputed markers
333+
of a query haplotype.
333334
334335
The forward and backward haplotype probability matrices are of size (m, 2),
335-
where m is the number of genotyped markers in the query haplotype.
336+
where m is the number of genotyped markers.
336337
Here, we assume all biallelic sites, hence the 2.
337338
338339
The interpolated haplotype probability matrix is of size (x, 2),
339-
where x is the number of imputed markers in the query haplotype.
340+
where x is the number of imputed markers.
340341
Again, we assume all biallelic sites, hence the 2.
341342
342343
This implementation is based on Equation 2 (the rearranged one) in BB2016.
343344
344-
:param fwd_hap_probs: Forward haplotype probability matrix.
345-
:param bwd_hap_probs: Backward haplotype probability matrix.
346-
:param genotyped_pos: Site positions of genotyped markers.
347-
:param imputed_pos: Site positions of imputed markers.
345+
:param numpy.ndarray fwd_hap_probs: Forward haplotype probability matrix.
346+
:param numpy.ndarray bwd_hap_probs: Backward haplotype probability matrix.
347+
:param numpy.ndarray genotyped_pos: Site positions of genotyped markers.
348+
:param numpy.ndarray imputed_pos: Site positions of imputed markers.
348349
:return: Interpolated haplotype probability matrix.
349350
:rtype: numpy.ndarray
350351
"""
@@ -535,7 +536,7 @@ def run_beagle(ref_h, query_h, pos):
535536
assert bwd_hap_probs.shape == (m, 2)
536537
# Interpolate haplotype probabilities
537538
# from genotype markers to imputed markers
538-
i_hap_probs = interpolate_haplotype_probability_matrix(
539+
i_hap_probs = interpolate_allele_probabilities(
539540
fwd_hap_probs, bwd_hap_probs, genotyped_pos, imputed_pos
540541
)
541542
assert i_hap_probs.shape == (x, 2)

0 commit comments

Comments
 (0)