Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvittal committed Oct 1, 2024
1 parent 5b45e10 commit baec661
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hail/python/hail/vds/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def truncate_reference_blocks(ds, *, max_ref_block_base_pairs=None, ref_block_wi

# we've changed LEN so we need to make sure that END is correct.
if 'END' in new_rd.entry:
new_rd = VariantDataset._add_end(new_rd.drop('END'))
new_rd = new_rd.annotate_entries(END=new_rd.LEN + new_rd.locus.position - 1)

if isinstance(ds, hl.vds.VariantDataset):
return VariantDataset(reference_data=new_rd, variant_data=ds.variant_data)
Expand Down
7 changes: 4 additions & 3 deletions hail/python/test/hail/vds/test_vds.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,11 +895,12 @@ def test_ref_block_does_not_densify_to_next_contig():
ref = vds.reference_data
var = vds.variant_data.filter_entries(False)
# max out all chr1 refblocks, and truncate all chr2 refblocks so that nothing in chr2 should be densified
chr1_end = hl.parse_locus_interval('chr1', reference_genome=ref.locus.dtype.reference_genome).end.position
ref = ref.annotate_entries(
END=hl.if_else(
LEN=hl.if_else(
ref.locus.contig == 'chr1',
hl.parse_locus_interval('chr1', reference_genome=ref.locus.dtype.reference_genome).end.position,
ref.locus.position,
chr1_end - ref.locus.position + 1,
1,
)
)
vds = hl.vds.VariantDataset(reference_data=ref, variant_data=var)
Expand Down

0 comments on commit baec661

Please sign in to comment.