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