# Indel matching in semi\_join/anti\_join

**URL:** <https://discuss.hail.is/t/indel-matching-in-semi-join-anti-join/2902>\
**Category:** Science\
**Created:** [October 18, 2022, 1:00pm UTC](https://discuss.hail.is/t/indel-matching-in-semi-join-anti-join/2902 "2022-10-18T13:00:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruth\_Eberhardt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/ruth_eberhardt/32/742_2.png) [@Ruth\_Eberhardt](https://discuss.hail.is/u/Ruth_Eberhardt)\
**Post date:** [October 18, 2022, 1:00pm UTC](https://discuss.hail.is/t/indel-matching-in-semi-join-anti-join/2902/1 "2022-10-18T13:00:24Z")

</div>

Hi

I am using semi\_join(), anti\_join(), semi\_join\_rows() and anti\_join\_rows() to discover variants which are present in both of two datasets, or variants present in only one dataset.  
I have a question about indel normalisation. Does Hail either left-align or normalise indels when running these functions?  
i.e. will it recognise something like chr1:119753410 AACAC\>AAC and chr1:119753412 CAC\>C as being the same variant? Or if faced with two different representations of the same indel will it consider them as different variants?

Many thanks in advance

Ruth

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 18, 2022, 3:56pm UTC](https://discuss.hail.is/t/indel-matching-in-semi-join-anti-join/2902/2 "2022-10-18T15:56:02Z")

</div>

Hail doesn’t automatically compute the minimal representation of indels when you join. It’s certainly possible to do this yourself:

```python
mt = mt.key_rows_by(**hl.min_rep(mt.locus, mt.alleles))

ht = ht.key_by(**hl.min_rep(ht.locus, ht.alleles))

```

---

<div class="post-metadata">

**Author:** ![Ruth\_Eberhardt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/ruth_eberhardt/32/742_2.png) [@Ruth\_Eberhardt](https://discuss.hail.is/u/Ruth_Eberhardt)\
**Post date:** [October 19, 2022, 7:22am UTC](https://discuss.hail.is/t/indel-matching-in-semi-join-anti-join/2902/3 "2022-10-19T07:22:50Z")

</div>

Thank you, that is very helpful 👍
