Skip to content

Commit 347d92c

Browse files
Add more tests on old tabix indexes
1 parent 0189ac1 commit 347d92c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed
Binary file not shown.
Binary file not shown.

tests/test_vcf_utils.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def test_context_manager_error(self):
4747
("sample_extra_contig.bcf.csi", {"19": 2, "20": 6, "X": 1}),
4848
("sample_no_genotypes.vcf.gz.csi", {"19": 2, "20": 6, "X": 1}),
4949
("CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi", {"20": 3450, "21": 16460}),
50+
(
51+
"CEUTrio.20.21.gatk3.4.g.old_tabix.vcf.bgz.tbi",
52+
{"20": RECORD_COUNT_UNKNOWN, "21": RECORD_COUNT_UNKNOWN},
53+
),
5054
("CEUTrio.20.21.gatk3.4.g.bcf.csi", {"20": 3450, "21": 16460}),
5155
("1kg_2020_chrM.vcf.gz.tbi", {"chrM": 23}),
5256
("1kg_2020_chrM.vcf.gz.csi", {"chrM": 23}),
@@ -70,6 +74,7 @@ def test_contig_record_counts(self, index_file, expected):
7074
("sample_extra_contig.vcf.gz.csi", ["19:111-", "20:14370-", "X:10-"]),
7175
("sample_no_genotypes.vcf.gz.csi", ["19:111-", "20:14370-", "X:10-"]),
7276
("CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi", ["20:1-", "21:1-"]),
77+
("CEUTrio.20.21.gatk3.4.g.old_tabix.vcf.bgz.tbi", ["20:1-", "21:1-"]),
7378
("CEUTrio.20.21.gatk3.4.g.bcf.csi", ["20:1-", "21:1-"]),
7479
("1kg_2020_chrM.vcf.gz.tbi", ["chrM:26-"]),
7580
("1kg_2020_chrM.vcf.gz.csi", ["chrM:26-"]),
@@ -93,6 +98,7 @@ def test_partition_into_one_part(self, index_file, expected):
9398
("sample.bcf.csi", 3, 9),
9499
("sample_no_genotypes.vcf.gz.csi", 3, 9),
95100
("CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi", 17, 19910),
101+
("CEUTrio.20.21.gatk3.4.g.old_tabix.vcf.bgz.tbi", 17, 19910),
96102
("CEUTrio.20.21.gatk3.4.g.bcf.csi", 3, 19910),
97103
("1kg_2020_chrM.vcf.gz.tbi", 1, 23),
98104
("1kg_2020_chrM.vcf.gz.csi", 1, 23),
@@ -122,6 +128,7 @@ def test_partition_into_max_parts(self, index_file, num_expected, total_records)
122128
("sample.bcf.csi", 9),
123129
("sample_no_genotypes.vcf.gz.csi", 9),
124130
("CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi", 19910),
131+
("CEUTrio.20.21.gatk3.4.g.old_tabix.vcf.bgz.tbi", 19910),
125132
("CEUTrio.20.21.gatk3.4.g.bcf.csi", 19910),
126133
("1kg_2020_chrM.vcf.gz.tbi", 23),
127134
("1kg_2020_chrM.vcf.gz.csi", 23),
@@ -159,8 +166,15 @@ def test_tabix_multi_chrom_bug(self):
159166
"100 kB",
160167
],
161168
)
162-
def test_target_part_size(self, target_part_size):
163-
indexed_vcf = self.get_instance("CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi")
169+
@pytest.mark.parametrize(
170+
"filename",
171+
[
172+
"CEUTrio.20.21.gatk3.4.g.vcf.bgz.tbi",
173+
"CEUTrio.20.21.gatk3.4.g.old_tabix.vcf.bgz.tbi",
174+
],
175+
)
176+
def test_target_part_size(self, target_part_size, filename):
177+
indexed_vcf = self.get_instance(filename)
164178
regions = indexed_vcf.partition_into_regions(target_part_size=target_part_size)
165179
assert len(regions) == 5
166180
part_variant_counts = [indexed_vcf.count_variants(region) for region in regions]

0 commit comments

Comments
 (0)