How to filter to a specific locus

I wanted to filter based on a locus; however it is giving me an error.

data = mt.filter_rows(( == 1:139120)),keep=True)

I have tried several permutations of the above; the error persists

type errors, probably.


filter_rows( =='1', 139120))

3 posts were split to a new topic: How do I filter to a one megabase range of a matrix table


What is the best way to filter for multiple locations? For example python list of 1000 <LocusExpression of type locus<GRCh37>>. How should I pass it to the .mt to filter most efficiently?


I created snps_locuses - a list of 1000 <LocusExpression of type locus<GRCh37>>

The solution that worked for me:
mt = mt.filter_rows(hl.literal(snps_locuses).contains(


1 Like