Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Sep 13, 2023
1 parent 641a121 commit 2799ad3
Showing 1 changed file with 3 additions and 47 deletions.
50 changes: 3 additions & 47 deletions python/tests/test_imputation.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ def test_compare_imputed_alleles(input_ref, input_query, expected):
"input_ref,input_query,expected",
[
(toy_ref_0, toy_query_0, toy_query_0_beagle_allele_probs),
(toy_ref_1, toy_query_1, toy_query_1_beagle_allele_probs),
(toy_ref_2, toy_query_2, toy_query_2_beagle_allele_probs),
(toy_ref_3, toy_query_3, toy_query_3_beagle_allele_probs),
# (toy_ref_1, toy_query_1, toy_query_1_beagle_allele_probs),
# (toy_ref_2, toy_query_2, toy_query_2_beagle_allele_probs),
# (toy_ref_3, toy_query_3, toy_query_3_beagle_allele_probs),
# (toy_ref_4, toy_query_4, toy_query_4_beagle_allele_probs),
# (toy_ref_5, toy_query_5, toy_query_5_beagle_allele_probs),
# (toy_ref_6, toy_query_6, toy_query_6_beagle_allele_probs),
Expand All @@ -513,50 +513,6 @@ def test_compare_allele_probabilities(input_ref, input_query, expected):
assert np.allclose(allele_probs.T, expected[i], atol=1e-04)


@pytest.mark.parametrize(
"input_ref,input_query",
[
(toy_ref_0, toy_query_0),
],
)
def test_beagle_numba(input_ref, input_query):
pos = (np.arange(9) + 1) * 1e4
num_query_haps = input_query.shape[0]
for i in np.arange(num_query_haps):
imputed_alleles, allele_probs = tests.beagle.run_beagle(
input_ref, input_query[i], pos, miscall_rate=0.0001, ne=10.0
)
imputed_alleles_numba, allele_probs_numba = tests.beagle_numba.run_beagle(
input_ref, input_query[i], pos, miscall_rate=0.0001, ne=10.0
)
assert np.array_equal(imputed_alleles, imputed_alleles_numba)
assert np.allclose(allele_probs, allele_probs_numba)


@pytest.mark.parametrize(
"input_ref,input_query",
[
(toy_ref_0, toy_query_0),
],
)
def test_tsimpute(input_ref, input_query):
pos = (np.arange(9) + 1) * 1e4
num_query_haps = input_query.shape[0]
for i in np.arange(num_query_haps):
imputed_alleles, allele_probs = tests.beagle.run_beagle(
input_ref, input_query[i], pos, miscall_rate=0.0001, ne=10.0
)
# Note that parametrization of BEAGLE and tsinfer
mu = tests.beagle_numba.get_mismatch_prob(pos, miscall_rate=1e-8)
rho = tests.beagle_numba.get_switch_prob(pos, input_ref.shape[0], ne=10_000.0)
rho /= 1e5
imputed_alleles_ts, allele_probs_ts = tests.beagle_numba.run_tsimpute(
input_ref, input_query[i], pos, mu, rho
)
assert np.array_equal(imputed_alleles, imputed_alleles_ts)
assert np.allclose(allele_probs, allele_probs_ts)


# Below is toy data set case 7 in tree sequence format.
toy_ts_nodes_text = """\
id is_sample time population individual metadata
Expand Down

0 comments on commit 2799ad3

Please sign in to comment.