Skip to content

Commit 5880435

Browse files
committed
Fix convert_to_pd_df
1 parent f8e4253 commit 5880435

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

python/tests/test_imputation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def get_toy_ts():
9797
Note that there are two sets of matrices, one for each haplotype.
9898
"""
9999
_fwd_matrix_text_1 = """
100-
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,fwdVal
100+
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,val
101101
0,0,0.000000,1.000000,0.999900,0.000100,1,0,0.000000,1.000000,0.000100,0.000100
102102
0,1,0.000000,1.000000,0.999900,0.000100,0,0,0.000000,1.000000,1.000000,0.999900
103103
0,2,0.000000,1.000000,0.999900,0.000100,1,0,0.000000,1.000000,1.000100,0.000100
@@ -117,7 +117,7 @@ def get_toy_ts():
117117
"""
118118

119119
_bwd_matrix_text_1 = """
120-
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,bwdVal
120+
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,val
121121
2,0,1.000000,0.000000,0.999900,0.000100,1,0,0.000000,0.250000,0.250050,0.250000
122122
2,1,1.000000,0.000000,0.999900,0.000100,0,0,0.000000,0.250000,0.250050,0.250000
123123
2,2,1.000000,0.000000,0.999900,0.000100,1,0,0.000000,0.250000,0.250050,0.250000
@@ -133,7 +133,7 @@ def get_toy_ts():
133133
"""
134134

135135
_fwd_matrix_text_2 = """
136-
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,fwdVal
136+
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,val
137137
0,0,0.000000,1.000000,0.999900,0.000100,1,1,0.000000,1.000000,0.999900,0.999900
138138
0,1,0.000000,1.000000,0.999900,0.000100,0,1,0.000000,1.000000,1.000000,0.000100
139139
0,2,0.000000,1.000000,0.999900,0.000100,1,1,0.000000,1.000000,1.999900,0.999900
@@ -153,7 +153,7 @@ def get_toy_ts():
153153
"""
154154

155155
_bwd_matrix_text_2 = """
156-
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,bwdVal
156+
m,h,probRec,probNoRec,noErrProb,errProb,refAl,queryAl,shift,scale,sum,val
157157
2,0,1.000000,0.000000,0.999900,0.000100,1,1,0.000000,0.250000,0.749950,0.250000
158158
2,1,1.000000,0.000000,0.999900,0.000100,0,1,0.000000,0.250000,0.749950,0.250000
159159
2,2,1.000000,0.000000,0.999900,0.000100,1,1,0.000000,0.250000,0.749950,0.250000
@@ -178,7 +178,13 @@ def convert_to_pd_df(matrix_text):
178178
assert all(df.probRec + df.probNoRec == 1)
179179
# Check that non-mismatch and mismatch probabilities sum to 1
180180
assert all(df.noErrProb + df.errProb == 1)
181-
return df
181+
matrix = df.val.to_numpy().reshape(
182+
(
183+
4,
184+
4,
185+
)
186+
) # size (m, h)
187+
return matrix
182188

183189

184190
def get_forward_backward_matrices():

0 commit comments

Comments
 (0)