@@ -791,14 +791,25 @@ def test_split_explode(tmp_path):
791
791
"tests/data/vcf/sample.vcf.gz.3.split/X.vcf.gz" ,
792
792
]
793
793
out = tmp_path / "test.explode"
794
- pcvcf = vcf .explode_init (paths , out , num_partitions = 15 )
795
- with open (out / "num_partitions.txt" , "r" ) as f :
796
- num_partitions = int (f .read ())
797
- assert pcvcf .num_partitions == num_partitions
798
- assert num_partitions == 3
799
- vcf .explode_slice (out , 0 , num_partitions )
800
- vcf .explode_finalise (out )
794
+ pcvcf = vcf .explode_init (paths , out , target_num_partitions = 15 )
795
+ assert pcvcf .num_partitions == 3
796
+ assert vcf .explode_partition_count (out ) == 3
801
797
802
- vcf .encode (out , tmp_path / "test.zarr" )
798
+ with pytest .raises (ValueError ):
799
+ vcf .explode_slice (out , - 1 , 3 )
800
+ with pytest .raises (ValueError ):
801
+ vcf .explode_slice (out , 0 , 42 )
803
802
803
+ vcf .explode_slice (out , 0 , 3 )
804
+ vcf .explode_finalise (out )
805
+ pcvcf = vcf .PickleChunkedVcf .load (out )
806
+ assert pcvcf .columns ['POS' ].vcf_field .summary .asdict () == {
807
+ 'num_chunks' : 3 ,
808
+ 'compressed_size' : 587 ,
809
+ 'uncompressed_size' : 1008 ,
810
+ 'max_number' : 1 ,
811
+ 'max_value' : 1235237 ,
812
+ 'min_value' : 10
813
+ }
814
+ vcf .encode (out , tmp_path / "test.zarr" )
804
815
vcf .validate ("tests/data/vcf/sample.vcf.gz" , tmp_path / "test.zarr" )
0 commit comments