Skip to content

Commit c903d26

Browse files
committed
Add tskit zarr_format test
Add plink zarr_format test Add vcf zarr_format test
1 parent 2810977 commit c903d26

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

tests/test_plink.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,15 @@ def test_by_validating(
443443
validate(path, out)
444444

445445

446+
@pytest.mark.parametrize("zarr_format", [2, 3])
447+
def test_zarr_format(tmp_path, zarr_format):
448+
path = "tests/data/plink/plink_sim_10s_100v_10pmiss"
449+
out = tmp_path / "example.zarr"
450+
root = plink.convert(path, out, zarr_format=zarr_format)
451+
assert root.metadata.zarr_format == zarr_format
452+
validate(path, out)
453+
454+
446455
class TestMultipleContigs:
447456
"""Test handling of multiple contigs in PLINK files."""
448457

tests/test_tskit.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,13 @@ def test_workers(tmp_path, worker_processes):
575575
root = tsk.convert(ts, worker_processes=worker_processes)
576576
ds = load_dataset(root)
577577
assert_ts_ds_equal(ts, ds)
578+
579+
580+
@pytest.mark.parametrize("zarr_format", [2, 3])
581+
def test_zarr_format(zarr_format):
582+
ts = msprime.sim_ancestry(10, sequence_length=1000, random_seed=42)
583+
ts = add_mutations(ts)
584+
root = tsk.convert(ts, zarr_format=zarr_format)
585+
assert root.metadata.zarr_format == zarr_format
586+
ds = load_dataset(root)
587+
assert_ts_ds_equal(ts, ds)

tests/test_vcf_examples.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,16 @@ def test_worker_processes(self, ds, worker_processes):
394394
ds2 = load_dataset(root)
395395
assert_dataset_equal(ds, ds2, drop_vars=["region_index"])
396396

397+
@pytest.mark.parametrize("zarr_format", [2, 3])
398+
def test_zarr_format(self, ds, zarr_format):
399+
root = vcf_mod.convert(
400+
[self.data_path],
401+
zarr_format=zarr_format,
402+
)
403+
assert root.metadata.zarr_format == zarr_format
404+
ds2 = load_dataset(root)
405+
assert_dataset_equal(ds, ds2, drop_vars=["region_index"])
406+
397407
def test_inspect(self, tmp_path):
398408
# TODO pretty weak test, we should be doing this better somewhere else
399409
out = tmp_path / "example.vcf.zarr"

0 commit comments

Comments
 (0)