Skip to content

Commit 89b4ca0

Browse files
hyanwongmergify[bot]
authored andcommitted
Override VariantData.from_tree_sequence
Fixes #915
1 parent 788d4df commit 89b4ca0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/test_variantdata.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,3 +757,9 @@ def test_empty_alleles_not_at_end(self, tmp_path):
757757
samples = tsinfer.VariantData(path, "variant_ancestral_allele")
758758
with pytest.raises(ValueError, match="Empty alleles must be at the end"):
759759
tsinfer.infer(samples)
760+
761+
def test_unimplemented_from_tree_sequence(self):
762+
# NB we should reimplement something like this functionality.
763+
# Requires e.g. https://github.com/tskit-dev/tsinfer/issues/924
764+
with pytest.raises(NotImplementedError):
765+
tsinfer.VariantData.from_tree_sequence(None)

tsinfer/formats.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2785,6 +2785,10 @@ def _all_haplotypes(self, sites=None, recode_ancestral=None, samples_slice=None)
27852785
sample_index += 1
27862786
assert sample_index == samples_slice[1]
27872787

2788+
@classmethod
2789+
def from_tree_sequence(*args, **kwargs):
2790+
raise NotImplementedError("This method is not implemented for VariantData")
2791+
27882792

27892793
@attr.s(order=False, eq=False)
27902794
class Ancestor:

0 commit comments

Comments
 (0)