@@ -325,26 +325,27 @@ def compute_state_probability_matrix(fm, bm, ref_h, query_h, rho, mu):
325
325
return (sm , fwd_hap_probs , bwd_hap_probs )
326
326
327
327
328
- def interpolate_haplotype_probability_matrix (
328
+ def interpolate_allele_probabilities (
329
329
fwd_hap_probs , bwd_hap_probs , genotyped_pos , imputed_pos
330
330
):
331
331
"""
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.
333
334
334
335
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.
336
337
Here, we assume all biallelic sites, hence the 2.
337
338
338
339
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.
340
341
Again, we assume all biallelic sites, hence the 2.
341
342
342
343
This implementation is based on Equation 2 (the rearranged one) in BB2016.
343
344
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.
348
349
:return: Interpolated haplotype probability matrix.
349
350
:rtype: numpy.ndarray
350
351
"""
@@ -535,7 +536,7 @@ def run_beagle(ref_h, query_h, pos):
535
536
assert bwd_hap_probs .shape == (m , 2 )
536
537
# Interpolate haplotype probabilities
537
538
# from genotype markers to imputed markers
538
- i_hap_probs = interpolate_haplotype_probability_matrix (
539
+ i_hap_probs = interpolate_allele_probabilities (
539
540
fwd_hap_probs , bwd_hap_probs , genotyped_pos , imputed_pos
540
541
)
541
542
assert i_hap_probs .shape == (x , 2 )
0 commit comments