Genotype matrix in hail 0.2


Dear Hail team,

Given a genomic region, is it possible to output a genotype matrix (M individuals by N SNPs, in which the values are minor allele counts (0, 1, 2)) with hail 0.2?

Thank you very much!
Best regards,


Hi Wei,
Try the following:

mt = hl.import_vcf('src/test/resources/sample.vcf')

mt = hl.filter_intervals(mt, [hl.parse_locus_interval('20:10620000-10650000')])

mt = mt.select_entries(GT = mt.GT.n_alt_alleles())


You can change the interval(s) and files as necessary.


Hi Tim,

Thank you so much! That is exactly what I need.

Best regards,