@@ -132,7 +132,7 @@ def get_toy_data():
132
132
# For each site, the sum of backward value over all haplotypes is calculated
133
133
# before scaling and shifting.
134
134
135
- fwd_matrix_text_1 = """
135
+ beagle_forward_matrix_text_1 = """
136
136
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shiftFac,scaleFac,sumSite,val
137
137
0,0,0.000000,1.000000,0.999900,0.000100,1,0,0.000000,1.000000,0.000100,0.000100
138
138
0,1,0.000000,1.000000,0.999900,0.000100,0,0,0.000000,1.000000,1.000000,0.999900
@@ -152,7 +152,7 @@ def get_toy_data():
152
152
3,3,1.000000,0.000000,0.999900,0.000100,1,0,0.250000,0.000000,0.250050,0.000025
153
153
"""
154
154
155
- bwd_matrix_text_1 = """
155
+ beagle_backward_matrix_text_1 = """
156
156
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shiftFac,scaleFac,sumSite,val
157
157
3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,1.000000
158
158
3,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1.000000
@@ -172,7 +172,7 @@ def get_toy_data():
172
172
0,3,1.000000,0.000000,0.999900,0.000100,1,1,0.000000,0.250000,0.250050,0.250000
173
173
"""
174
174
175
- fwd_matrix_text_2 = """
175
+ beagle_forward_matrix_text_2 = """
176
176
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shiftFac,scaleFac,sumSite,val
177
177
0,0,0.000000,1.000000,0.999900,0.000100,1,1,0.000000,1.000000,0.999900,0.999900
178
178
0,1,0.000000,1.000000,0.999900,0.000100,0,1,0.000000,1.000000,1.000000,0.000100
@@ -192,7 +192,7 @@ def get_toy_data():
192
192
3,3,1.000000,0.000000,0.999900,0.000100,1,1,0.250000,0.000000,0.749950,0.249975
193
193
"""
194
194
195
- bwd_matrix_text_2 = """
195
+ beagle_backward_matrix_text_2 = """
196
196
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shiftFac,scaleFac,sumSite,val
197
197
3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,1.000000
198
198
3,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1.000000
@@ -223,39 +223,39 @@ def convert_to_numpy(matrix_text):
223
223
return df .val .to_numpy ().reshape ((4 , 4 ))
224
224
225
225
226
- def get_forward_backward_matrices ():
227
- fwd_matrix_1 = convert_to_numpy (fwd_matrix_text_1 )
228
- bwd_matrix_1 = convert_to_numpy (bwd_matrix_text_1 )
229
- fwd_matrix_2 = convert_to_numpy (fwd_matrix_text_2 )
230
- bwd_matrix_2 = convert_to_numpy (bwd_matrix_text_2 )
226
+ def get_beagle_forward_backward_matrices ():
227
+ fwd_matrix_1 = convert_to_numpy (beagle_forward_matrix_text_1 )
228
+ bwd_matrix_1 = convert_to_numpy (beagle_backward_matrix_text_1 )
229
+ fwd_matrix_2 = convert_to_numpy (beagle_forward_matrix_text_2 )
230
+ bwd_matrix_2 = convert_to_numpy (beagle_backward_matrix_text_2 )
231
231
return [fwd_matrix_1 , bwd_matrix_1 , fwd_matrix_2 , bwd_matrix_2 ]
232
232
233
233
234
- def get_test_data (matrix_text , par ):
234
+ def get_beagle_data (matrix_text , data_type ):
235
235
"""Extracts data to check forward or backward probability matrix calculations."""
236
236
df = pd .read_csv (io .StringIO (matrix_text ))
237
- if par == "switch" :
237
+ if data_type == "switch" :
238
238
# Switch probability, one per site
239
239
return df .probRec .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
240
- elif par == "mismatch" :
240
+ elif data_type == "mismatch" :
241
241
# Mismatch probability, one per site
242
242
return df .errProb .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
243
- elif par == "ref_hap_allele" :
243
+ elif data_type == "ref_hap_allele" :
244
244
# Allele in haplotype in reference panel
245
245
# 0 = ref allele, 1 = alt allele
246
246
return df .refAl .to_numpy ().reshape ((4 , 4 ))
247
- elif par == "query_hap_allele" :
247
+ elif data_type == "query_hap_allele" :
248
248
# Allele in haplotype in query
249
249
# 0 = ref allele, 1 = alt allele
250
250
return df .queryAl .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
251
- elif par == "shift" :
251
+ elif data_type == "shift" :
252
252
# Shift factor, one per site
253
253
return df .shiftFac .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
254
- elif par == "scale" :
254
+ elif data_type == "scale" :
255
255
# Scale factor, one per site
256
256
return df .scaleFac .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
257
- elif par == "sum" :
257
+ elif data_type == "sum" :
258
258
# Sum of values over haplotypes
259
259
return df .sumSite .to_numpy ().reshape ((4 , 4 ))[:, 0 ]
260
260
else :
261
- raise ValueError (f"Unknown parameter : { par } " )
261
+ raise ValueError (f"Unknown data type : { data_type } " )
0 commit comments