It seems quite easy to filter individuals by the presence or absence of a single variant, but I haven’t found a way to do the same for haplotypes.
I tried to create a two-snp haplotype-based annotation on my samples, but I couldn’t find a simple way of doing this with a logic statement.
Here’s what I tried, but it doesn’t seem possible to get to a specific set of entries for an individual.
mt = mt.annotate_cols(hap=hl.case() .when(mt[[locus1,alleles1],mt.s].GT.is_hom_ref & mt[[locus2,alleles2],mt.s].GT.is_hom_var, 'haplotype1') .when(mt[[locus1,alleles1],mt.s].GT.is_hom_ref & mt[[locus2, alleles2],mt.s].GT.is_hom_ref, 'haplotype2') .default('other'))
Is there an intuitive solution to this problem that I’m missing? (There is of course the option to do a series of filters to achieve the same result. Or maybe setting bitwise flags on the entries…)