# Filter variants close to indels

**URL:** <https://discuss.hail.is/t/filter-variants-close-to-indels/2632>\
**Category:** Hail Query & hailctl\
**Created:** [April 25, 2022, 3:35pm UTC](https://discuss.hail.is/t/filter-variants-close-to-indels/2632 "2022-04-25T15:35:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgb](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@dgb](https://discuss.hail.is/u/dgb)\
**Post date:** [April 25, 2022, 3:35pm UTC](https://discuss.hail.is/t/filter-variants-close-to-indels/2632/1 "2022-04-25T15:35:00Z")

</div>

Hello!

I am trying to find a way to filter variants that have at least one indel within a window (with a width parameter) around them and annotate the corresponding rows with a specific value. Is there a way to do this efficiently in Hail?

---

<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:** [April 27, 2022, 10:54am UTC](https://discuss.hail.is/t/filter-variants-close-to-indels/2632/2 "2022-04-27T10:54:40Z")

</div>

Roughly how large are these windows? The approach I can think of right now is to take all the indels, turn them into intervals, and then annotate the SNPs using those intervals. However, I think this might not check the “efficiently” box.

---

<div class="post-metadata">

**Author:** ![dgb](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@dgb](https://discuss.hail.is/u/dgb)\
**Post date:** [April 28, 2022, 9:09am UTC](https://discuss.hail.is/t/filter-variants-close-to-indels/2632/3 "2022-04-28T09:09:12Z")

</div>

The windows will be approx. 200 bp wide. Annotating the SNPs with intervals is a good idea, although I agree that it may not be very efficient. It may be worth a try though.
