@@ -40,29 +40,54 @@ def test_simple_tree_sequence(self, tmp_path):
40
40
tmp_path / "test.trees" , zarr_path , ind_nodes , show_progress = False
41
41
)
42
42
zroot = zarr .open (zarr_path , mode = "r" )
43
- assert zroot ["variant_position" ].shape == (3 ,)
44
- assert list (zroot ["variant_position" ][:]) == [10 , 20 , 30 ]
43
+ pos = zroot ["variant_position" ][:]
44
+ assert pos .shape == (3 ,)
45
+ assert pos .dtype == np .int8
46
+ assert np .array_equal (pos , [10 , 20 , 30 ])
45
47
46
48
alleles = zroot ["variant_allele" ][:]
49
+ assert alleles .shape == (3 , 2 )
50
+ assert alleles .dtype == "O"
47
51
assert np .array_equal (alleles , [["A" , "T" ], ["C" , "G" ], ["G" , "A" ]])
48
52
49
53
genotypes = zroot ["call_genotype" ][:]
54
+ assert genotypes .shape == (3 , 2 , 2 )
55
+ assert genotypes .dtype == np .int8
50
56
assert np .array_equal (
51
57
genotypes , [[[1 , 1 ], [0 , 0 ]], [[0 , 0 ], [1 , 1 ]], [[1 , 0 ], [0 , 0 ]]]
52
58
)
53
59
54
60
phased = zroot ["call_genotype_phased" ][:]
61
+ assert phased .shape == (3 , 2 )
62
+ assert phased .dtype == np .bool
55
63
assert np .all (phased )
56
64
57
65
contigs = zroot ["contig_id" ][:]
66
+ assert contigs .shape == (1 ,)
67
+ assert contigs .dtype == "O"
58
68
assert np .array_equal (contigs , ["1" ])
59
69
60
70
contig = zroot ["variant_contig" ][:]
71
+ assert contig .shape == (3 ,)
72
+ assert contig .dtype == np .int8
61
73
assert np .array_equal (contig , [0 , 0 , 0 ])
62
74
63
75
samples = zroot ["sample_id" ][:]
76
+ assert samples .shape == (2 ,)
77
+ assert samples .dtype == "O"
64
78
assert np .array_equal (samples , ["tsk_0" , "tsk_1" ])
65
79
80
+ assert set (zroot .array_keys ()) == {
81
+ "variant_position" ,
82
+ "variant_allele" ,
83
+ "call_genotype" ,
84
+ "call_genotype_phased" ,
85
+ "call_genotype_mask" ,
86
+ "contig_id" ,
87
+ "variant_contig" ,
88
+ "sample_id" ,
89
+ }
90
+
66
91
67
92
class TestTskitFormat :
68
93
"""Unit tests for TskitFormat without using full conversion."""
0 commit comments