Skip to content

Commit

Permalink
Explicitly guard against > 2 alleles in HMM.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Dec 18, 2020
1 parent 050fc94 commit 2ed3483
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,23 @@ def verify_data_round_trip(
ts, genotypes, positions, alleles, sample_data.sequence_length
)

# Skipping these tests as the HMM is currently not working properly
# for > 2 alleles, and we we have a guard on this just to make
# sure that no user-data uses the faulty engine. Renable these
# when the HMM is fixed.

@pytest.mark.skip("Not currently working for > 2 alleles; #415")
def test_triallelic(self):
pass

@pytest.mark.skip("Not currently working for > 2 alleles; #415")
def test_n_allelic(self):
pass

@pytest.mark.skip("Not currently working for > 2 alleles; #415")
def test_not_all_alleles_in_genotypes(self):
pass


class TestMissingDataRoundTrip(TestRoundTrip):
"""
Expand Down
2 changes: 2 additions & 0 deletions tsinfer/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,8 @@ def __init__(
# quickly be big enough even for very large instances.
max_edges = 64 * 1024
max_nodes = 64 * 1024
if np.any(num_alleles > 2):
raise ValueError("Cannot currently match with > 2 alleles.")
self.tree_sequence_builder = self.tree_sequence_builder_class(
num_alleles=num_alleles, max_nodes=max_nodes, max_edges=max_edges
)
Expand Down

0 comments on commit 2ed3483

Please sign in to comment.