Skip to content

Commit

Permalink
Merge pull request #94 from szhan/refactor_test_recomb_rates
Browse files Browse the repository at this point in the history
Refactor getting recombination rates for test input
  • Loading branch information
astheeggeggs authored Jun 17, 2024
2 parents 8602727 + c1203ab commit d1d8829
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/lsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,27 @@ def get_examples_pars(
H, ts.num_samples
), "Reference haplotypes have unexpected number of copiable entries."

rs = [
r_s = [
np.zeros(m) + 0.01, # Equal recombination and mutation
np.random.rand(m), # Random
1e-5 * (np.random.rand(m) + 0.5) / 2,
]
for i in range(len(r_s)):
r_s[i][0] = 0

mus = [
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,
]

if include_extreme_rates:
rs.append(np.zeros(m) + 0.2)
rs.append(np.zeros(m) + 1e-6)
r_s.append(np.zeros(m) + 0.2)
r_s.append(np.zeros(m) + 1e-6)
mus.append(np.zeros(m) + 0.2)
mus.append(np.zeros(m) + 1e-6)

for query, r, mu in itertools.product(queries, rs, mus):
r[0] = 0
for query, r, mu in itertools.product(queries, r_s, mus):
# Must be calculated from the genotype matrix,
# because we can now get back mutations that
# result in the number of alleles being higher
Expand Down

0 comments on commit d1d8829

Please sign in to comment.