hail
hail copied to clipboard
[query] Refactor vds.sample_qc to use independent aggregators
This will allow expert users to import these functions directly and use them in, for example, grouped aggregators.
from hail.vds.sample_qc import vmt_sample_qc, vmt_sample_qc_variant_annotations
vmt = vds.variant_data
vmt = vmt.annotate_entries(GT=hl.vds.lgt_to_gt(vmt.LGT, vmt.LA))
ac, atype = vmt_sample_qc_variant_annotations(global_gt=vmt.GT, alleles=vmt.alleles)
vmt = vmt.annotate_rows(group=compute_variant_group(vmt), ac=ac, atype=atype)
vmt = vmt.annotate_cols(
qc=hl.agg.group_by(
vmt.group,
vmt_sample_qc(
global_gt=vmt.GT,
gq=vmt.GQ,
ac=vmt.ac,
atype=vmt.atype,
dp=vmt.DP
)
)
)