@@ -537,7 +537,7 @@ def interpolate_allele_probs(
537
537
See 'setFirstAlleleProbs', 'setAlleleProbs', and 'setLastAlleleProbs'
538
538
in 'LSHapBaum.java' in BEAGLE 4.1 source code.
539
539
540
- :param numpy.ndarray sm: Hidden state probability matrix at genotyped positions.
540
+ :param numpy.ndarray state_mat: State probability matrix at genotyped positions.
541
541
:param numpy.ndarray ref_h: Reference haplotypes subsetted to ungenotyped positions.
542
542
:param numpy.ndarray pos_typed: Physical positions of genotyped markers (bp).
543
543
:param numpy.ndarray pos_untyped: Physical positions of ungenotyped markers (bp).
@@ -566,20 +566,22 @@ def interpolate_allele_probs(
566
566
# Threshold based on "the number of subsets in the partition Am of H".
567
567
threshold_Am = np .sum (is_a_in_ref_h )
568
568
_MIN_THRESHOLD = min (0.005 , 1 / threshold_Am )
569
- sum_probs_a_k = np .sum (state_mat [k , is_a_in_ref_h ])
570
- sum_probs_a_kM1 = np .sum (state_mat [k - 1 , is_a_in_ref_h ])
571
569
if k == 0 :
572
570
# See 'setFirstAlleleProbs' in 'LSHapBaum.java'.
573
571
assert w == 1.0 , "Weight should be 1.0."
572
+ sum_probs_a_k = np .sum (state_mat [k , is_a_in_ref_h ])
574
573
if sum_probs_a_k > _MIN_THRESHOLD :
575
574
probs [i , a ] += sum_probs_a_k
576
575
elif k == m :
577
576
# See 'setLastAlleleProbs' in 'LSHapBaum.java'.
578
577
assert w == 0.0 , "Weight should be 0.0."
578
+ sum_probs_a_kM1 = np .sum (state_mat [k - 1 , is_a_in_ref_h ])
579
579
if sum_probs_a_kM1 > _MIN_THRESHOLD :
580
580
probs [i , a ] += sum_probs_a_kM1
581
581
else :
582
582
# See 'setAlleleProbs' in 'LSHapBaum.java'.
583
+ sum_probs_a_k = np .sum (state_mat [k , is_a_in_ref_h ])
584
+ sum_probs_a_kM1 = np .sum (state_mat [k - 1 , is_a_in_ref_h ])
583
585
if max (sum_probs_a_k , sum_probs_a_kM1 ) > _MIN_THRESHOLD :
584
586
probs [i , a ] += w * sum_probs_a_kM1
585
587
probs [i , a ] += (1 - w ) * sum_probs_a_k
0 commit comments