Set sample genotype to missing based on different conditions for SNPs and INDELS

Hello everyone,

I am using hail 0.2 and i would like to set some genotypes to missing based on different conditions for SNPs and INDELS. I want to set genotype to missing if genotype DP < 20 for SNP non-ref and DP< 30 for INDEL non-ref genotypes.

I would appreciate any help i could get. Thanks a lot in advance :slight_smile:

by “set genotype to missing”, do you mean filter the genotypes (entries)?

Then you can do:

mt = mt.filter_entries(hl.case()
     .when(hl.is_snp(mt.alleles[0], mt.alleles[1]), mt.DP < 20)
     .when(hl.is_indel(mt.alleles[0], mt.alleles[1]), mt.DP < 30)
     .default(True)) # keep if neither condition is met
1 Like

Thanks a lot