# Liftover from 38 to 37

**URL:** <https://discuss.hail.is/t/liftover-from-38-to-37/2531>\
**Category:** Hail Query & hailctl\
**Created:** [February 25, 2022, 10:17pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531 "2022-02-25T22:17:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![genome](https://avatars.discourse-cdn.com/v4/letter/g/9f8e36/32.png) [@genome](https://discuss.hail.is/u/genome)\
**Post date:** [February 25, 2022, 10:17pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/1 "2022-02-25T22:17:31Z")

</div>

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

```auto
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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [February 27, 2022, 3:41pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/2 "2022-02-27T15:41:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![genome](https://avatars.discourse-cdn.com/v4/letter/g/9f8e36/32.png) [@genome](https://discuss.hail.is/u/genome)\
**Post date:** [February 28, 2022, 9:23pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/3 "2022-02-28T21:23:43Z")

</div>

I got this figured out, thank you!

---

<div class="post-metadata">

**Author:** ![igorm](https://avatars.discourse-cdn.com/v4/letter/i/e47774/32.png) [@igorm](https://discuss.hail.is/u/igorm)\
**Post date:** [January 5, 2023, 10:12am UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/4 "2023-01-05T10:12:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [January 5, 2023, 3:39pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/5 "2023-01-05T15:39:00Z")

</div>

@igorm , if you run

```python
mt._force_count_rows()

```

_before_ the liftover, does that raise an error?

---

<div class="post-metadata">

**Author:** ![hanl1](https://avatars.discourse-cdn.com/v4/letter/h/5f9b8f/32.png) [@hanl1](https://discuss.hail.is/u/hanl1)\
**Post date:** [January 24, 2023, 9:22pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/6 "2023-01-24T21:22:11Z")

</div>

(post deleted by author)

---

<div class="post-metadata">

**Author:** ![hanl1](https://avatars.discourse-cdn.com/v4/letter/h/5f9b8f/32.png) [@hanl1](https://discuss.hail.is/u/hanl1)\
**Post date:** [January 25, 2023, 5:27pm UTC](https://discuss.hail.is/t/liftover-from-38-to-37/2531/7 "2023-01-25T17:27:35Z")

</div>

The chain file work very well for me  
rg38.add\_liftover(“/hail\_resources/grch38\_to\_grch37.over.chain.gz”, rg37)
