# How can I get an array of the alleles from a CallExpresion

**URL:** <https://discuss.hail.is/t/how-can-i-get-an-array-of-the-alleles-from-a-callexpresion/2205>\
**Category:** Hail Query & hailctl\
**Created:** [August 27, 2021, 6:29am UTC](https://discuss.hail.is/t/how-can-i-get-an-array-of-the-alleles-from-a-callexpresion/2205 "2021-08-27T06:29:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thondeboer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/thondeboer/32/352_2.png) [@thondeboer](https://discuss.hail.is/u/thondeboer)\
**Post date:** [August 27, 2021, 6:29am UTC](https://discuss.hail.is/t/how-can-i-get-an-array-of-the-alleles-from-a-callexpresion/2205/1 "2021-08-27T06:29:50Z")

</div>

I am trying to get the alleles from a GT call into an array for some downstream processing.

Trying the following with a simple VCF based matrix table does not work

```python
mt = mt.annotate_entries(calls = mt.GT.alleles)

```

This gives the error

> AttributeError: ‘CallExpression’ object has no attribute ‘alleles’

It seems that the mt.GT entry field is a **CallExpression** which does not have the **alleles** attribute, while the **hail.genetics.Call** class DOES have the alleles attribute, but not sure how I “convert” the CallExpression to a Call class object.

hl.eval on a single CallExpression does work, but not in the mt.annotate\_entries expression.

```python
c = hl.call(0, 1, phased=False)
c

```

> \< CallExpression of type call\>

```python
hl.eval(c).alleles

```

> [0, 1]

Is there any way to get the alleles array to be used in the annotate\_entries?

---

<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:** [August 27, 2021, 12:44pm UTC](https://discuss.hail.is/t/how-can-i-get-an-array-of-the-alleles-from-a-callexpresion/2205/2 "2021-08-27T12:44:41Z")

</div>

huh, this is an oversight. We can add this pretty easily.

For now, a solution that works with unphased calls (or if you don’t care about phase) is:

```auto
def alleles_array(call):
    return hl.range(call.ploidy).map(lambda idx: call[idx])

```

---

<div class="post-metadata">

**Author:** ![thondeboer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/thondeboer/32/352_2.png) [@thondeboer](https://discuss.hail.is/u/thondeboer)\
**Post date:** [August 27, 2021, 3:13pm UTC](https://discuss.hail.is/t/how-can-i-get-an-array-of-the-alleles-from-a-callexpresion/2205/3 "2021-08-27T15:13:06Z")

</div>

OK…Thanks for the help…I figured it was something like that!
