Accessing fields in structure type in Hail 0.2

I am having the same problem attempting to filter data from the gnomad exomes keeping only loss of function instances as described here, but I am using Hail 0.2.
I am trying to filter using the field ‘lof’ of 'transcript_consequences’, but I don’t know how to filter across multiple annotations.
Searching in this forum I guess that Hail 0.2 doesn’t use vds anymore and the method filter_intervals is no longer available.


Filter intervals still exists, but it is not a MatrixTable method, it’s a stand alone method hl.filter_intervals.

In general, there are many transcripts and many transcript consequences for a single variant. If I understand correctly, you want to keep only those variants that cause a loss of function in at least one of the transcript consequences. This type of “at least one” query requires a hl.agg.any aggregation over an array:

hl.agg.array_agg(lambda x: hl.agg.any(hl.is_defined(x.lof)),

This says, return True if any consequence has a defined (i.e. non-missing) lof field.

You can use the above expression inside a mt.filter_rows(..., keep=True) to keep rows for which the expression evaluates to True.