Skip to content

Commit c48e94a

Browse files
Fixup max_v_chunks
1 parent 667970d commit c48e94a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bio2zarr/vcf.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ def init(
16701670
root = zarr.group(store=store)
16711671

16721672
for column in self.schema.columns.values():
1673-
self.init_array(root, column)
1673+
self.init_array(root, column, partitions[-1].stop_index)
16741674

16751675
logger.info("Writing WIP metadata")
16761676
with open(self.wip_path / "metadata.json", "w") as f:
@@ -1718,13 +1718,16 @@ def encode_filter_id(self, root):
17181718
)
17191719
array.attrs["_ARRAY_DIMENSIONS"] = ["filters"]
17201720

1721-
def init_array(self, root, variable):
1721+
def init_array(self, root, variable, variants_dim_size):
17221722
object_codec = None
17231723
if variable.dtype == "O":
17241724
object_codec = numcodecs.VLenUTF8()
1725+
shape = list(variable.shape)
1726+
# Truncate the variants dimension is max_variant_chunks was specified
1727+
shape[0] = variants_dim_size
17251728
a = root.empty(
17261729
variable.name,
1727-
shape=variable.shape,
1730+
shape=shape,
17281731
chunks=variable.chunks,
17291732
dtype=variable.dtype,
17301733
compressor=numcodecs.get_codec(variable.compressor),

0 commit comments

Comments
 (0)