Filtering de-novo and recessive variants

Hi,

I have this matrix table (proband, father, mother):
image

I wonder what is the best way to annotate de-novo and recessive variants (those with GT of 0/1).
Any suggestions for an efficient way to do this?

Thanks,
Ofer

Take a look at the methods trio_matrix and de_novo

Some combination of those two should do what you need!

1 Like

actually, do you just have this one family in your dataset, or many?

I have some families, but they are all separated from each other

in that case, you might do something like:

t = mt.make_table() # converts a matrix table to a table where the samples are field names

t = t.annotate(mendel_code = 
  hl.mendel_error_code(t.locus, 
  is_female=<PROBAND_IS_FEMALE>, 
  father=t['AS22WG003'].GT,
  mother=t['AS22WG002'].GT,  
  child=t['AS22WG001'].GT)
t = t.annotate(is_de_novo = hl.is_defined(t.mendel_code), 
  is_recessive=(t['AS22WG001'].GT.is_hom_var() & t['AS22WG002'].GT.is_het() & t['AS22WG003'].GT.is_het()))

Wow!!! it works!!! with some little changes :wink:
Thank you very much!