Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jun 24, 2024
1 parent 54556c5 commit 1009d83
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions python/tests/test_haplotype_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ def update_probabilities(self, site, haplotype_state):
match = haplotype_state == allelic_state[v]
is_query_missing = haplotype_state == MISSING
# Note that the node u is used only by Viterbi
st.value = self.compute_next_probability(site.id, st.value, match, is_query_missing, u)
st.value = self.compute_next_probability(
site.id, st.value, match, is_query_missing, u
)

# Unset the states
allelic_state[tree.root] = -1
Expand Down Expand Up @@ -403,7 +405,9 @@ def run(self, h):
def compute_normalisation_factor(self):
raise NotImplementedError()

def compute_next_probability(self, site_id, p_last, is_match, is_query_missing, node):
def compute_next_probability(
self, site_id, p_last, is_match, is_query_missing, node
):
raise NotImplementedError()


Expand Down Expand Up @@ -434,7 +438,9 @@ def compute_normalisation_factor(self):
s += self.N[j] * st.value
return s

def compute_next_probability(self, site_id, p_last, is_match, is_query_missing, node):
def compute_next_probability(
self, site_id, p_last, is_match, is_query_missing, node
):
rho = self.rho[site_id]
n = self.ts.num_samples
if is_query_missing:
Expand All @@ -450,7 +456,9 @@ class BackwardAlgorithm(ForwardAlgorithm):
The Li and Stephens backward algorithm.
"""

def compute_next_probability(self, site_id, p_next, is_match, is_query_missing, node):
def compute_next_probability(
self, site_id, p_next, is_match, is_query_missing, node
):
if is_query_missing:
p_e = 1.0
else:
Expand Down Expand Up @@ -520,7 +528,9 @@ def compute_normalisation_factor(self):
)
return max_st.value

def compute_next_probability(self, site_id, p_last, is_match, is_query_missing, node):
def compute_next_probability(
self, site_id, p_last, is_match, is_query_missing, node
):
rho = self.rho[site_id]
n = self.ts.num_samples

Expand Down

0 comments on commit 1009d83

Please sign in to comment.