# What is the right way to query by RSID?

**URL:** <https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481>\
**Category:** Hail Query & hailctl\
**Created:** [February 14, 2022, 8:21am UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481 "2022-02-14T08:21:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![annalisasnow](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/annalisasnow/32/701_2.png) [@annalisasnow](https://discuss.hail.is/u/annalisasnow)\
**Post date:** [February 14, 2022, 8:21am UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481/1 "2022-02-14T08:21:16Z")

</div>

Good day,

I am testing hail. Still very new to it. I have looked through the docs and came to conclusion, that I should be querying the matrix via the following request:

```auto
mtx.filter_rows(mtx.rsid=="rs11111111").show()

```

The idea is to find the row/entry based on RSID. There’s such a row as rsid in the matrix as well as the rsid with the following number. Nonetheless, I am getting none. In order to check some of the IDs I have printed them via: `mtx.annotate_rows()` and there’s such an RSID.

Nonetheless, I’m getting ‘None’ when trying to filter rows. Why? What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [February 14, 2022, 12:44pm UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481/2 "2022-02-14T12:44:43Z")

</div>

Hey [annalisasnow](https://discuss.hail.is/u/annalisasnow),

The example you wrote:

```auto
mtx.filter_rows(mtx.rsid=="rs11111111").show()

```

says “filter my matrix table to rsid “rs11111111”, then print it”. Are you seeing no print out?

Note that if you do: `foo = mtx.filter_rows(mtx.rsid=="rs11111111").show()`, then `foo` will be `None` since `.show()` doesn’t return a value, it just prints.

`annotate_rows()` doesn’t print, so I’m confused what you mean by using `annotate_rows` to print. It is used to add a new field. These are potentially helpful if you haven’t seen them: [Hail | Cheat Sheets](https://hail.is/cheatsheets.html)

---

<div class="post-metadata">

**Author:** ![annalisasnow](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/annalisasnow/32/701_2.png) [@annalisasnow](https://discuss.hail.is/u/annalisasnow)\
**Post date:** [February 14, 2022, 1:45pm UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481/3 "2022-02-14T13:45:25Z")

</div>

I see ‘None’. That’s what I get when using the whole statement as:

```auto
print("\n\n\n RSID \n\n\n", mtx.filter_rows(mtx.rsid=="rs11111111").annotate_rows().show())

```

If I do no rows annotation:

```auto
print(mtx.filter_rows(mtx.rsid=="rs11111111").show())

```

I still get `None`

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [February 14, 2022, 1:48pm UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481/4 "2022-02-14T13:48:08Z")

</div>

Yeah, you shouldn’t do `print`. `print` is a function that prints its input. `.show()` is a methoe that returns `None`, but has the side effect of printing the table. You should just be doing:

```auto
mtx.filter_rows(mtx.rsid=="rs11111111").show()

```

no `print` at all.

---

<div class="post-metadata">

**Author:** ![annalisasnow](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/annalisasnow/32/701_2.png) [@annalisasnow](https://discuss.hail.is/u/annalisasnow)\
**Post date:** [February 15, 2022, 6:07am UTC](https://discuss.hail.is/t/what-is-the-right-way-to-query-by-rsid/2481/5 "2022-02-15T06:07:34Z")

</div>

Thx, got it!
