Error in variant/sample QC. Malformed VCF?

Hi Hail,

I am getting an error when running sample_qc() and it seems like there is some irregularity in the VCF file. Could you please suggest what should be the best way to find out what is wrong in the VCF?

below is the code and error. Thanks!
Nikita

mt = hl.split_multi(mt)
mt = mt.filter_rows(hl.len(mt.filters) == 0)
mt = mt.filter_entries(mt.DP >=8 )
mt = mt.filter_entries(mt.GQ >=20)
ab = mt.AD[1] / hl.sum(mt.AD)

filter_condition_ab = (
    hl.case()
    .when(mt.GT.is_hom_ref(), ab <= 0.1)
    .when(mt.GT.is_het(), (ab >= 0.25) & (ab <= 0.75))
    .default(ab >= 0.9)
)

mt = mt.filter_entries(filter_condition_ab)
mt = hl.variant_qc(mt)
mt = mt.filter_rows(mt.variant_qc.call_rate > 0)
mt = hl.sample_qc(mt)
mt.sample_qc.show(5)

Hail version: 0.2.64-1ef70187dc78
Error summary: HailException: array index out of bounds: index=2, length=2

Python traceback:
File “”, line 1, in
mt = hl.sample_qc(mt)

File “”, line 2, in sample_qc

File “/anaconda3/envs/hail/lib/python3.7/site-packages/hail/methods/qc.py”, line 129, in sample_qc
bound_exprs[‘n_singleton’] = hl.agg.sum(hl.sum(hl.range(0, mt[‘GT’].ploidy).map(lambda i: mt[variant_ac][mt[‘GT’][i]] == 1)))

File “”, line 2, in map

File “/anaconda3/envs/hail/lib/python3.7/site-packages/hail/methods/qc.py”, line 129, in
bound_exprs[‘n_singleton’] = hl.agg.sum(hl.sum(hl.range(0, mt[‘GT’].ploidy).map(lambda i: mt[variant_ac][mt[‘GT’][i]] == 1)))

I think the issue here is you need split_multi_hts not split_multi - the former doesn’t rewrite genotype fields, the latter does. This isn’t super intuitive.

Thanks Tim! this resolved the problem