@@ -537,7 +537,7 @@ def interpolate_allele_probs(
537537 See 'setFirstAlleleProbs', 'setAlleleProbs', and 'setLastAlleleProbs'
538538 in 'LSHapBaum.java' in BEAGLE 4.1 source code.
539539
540- :param numpy.ndarray sm: Hidden state probability matrix at genotyped positions.
540+ :param numpy.ndarray state_mat: State probability matrix at genotyped positions.
541541 :param numpy.ndarray ref_h: Reference haplotypes subsetted to ungenotyped positions.
542542 :param numpy.ndarray pos_typed: Physical positions of genotyped markers (bp).
543543 :param numpy.ndarray pos_untyped: Physical positions of ungenotyped markers (bp).
@@ -566,20 +566,22 @@ def interpolate_allele_probs(
566566 # Threshold based on "the number of subsets in the partition Am of H".
567567 threshold_Am = np .sum (is_a_in_ref_h )
568568 _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 ])
571569 if k == 0 :
572570 # See 'setFirstAlleleProbs' in 'LSHapBaum.java'.
573571 assert w == 1.0 , "Weight should be 1.0."
572+ sum_probs_a_k = np .sum (state_mat [k , is_a_in_ref_h ])
574573 if sum_probs_a_k > _MIN_THRESHOLD :
575574 probs [i , a ] += sum_probs_a_k
576575 elif k == m :
577576 # See 'setLastAlleleProbs' in 'LSHapBaum.java'.
578577 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 ])
579579 if sum_probs_a_kM1 > _MIN_THRESHOLD :
580580 probs [i , a ] += sum_probs_a_kM1
581581 else :
582582 # 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 ])
583585 if max (sum_probs_a_k , sum_probs_a_kM1 ) > _MIN_THRESHOLD :
584586 probs [i , a ] += w * sum_probs_a_kM1
585587 probs [i , a ] += (1 - w ) * sum_probs_a_k
0 commit comments