Skip to content

Commit

Permalink
Merge pull request #106 from szhan/add_tests_prob_mutation_none
Browse files Browse the repository at this point in the history
Add tests when prob_mutation is not specified
  • Loading branch information
szhan authored Jun 18, 2024
2 parents 6f9977c + 7107a35 commit 309aa18
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/lsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_examples_diploid(self, ts, include_ancestors):
query_miss_most[:, 1:] = core.MISSING
queries = [query_1, query_2, query_miss_last, query_miss_mid, query_miss_most]
# Exclude the arbitrarily chosen queries from the reference panel.
ref_panel = ref_panel[:, 4:]
# ref_panel = ref_panel[:, 4:]
return ref_panel, queries

def get_examples_pars(
Expand Down Expand Up @@ -148,6 +148,7 @@ def get_examples_pars(
np.zeros(m) + 0.01, # Equal recombination and mutation
np.random.rand(m) * 0.2, # Random
1e-5 * (np.random.rand(m) + 0.5) / 2,
None,
]

if include_extreme_rates:
Expand All @@ -162,17 +163,20 @@ def get_examples_pars(
# result in the number of alleles being higher
# than the number of alleles in the reference panel.
num_alleles = core.get_num_alleles(H, query)
prob_mutation = mu
if prob_mutation is None:
prob_mutation = np.zeros(m) + core.estimate_mutation_probability(n)
if ploidy == 1:
e = core.get_emission_matrix_haploid(
mu=mu,
mu=prob_mutation,
num_sites=m,
num_alleles=num_alleles,
scale_mutation_rate=scale_mutation_rate,
)
yield n, m, H, query, e, r, mu
else:
e = core.get_emission_matrix_diploid(
mu=mu,
mu=prob_mutation,
num_sites=m,
num_alleles=num_alleles,
scale_mutation_rate=scale_mutation_rate,
Expand Down

0 comments on commit 309aa18

Please sign in to comment.