hail.vds.merge_reference_blocks

hail.vds.merge_reference_blocks(ds, equivalence_function, merge_functions=None)[source]

Merge adjacent reference blocks according to user equivalence criteria.

Examples

Coarsen GQ granularity into bins of 10 and merges blocks with the same GQ in order to compress reference data.

>>> rd = vds.reference_data 
>>> vds.reference_data = rd.annotate_entries(GQ = rd.GQ - rd.GQ % 10) 
>>> vds2 = hl.vds.merge_reference_blocks(vds,
...                                      equivalence_function=lambda block1, block2: block1.GQ == block2.GQ),
...                                      merge_functions={'MIN_DP': 'min'}) 

Notes

The equivalence_function argument expects a function from two reference blocks to a boolean value indicating whether they should be combined. Adjacency checks are builtin to the method (two reference blocks are ‘adjacent’ if the END of one block is one base before the beginning of the next).

The merge_functions

Parameters:

ds (VariantDataset or MatrixTable) – Variant dataset or reference block matrix table.

Returns:

VariantDataset or MatrixTable