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