You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following post was exported from discuss.hail.is, a forum for asking questions about Hail which has since been deprecated.
(2024-01-04T16:43:49.013Z) miye said:
Hi,
I am new to hail / genomics. I have a matrix table with locus and allele as row fields, s as a column field, and GT as an entry field. I want to find the counts of each genotype for each locus. So as example:
locus alleles s GT
chr:pos [“T”,“C”] 1 0/1
chr:pos [“T”,“C”] 2 0/0
chr:pos2 [“A”,“G”] 1 0/1
chr:pos2 [“A”,“G”] 2 1/1
Note
The following post was exported from discuss.hail.is, a forum for asking questions about Hail which has since been deprecated.
(2024-01-04T16:43:49.013Z) miye said:
Hi,
I am new to hail / genomics. I have a matrix table with locus and allele as row fields, s as a column field, and GT as an entry field. I want to find the counts of each genotype for each locus. So as example:
locus alleles s GT
chr:pos [“T”,“C”] 1 0/1
chr:pos [“T”,“C”] 2 0/0
chr:pos2 [“A”,“G”] 1 0/1
chr:pos2 [“A”,“G”] 2 1/1
Then I’d want to get
locus alleles count_GT
chr:pos [“T”,“C”] {0/0: 1, 0/1:1, 1/1:0}
chr:pos2 [“A”, “G”]. {0/0:0, 0/1:1, 1/1:1}
Thank you
(2024-01-09T11:40:26.620Z) jsmadsen said:
Seems like variant_qc fits the bill, no?
(2024-01-09T17:37:25.631Z) miye said:
Yes, it seems like a very simple thing I missed:
result = hl.variant_qc(mt)
result.head(num_variants, 1).entries().show()
I was able to do it in another roundabout way but could compare the correctness.
mt = mt.annotate_entries(GT_str = hl.str(mt.GT))
row_agg_mt = mt.annotate_rows(gt_counter=hl.agg.counter(mt.GT_str))
row_agg_mt.rows().show()
Both results are giving me the same answer, so I think these are what I want, thank you jsmadsen
The text was updated successfully, but these errors were encountered: