Skip to content

Commit

Permalink
Fixup max_v_chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Apr 23, 2024
1 parent 667970d commit c48e94a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bio2zarr/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ def init(
root = zarr.group(store=store)

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

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

def init_array(self, root, variable):
def init_array(self, root, variable, variants_dim_size):
object_codec = None
if variable.dtype == "O":
object_codec = numcodecs.VLenUTF8()
shape = list(variable.shape)
# Truncate the variants dimension is max_variant_chunks was specified
shape[0] = variants_dim_size
a = root.empty(
variable.name,
shape=variable.shape,
shape=shape,
chunks=variable.chunks,
dtype=variable.dtype,
compressor=numcodecs.get_codec(variable.compressor),
Expand Down

0 comments on commit c48e94a

Please sign in to comment.