Function to summarize variants types

Hi,
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 summarize.report() 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))
print(mt.aggregate_rows(hl.agg.counter(hl.agg.explode(allele_types))))

Hi,

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)?

Thanks,

This is back in 0.2!
https://hail.is/docs/devel/methods/genetics.html?highlight=summarize#hail.methods.summarize_variants

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]))

Thanks!