Filtering a locus in build 38

I used to use the following command to filter a locus using build 37 data:

locus = mt.filter_rows(mt.locus == hl.locus(‘22’, 41971833))

When i run it on a build 38 data, it no longer works.

I get the following error message:

Invalid ‘==’ comparison, cannot compare expressions of type ‘locus’ and ‘locus’

Can you kindly help which command to use for build 38 datasets.

I suspect the issue here is that hl.locus takes in a third argument, the reference genome. So that error message really ought to be saying “Can’t compare locus from GRCh37 with locus from GRCh38”. What version of hail are you on? On my latest version, if I do something like this:

mt = hl.balding_nichols_model(3, 10, 10) # This generates some simulated GRCh37 data
mt.filter_rows(mt.locus == hl.locus('22', 312354, 'GRCh38')).show()

I get:

TypeError: Invalid '==' comparison, cannot compare expressions of type 'locus<GRCh37>' and 'locus<GRCh38>'

Anyway, assuming this is in fact the problem, the fix should be to pass the reference genome into the hl.locus function the way I did above.