Skip to content

Commit

Permalink
Rename get_mutation_rates to get_mismatch_probs
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Feb 23, 2024
1 parent 6a2035d commit 1c2e37b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions python/tests/beagle_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ def convert_to_genetic_map_positions(pos, genetic_map=None):
return est_cm


def get_mutation_rates(pos, error_rate):
def get_mismatch_probs(pos, error_rate):
"""
Set mutation rates at genotyped positions.
Compute mismatch probabilities at genotyped positions.
Mutation rates should be dominated by the allele error rate.
Mutation rates should be dominated by the rate of allele error,
which should be the main source of mismatch between query and
reference haplotypes.
In BEAGLE 4.1/5.4, the default value is set to 0.0001 and capped at 0.50.
In IMPUTE5, the default value is also set to 0.0001.
In BEAGLE 4.1/5.4, the default value is set to 1e-4 and capped at 0.50.
In IMPUTE5, the default value is also set to 1e-4.
When using `_tskit.LsHmm`, this is `mu`.
Expand All @@ -169,8 +171,8 @@ def get_mutation_rates(pos, error_rate):
MAX_ERROR_RATE = 0.5
if error_rate >= MAX_ERROR_RATE:
error_rate = MAX_ERROR_RATE
mu = np.zeros(len(pos), dtype=np.float64) + error_rate
return mu
mismatch_probs = np.zeros(len(pos), dtype=np.float64) + error_rate
return mismatch_probs


def get_recombination_rates(cm, h, ne):
Expand Down Expand Up @@ -472,7 +474,7 @@ def run_interpolation_beagle(
# Get rates at genotyped markers.
h = ref_h.shape[1]
rho = get_recombination_rates(typed_cm, h=h, ne=ne)
mu = get_mutation_rates(typed_pos, error_rate=error_rate)
mu = get_mismatch_probs(typed_pos, error_rate=error_rate)
# Compute matrices at genotyped markers.
fm = compute_forward_matrix(ref_h_typed, query_h_typed, rho, mu)
bm = compute_backward_matrix(ref_h_typed, query_h_typed, rho, mu)
Expand Down

0 comments on commit 1c2e37b

Please sign in to comment.