How to get the ration transition-transversion on all dataset?


With mt, a matrix table of variants (import from VCF)
I found that hl.sample_qc(mt) give me the ration of transition/transversion by sample (mt.sample_qc.r_ti_tv).

Is it possible to get the ration not by sample but for all the dataset ?
(similar at what VCFstats is giving)

I’ll add this to summarize_variants – that’s where this should live!

For now, you can do the following (assuming biallelic):

In [2]: mt.aggregate_rows(
    hl.agg.count_where(hl.is_transition(mt.alleles[0], mt.alleles[1])) / 
    hl.agg.count_where(hl.is_transversion(mt.alleles[0], mt.alleles[1])))
1 Like

Will be present in 0.2.31: