diff --git a/hail/python/hail/vds/combiner/variant_dataset_combiner.py b/hail/python/hail/vds/combiner/variant_dataset_combiner.py index 8eab7aa765e..27dab5fb9ed 100644 --- a/hail/python/hail/vds/combiner/variant_dataset_combiner.py +++ b/hail/python/hail/vds/combiner/variant_dataset_combiner.py @@ -428,19 +428,11 @@ def step(self): self._job_id += 1 def _write_final(self, vds): - fd = VariantDataset.ref_block_max_length_field + vds.write(self._output_path) - if fd not in vds.reference_data.globals: + if VariantDataset.ref_block_max_length_field not in vds.reference_data.globals: info("VDS combiner: computing reference block max length...") - max_len = vds.reference_data.aggregate_entries( - hl.agg.max(vds.reference_data.END + 1 - vds.reference_data.locus.position) - ) - info(f"VDS combiner: max reference block length is {max_len}") - vds = VariantDataset( - reference_data=vds.reference_data.annotate_globals(**{fd: max_len}), variant_data=vds.variant_data - ) - - vds.write(self._output_path) + hl.vds.store_ref_block_max_length(self._output_path) def _step_vdses(self): current_bin = original_bin = min(self._vdses) diff --git a/hail/python/hail/vds/variant_dataset.py b/hail/python/hail/vds/variant_dataset.py index 1a02f68026c..28d2c2b8be7 100644 --- a/hail/python/hail/vds/variant_dataset.py +++ b/hail/python/hail/vds/variant_dataset.py @@ -83,7 +83,7 @@ def store_ref_block_max_length(vds_path): ---------- vds_path : :obj:`str` """ - vds = hl.vds.read_vds(vds_path) + vds = read_vds(vds_path, _warn_no_ref_block_max_length=False) if VariantDataset.ref_block_max_length_field in vds.reference_data.globals: warning(f"VDS at {vds_path} already contains a global annotation with the max reference block length")