Skip to content

Commit 94c84dd

Browse files
committed
Add a unit test for targets filter
1 parent 3d85446 commit 94c84dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_vcf_writer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@ def test_write_vcf(shared_datadir, tmp_path, output_is_path, implementation):
5555
assert_vcfs_close(path, output)
5656

5757

58+
@pytest.mark.parametrize("implementation", ["c"])
59+
def test_write_vcf__targets(shared_datadir, tmp_path, implementation):
60+
path = shared_datadir / "vcf" / "sample.vcf.gz"
61+
intermediate_icf = tmp_path.joinpath("intermediate.icf")
62+
intermediate_vcz = tmp_path.joinpath("intermediate.vcz")
63+
output = tmp_path.joinpath("output.vcf")
64+
65+
vcf2zarr.convert(
66+
[path], intermediate_vcz, icf_path=intermediate_icf, worker_processes=0
67+
)
68+
69+
write_vcf(intermediate_vcz, output, variant_targets="20", implementation=implementation)
70+
71+
v = VCF(output)
72+
73+
assert v.samples == ["NA00001", "NA00002", "NA00003"]
74+
75+
for variant in v:
76+
assert variant.CHROM == "20"
77+
78+
5879
def test_write_vcf__set_header(shared_datadir, tmp_path):
5980
path = shared_datadir / "vcf" / "sample.vcf.gz"
6081
intermediate_icf = tmp_path.joinpath("intermediate.icf")

0 commit comments

Comments
 (0)