diff --git a/tests/test_normalise.py b/tests/test_normalise.py index 6db4ba5..582a856 100644 --- a/tests/test_normalise.py +++ b/tests/test_normalise.py @@ -5,6 +5,7 @@ import zarr from numpy.testing import assert_array_equal +from vczstore.append import append from vczstore.normalise import ( index_variants, normalise, @@ -12,6 +13,8 @@ variant_alleles_are_equivalent, ) +from .utils import compare_vcf_and_vcz, convert_vcf_to_vcz + # TODO: replace this with make_vcz in vcztools/bio2zarr # see https://github.com/sgkit-dev/vczstore/issues/37 @@ -324,3 +327,18 @@ def test_normalise__other_call_fields_not_implemented(): with pytest.raises(NotImplementedError): normalise(vcz1, vcz2, vcz2_norm) + + +def test_normalise_and_append(tmp_path): + vcz0 = convert_vcf_to_vcz("sample-variants.vcf.gz", tmp_path, ploidy=2) + vcz1 = convert_vcf_to_vcz("sample-part1.vcf.gz", tmp_path) + vcz1_norm = zarr.storage.MemoryStore() + + normalise(vcz0, vcz1, vcz1_norm) + + append(vcz0, vcz1_norm) + + # check equivalence with original VCF + compare_vcf_and_vcz( + tmp_path, "view --no-version", "sample-part1.vcf.gz", "view --no-version", vcz0 + ) diff --git a/uv.lock b/uv.lock index 99d5ae3..8627741 100644 --- a/uv.lock +++ b/uv.lock @@ -52,8 +52,8 @@ wheels = [ [[package]] name = "bio2zarr" -version = "0.2.0" -source = { git = "https://github.com/sgkit-dev/bio2zarr.git#fb26d23d1f091a6a7f85773de0ceadf80fe8a332" } +version = "0.2.1.dev2" +source = { git = "https://github.com/sgkit-dev/bio2zarr.git#4b50f8803d05ac7ea0a3fa8537cc7c9a3389493f" } dependencies = [ { name = "click" }, { name = "coloredlogs" }, diff --git a/vczstore/normalise.py b/vczstore/normalise.py index bd5f1e5..be83ff6 100644 --- a/vczstore/normalise.py +++ b/vczstore/normalise.py @@ -1,6 +1,6 @@ import numpy as np import zarr -from bio2zarr.zarr_utils import create_empty_group_array, get_compressor +from bio2zarr.zarr_utils import create_empty_group_array, get_compressor_config from more_itertools import peekable from vcztools.constants import STR_FILL, STR_MISSING from vcztools.retrieval import VczReader @@ -51,7 +51,7 @@ def normalise(vcz1, vcz2, vcz2_norm): shape=shape, dtype=arr.dtype, chunks=chunks, - compressor=get_compressor(arr), + compressor=get_compressor_config(arr), dimension_names=array_dims(arr), ) else: @@ -66,7 +66,7 @@ def normalise(vcz1, vcz2, vcz2_norm): shape=arr.shape, dtype=arr.dtype, chunks=arr.chunks, - compressor=get_compressor(arr), + compressor=get_compressor_config(arr), dimension_names=array_dims(arr), )