6
6
import numpy as np
7
7
import pytest
8
8
import zarr
9
- from bio2zarr import icf
10
9
from cyvcf2 import VCF
11
10
from numpy .testing import assert_array_equal
12
11
@@ -301,15 +300,9 @@ def test_write_vcf__header_flags(tmp_path):
301
300
assert_vcfs_close (original , output )
302
301
303
302
304
- def test_write_vcf__generate_header (tmp_path ):
303
+ def test_write_vcf__generate_header ():
305
304
original = pathlib .Path ("tests/data/vcf" ) / "sample.vcf.gz"
306
- # don't use cache here since we mutate the vcz
307
- vcz = tmp_path .joinpath ("intermediate.vcz" )
308
- icf .convert ([original ], vcz , worker_processes = 0 , local_alleles = False )
309
-
310
- # remove vcf_header
311
- root = zarr .open (vcz , mode = "r+" )
312
- del root .attrs ["vcf_header" ]
305
+ vcz = vcz_path_cache (original )
313
306
314
307
output_header = StringIO ()
315
308
write_vcf (vcz , output_header , header_only = True , no_version = True )
@@ -324,9 +317,9 @@ def test_write_vcf__generate_header(tmp_path):
324
317
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
325
318
##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
326
319
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
327
- ##FILTER=<ID=PASS,Description="">
328
- ##FILTER=<ID=s50,Description="">
329
- ##FILTER=<ID=q10,Description="">
320
+ ##FILTER=<ID=PASS,Description="All filters passed ">
321
+ ##FILTER=<ID=s50,Description="Less than 50% of samples have data ">
322
+ ##FILTER=<ID=q10,Description="Quality below 10 ">
330
323
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
331
324
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
332
325
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
@@ -338,6 +331,7 @@ def test_write_vcf__generate_header(tmp_path):
338
331
""" # noqa: E501
339
332
340
333
# substitute value of source
334
+ root = zarr .open (vcz , mode = "r+" )
341
335
expected_vcf_header = expected_vcf_header .format (root .attrs ["source" ])
342
336
343
337
assert output_header .getvalue () == expected_vcf_header
0 commit comments