Genotype matrix in hail 0.2


#1

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,
Wei


#2

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

mt.make_table(separator='').export('/tmp/foo.txt')

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


#3

Hi Tim,

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

Best regards,
Wei