@@ -87,9 +87,9 @@ def get_weights(genotyped_pos, ungenotyped_pos):
8787 genotyped_cm = convert_to_genetic_map_position (genotyped_pos )
8888 ungenotyped_cm = convert_to_genetic_map_position (ungenotyped_pos )
8989 # Calculate weights for ungenotyped markers.
90- weights = np .zeros (x , dtype = np .float64 )
90+ weights = np .zeros (x , dtype = np .float32 )
9191 # Identify genotype markers k and k + 1 sandwiching marker i.
92- marker_interval_start = np .zeros (x , dtype = np .int64 )
92+ marker_interval_start = np .zeros (x , dtype = np .int32 )
9393 for i in np .arange (x ):
9494 if ungenotyped_pos [i ] < genotyped_pos [0 ]:
9595 # Ungenotyped marker is before the first genotyped marker.
@@ -126,7 +126,7 @@ def get_mismatch_prob(pos, miscall_rate):
126126 assert isinstance (miscall_rate , float )
127127 if miscall_rate >= 0.5 :
128128 miscall_rate = 0.5
129- mu = np .zeros (len (pos ), dtype = np .float64 ) + miscall_rate
129+ mu = np .zeros (len (pos ), dtype = np .float32 ) + miscall_rate
130130 return mu
131131
132132
@@ -150,7 +150,7 @@ def get_switch_prob(pos, h, ne):
150150 assert isinstance (ne , float ), "Effective population size is not a float."
151151 # Get genetic distance between adjacent markers.
152152 cm = convert_to_genetic_map_position (pos )
153- d = np .zeros (len (pos ), dtype = np .float64 )
153+ d = np .zeros (len (pos ), dtype = np .float32 )
154154 d [0 ] = cm [0 ]
155155 d [1 :] = cm [1 :] - cm [:- 1 ]
156156 assert len (d ) == len (pos )
@@ -185,7 +185,7 @@ def compute_forward_probability_matrix(ref_h, query_h, rho, mu):
185185 assert m == len (mu )
186186 assert 0 <= np .min (rho ) and np .max (rho ) <= 1
187187 assert 0 <= np .min (mu ) and np .max (mu ) <= 0.5
188- fm = np .zeros ((m , h ), dtype = np .float64 )
188+ fm = np .zeros ((m , h ), dtype = np .float32 )
189189 last_sum = 1.0 # Part of normalization factor
190190 for i in np .arange (m ):
191191 # Get site-specific parameters.
@@ -236,7 +236,7 @@ def compute_backward_probability_matrix(ref_h, query_h, rho, mu):
236236 assert m == len (mu )
237237 assert 0 <= np .min (rho ) and np .max (rho ) <= 1
238238 assert 0 <= np .min (mu ) and np .max (mu ) <= 0.5
239- bm = np .zeros ((m , h ), dtype = np .float64 )
239+ bm = np .zeros ((m , h ), dtype = np .float32 )
240240 bm [- 1 , :] = 1.0 / h # Initialise the last column
241241 for i in np .arange (m - 2 , - 1 , - 1 ):
242242 query_a = query_h [i + 1 ]
@@ -330,9 +330,9 @@ def _compute_state_probability_matrix(fm, bm, ref_h, query_h, rho, mu):
330330 assert 0 <= np .min (rho ) and np .max (rho ) <= 1
331331 assert 0 <= np .min (mu ) and np .max (mu ) <= 0.5
332332 # m + 1 columns to allow for imputed markers right of the last genotyped marker.
333- sm = np .zeros ((m + 1 , h ), dtype = np .float64 )
334- fwd_hap_probs = np .zeros ((m , 4 ), dtype = np .float64 )
335- bwd_hap_probs = np .zeros ((m , 4 ), dtype = np .float64 )
333+ sm = np .zeros ((m + 1 , h ), dtype = np .float32 )
334+ fwd_hap_probs = np .zeros ((m , 4 ), dtype = np .float32 )
335+ bwd_hap_probs = np .zeros ((m , 4 ), dtype = np .float32 )
336336 for i in np .arange (m - 1 , - 1 , - 1 ):
337337 for j in np .arange (h ):
338338 sm [i , j ] = fm [i , j ] * bm [i , j ]
@@ -384,7 +384,7 @@ def _interpolate_allele_probabilities(
384384 assert x == len (imputed_cm )
385385 weights , _ = get_weights (genotyped_cm , imputed_cm )
386386 assert x == len (weights )
387- i_hap_probs = np .zeros ((x , 2 ), dtype = np .float64 )
387+ i_hap_probs = np .zeros ((x , 2 ), dtype = np .float32 )
388388 for i in np .arange (x ):
389389 # Identify the genotyped markers k and k + 1 sandwiching ungenotyped marker i.
390390 if ungenotyped_pos [i ] < genotyped_pos [0 ]:
@@ -426,7 +426,7 @@ def compute_state_probability_matrix(fm, bm):
426426 assert not np .any (bm < 0 ), "Backward probability matrix has negative values."
427427 assert not np .any (np .isnan (bm )), "Backward probability matrix has NaN values."
428428 # m + 1 columns to allow for imputed markers right of the last genotyped marker.
429- sm = np .zeros ((m + 1 , h ), dtype = np .float64 )
429+ sm = np .zeros ((m + 1 , h ), dtype = np .float32 )
430430 sm [:- 1 , :] = np .multiply (fm , bm )
431431 sm [m , :] = sm [m - 1 , :] # Not in BEAGLE
432432 return sm
@@ -464,7 +464,7 @@ def interpolate_allele_probabilities(sm, ref_h, genotyped_pos, ungenotyped_pos):
464464 weights , marker_interval_start = get_weights (genotyped_pos , ungenotyped_pos )
465465 assert x == len (weights )
466466 assert x == len (marker_interval_start )
467- p = np .zeros ((x , len (alleles )), dtype = np .float64 )
467+ p = np .zeros ((x , len (alleles )), dtype = np .float32 )
468468 # Compute allele probabilities as per Equation 1 in BB2016.
469469 for a in alleles :
470470 # Going from left to right.
0 commit comments