# Assign hom ref genotype to missing values

**URL:** <https://discuss.hail.is/t/assign-hom-ref-genotype-to-missing-values/2193>\
**Category:** Hail Query & hailctl\
**Created:** [August 17, 2021, 7:37pm UTC](https://discuss.hail.is/t/assign-hom-ref-genotype-to-missing-values/2193 "2021-08-17T19:37:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hansh2323](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hansh2323](https://discuss.hail.is/u/hansh2323)\
**Post date:** [August 17, 2021, 7:37pm UTC](https://discuss.hail.is/t/assign-hom-ref-genotype-to-missing-values/2193/1 "2021-08-17T19:37:53Z")

</div>

Hello, for variants with missing genotype, is there a way to assign hom-ref genotype to these  
variants in a matrix table in Hail?

---

<div class="post-metadata">

**Author:** ![danielgoldstein](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@danielgoldstein](https://discuss.hail.is/u/danielgoldstein)\
**Post date:** [August 17, 2021, 7:58pm UTC](https://discuss.hail.is/t/assign-hom-ref-genotype-to-missing-values/2193/2 "2021-08-17T19:58:48Z")

</div>

Hi @hansh2323 , the genotype is an entry field of the matrix table, so you can combine the use of [annotate\_entries](https://hail.is/docs/0.2/hail.MatrixTable.html#hail.MatrixTable.annotate_entries) with a condition that checks if the GT field of an entry is [defined](https://hail.is/docs/0.2/functions/core.html#hail.expr.functions.is_defined). So you’ll end up with something like

```auto
mt = mt.annotate_entries(GT = hl.if_else(hl.is_defined(mt.GT), mt.GT, hl.Call([0, 0])))

```

---

<div class="post-metadata">

**Author:** ![hansh2323](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hansh2323](https://discuss.hail.is/u/hansh2323)\
**Post date:** [August 17, 2021, 8:22pm UTC](https://discuss.hail.is/t/assign-hom-ref-genotype-to-missing-values/2193/3 "2021-08-17T20:22:08Z")

</div>

@danielgoldstein thanks a lot!
