Function to summarize variants types

In the former version of Hail, there was an interesting function: vds.summarize().report(). I can’t find something like this in Hail 0.2. Did you keep a similar function? How can I see all the types of variants, please?

Hi Laura,
We unfortunately don’t a similar function in 0.2, but we can certainly add it! Which of the information in was the most useful?

To see an allele count, you can do this:

allele_types = mt.alleles[1:].map(lambda alt: hl.allele_type(mt.alleles[0], alt))


The most useful was to see all the types of variants and their counts (SNP, insertions, deletions) and it was great to take a first look at our dataset.
By the way, is it possible to filter by kind of variants (filter only SNP)?


This is back in 0.2!

It’s definitely possible to filter by variant type. The complication is that there’s a type per alternate allele, so if you have multiallelics, the logic is more complicated. This will work if you have only biallelic variants:

mt = mt.filter_rows(hl.is_snp(mt.alleles[0], mt.alleles[1]))