Liftover from 38 to 37

I am trying to lift over from build 38 to build 37, and here is my code:

rg37 = hl.get_reference('GRCh37')  
rg38 = hl.get_reference('GRCh38')  
rg38.add_liftover("/hail_resources/grch37_to_grch38.over.chain.gz", rg37) 
mt = mt.annotate_rows(new_locus=hl.liftover(mt.locus, 'GRCh37'))  
mt = mt.filter_rows(hl.is_defined(mt.new_locus))  
mt = mt.key_rows_by(locus=mt.new_locus, alleles=mt.alleles)

However, I am getting this error:

Hail version: 0.2.81-edeb70bc789c
Error summary: HailException: Contig 'GL000199.1' is not in the reference genome 'GRCh38'.

Can I ask if anyone knows what may possibly be the issue with this? Thank you so much!

Hey @genome ,

Can you include the full stack trace? GL000199.1 is indeed a valid GRCh37 contig. It appears that either:

  1. Hail has a bug.
  2. Maybe your matrix table actually contains GRCh37 loci and this error indicates that we did not expect GRCh37 loci in a GRCh38 Matrix Table?

I got this figured out, thank you!

@genome I have the same error. What was the solution? Thanks.

@igorm , if you run

mt._force_count_rows()

before the liftover, does that raise an error?

(post deleted by author)

The chain file work very well for me
rg38.add_liftover(“/hail_resources/grch38_to_grch37.over.chain.gz”, rg37)

1 Like