@@ -14,24 +14,24 @@ def assert_part_counts_non_zero(part_counts, index_file):
1414 assert np .all (part_counts > 0 )
1515
1616
17- class TestIndexedVcf :
17+ class TestVcfFile :
1818 def get_instance (self , index_file ):
1919 vcf_path = data_path / ("." .join (list (index_file .split ("." ))[:- 1 ]))
20- return vcf_utils .IndexedVcf (vcf_path , data_path / index_file )
20+ return vcf_utils .VcfFile (vcf_path , data_path / index_file )
2121
2222 def test_context_manager_success (self ):
2323 # Nominal case
24- with vcf_utils .IndexedVcf (data_path / "sample.bcf" ) as iv :
24+ with vcf_utils .VcfFile (data_path / "sample.bcf" ) as iv :
2525 assert iv .vcf is not None
2626 assert iv .vcf is None
2727
2828 def test_context_manager_error (self ):
2929 with pytest .raises (FileNotFoundError , match = "no-such-file" ):
30- with vcf_utils .IndexedVcf (data_path / "no-such-file.bcf" ):
30+ with vcf_utils .VcfFile (data_path / "no-such-file.bcf" ):
3131 pass
3232
3333 def test_indels_filtered (self ):
34- with vcf_utils .IndexedVcf (data_path / "chr_m_indels.vcf.gz" ) as vfile :
34+ with vcf_utils .VcfFile (data_path / "chr_m_indels.vcf.gz" ) as vfile :
3535 # Hand-picked example that results in filtering
3636 region = vcf_utils .Region ("chrM" , 300 , 314 )
3737 pos = [var .POS for var in vfile .variants (region )]
@@ -173,7 +173,7 @@ def test_partition_into_n_parts_unindexed(
173173 ):
174174 copy_path = tmp_path / vcf_file
175175 shutil .copyfile (data_path / vcf_file , copy_path )
176- indexed_vcf = vcf_utils .IndexedVcf (copy_path )
176+ indexed_vcf = vcf_utils .VcfFile (copy_path )
177177 regions = list (indexed_vcf .partition_into_regions (num_parts = num_parts ))
178178 assert len (regions ) == 1
179179 part_variant_counts = np .array (
@@ -238,12 +238,12 @@ def test_partition_invalid_arguments(self):
238238 @pytest .mark .parametrize ("path" , ["y" , data_path / "xxx" , "/x/y.csi" ])
239239 def test_missing_index_file (self , path ):
240240 with pytest .raises (FileNotFoundError , match = "Specified index path" ):
241- vcf_utils .IndexedVcf (data_path / "sample.vcf.gz" , path )
241+ vcf_utils .VcfFile (data_path / "sample.vcf.gz" , path )
242242
243243 def test_bad_index_format (self ):
244244 vcf_file = data_path / "sample.vcf.gz"
245245 with pytest .raises (ValueError , match = "Only .tbi or .csi indexes" ):
246- vcf_utils .IndexedVcf (vcf_file , vcf_file )
246+ vcf_utils .VcfFile (vcf_file , vcf_file )
247247
248248 @pytest .mark .parametrize (
249249 "filename" ,
@@ -256,11 +256,11 @@ def test_bad_index_format(self):
256256 ],
257257 )
258258 def test_unindexed_single_contig (self , tmp_path , filename ):
259- f1 = vcf_utils .IndexedVcf (data_path / filename )
259+ f1 = vcf_utils .VcfFile (data_path / filename )
260260 assert f1 .index is not None
261261 copy_path = tmp_path / filename
262262 shutil .copyfile (data_path / filename , copy_path )
263- f2 = vcf_utils .IndexedVcf (copy_path )
263+ f2 = vcf_utils .VcfFile (copy_path )
264264 assert f2 .index is None
265265 crc1 = f1 .contig_record_counts ()
266266 assert len (crc1 ) == 1
@@ -280,7 +280,7 @@ def test_unindexed_single_contig(self, tmp_path, filename):
280280 def test_unindexed_multi_contig (self , tmp_path , filename ):
281281 copy_path = tmp_path / filename
282282 shutil .copyfile (data_path / filename , copy_path )
283- f = vcf_utils .IndexedVcf (copy_path )
283+ f = vcf_utils .VcfFile (copy_path )
284284 with pytest .raises (ValueError , match = "Multi-contig VCFs must be indexed" ):
285285 list (f .variants ())
286286
0 commit comments