Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jun 21, 2024
1 parent 2fe8d5e commit bb32f6f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions tests/test_nontree_fb_diploid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def verify(
):
G_vs = core.convert_haplotypes_to_phased_genotypes(H_vs)

F_vs, c_vs, ll_vs = fbd.forwards_ls_dip(n, m, G_vs, query, e_vs, r, norm=True)
F_vs, c_vs, ll_vs = fbd.forwards_ls_dip(
n, m, G_vs, query, e_vs, r, norm=True
)
B_vs = fbd.backwards_ls_dip(n, m, G_vs, query, e_vs, c_vs, r)
self.assertAllClose(np.sum(F_vs * B_vs, (1, 2)), np.ones(m))

Expand Down Expand Up @@ -62,7 +64,9 @@ def verify(
n, m, G_vs, query, e_vs, r
)
if ll_tmp != -np.inf:
B_tmp = fbd.backward_ls_dip_starting_point(n, m, G_vs, query, e_vs, r)
B_tmp = fbd.backward_ls_dip_starting_point(
n, m, G_vs, query, e_vs, r
)
self.assertAllClose(
np.log10(np.sum(F_tmp * B_tmp, (1, 2))), ll_tmp * np.ones(m)
)
Expand Down
16 changes: 12 additions & 4 deletions tests/test_nontree_vit_diploid.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def verify(self, ts, scale_mutation_rate, include_ancestors):
):
G_vs = core.convert_haplotypes_to_phased_genotypes(H_vs)

V_vs, P_vs, ll_vs = vd.forwards_viterbi_dip_low_mem(n, m, G_vs, query, e_vs, r)
V_vs, P_vs, ll_vs = vd.forwards_viterbi_dip_low_mem(
n, m, G_vs, query, e_vs, r
)
path_vs = vd.backwards_viterbi_dip(m, V_vs, P_vs)
phased_path_vs = vd.get_phased_path(n, path_vs)
path_ll_vs = vd.path_ll_dip(n, m, G_vs, phased_path_vs, query, e_vs, r)
Expand Down Expand Up @@ -57,7 +59,9 @@ def verify(self, ts, scale_mutation_rate, include_ancestors):
)
path_tmp = vd.backwards_viterbi_dip(m, V_tmp[m - 1, :, :], P_tmp)
phased_path_tmp = vd.get_phased_path(n, path_tmp)
path_ll_tmp = vd.path_ll_dip(n, m, G_vs, phased_path_tmp, query, e_vs, r)
path_ll_tmp = vd.path_ll_dip(
n, m, G_vs, phased_path_tmp, query, e_vs, r
)
self.assertAllClose(ll_tmp, path_ll_tmp)
self.assertAllClose(ll_vs, ll_tmp)

Expand All @@ -66,7 +70,9 @@ def verify(self, ts, scale_mutation_rate, include_ancestors):
)
path_tmp = vd.backwards_viterbi_dip(m, V_tmp, P_tmp)
phased_path_tmp = vd.get_phased_path(n, path_tmp)
path_ll_tmp = vd.path_ll_dip(n, m, G_vs, phased_path_tmp, query, e_vs, r)
path_ll_tmp = vd.path_ll_dip(
n, m, G_vs, phased_path_tmp, query, e_vs, r
)
self.assertAllClose(ll_tmp, path_ll_tmp)
self.assertAllClose(ll_vs, ll_tmp)

Expand All @@ -75,7 +81,9 @@ def verify(self, ts, scale_mutation_rate, include_ancestors):
)
path_tmp = vd.backwards_viterbi_dip(m, V_tmp[m - 1, :, :], P_tmp)
phased_path_tmp = vd.get_phased_path(n, path_tmp)
path_ll_tmp = vd.path_ll_dip(n, m, G_vs, phased_path_tmp, query, e_vs, r)
path_ll_tmp = vd.path_ll_dip(
n, m, G_vs, phased_path_tmp, query, e_vs, r
)
self.assertAllClose(ll_tmp, path_ll_tmp)
self.assertAllClose(ll_vs, ll_tmp)

Expand Down

0 comments on commit bb32f6f

Please sign in to comment.