# Parse\_locus() over multiple regions using GRCh38

**URL:** <https://discuss.hail.is/t/parse-locus-over-multiple-regions-using-grch38/993>\
**Category:** Hail Query & hailctl\
**Created:** [June 15, 2019, 6:38pm UTC](https://discuss.hail.is/t/parse-locus-over-multiple-regions-using-grch38/993 "2019-06-15T18:38:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 16, 2019, 12:23pm UTC](https://discuss.hail.is/t/parse-locus-over-multiple-regions-using-grch38/993/2 "2019-06-16T12:23:34Z")

</div>

In 0.2.15 or later, doing the following:

```python
intervals = [hl.parse_locus(x, reference_genome='GRCh38') for x in ['4:144585304', '15:78575140']]
mt_hits = mt.filter_rows(hl.literal(intervals).contains(mt.locus))

```

will have the same performance as filter\_intervals, but is much easier to use. See here:

> [@New optimizer pass that extracts point queries and interval filters](https://discuss.hail.is/t/new-optimizer-pass-that-extracts-point-queries-and-interval-filters/979):
>
> [hl.filter\_intervals](https://hail.is/docs/0.2/methods/genetics.html#hail.methods.filter_intervals) is [one of the best ways](https://discuss.hail.is/t/using-filter-intervals-to-query-the-16gb-gnomad-sites-dataset-in-300ms-on-your-laptop/148) to speed up pipelines that only need to look at a small fraction of your data, but the method is quite a pain to use compared to simpler methods like filter\_rows. As of 0.2.15, Hail includes an optimizer pass that tries to rewrite filter / filter\_rows method calls as filter\_intervals when possible. This can make pipelines orders of magnitude faster, since it reduces the amount of data read from disk – and data you don’t read can’t slow you down! You’l…

---

_[View the full topic](https://discuss.hail.is/t/parse-locus-over-multiple-regions-using-grch38/993)._
