# Bug: n\_alleles may not be missing

**URL:** <https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217>\
**Category:** Science\
**Created:** [August 31, 2021, 3:38pm UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217 "2021-08-31T15:38:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [August 31, 2021, 3:38pm UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217/1 "2021-08-31T15:38:32Z")

</div>

Hi,

I am testing QC steps and plot generation on a hail matrix table. The QC steps get done but when I try to write the hail matrix to disk, I get the following error:

> Hail version: 0.2.72-cfce5e858cab  
> Error summary: HailException: call\_stats: n\_alleles may not be missing

Has anyone faced this error before?

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [August 31, 2021, 4:10pm UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217/2 "2021-08-31T16:10:17Z")

</div>

Hail doesn’t actually compute anything until you run something like a write to disk, which forces a result to be computed. (Then the Hail compiler can optimize the pipeline in its entirety, and schedule the distributed computation.) That means the timing of the exception doesn’t tell you much about what the problematic line was.

In this case, the error is definitely in one of the QC steps, in the `call_stats` aggregator. It looks like you may have a missing alleles array. If your QC script is relatively small and you don’t mind sharing it, that would be helpful.

---

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [September 1, 2021, 7:38am UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217/3 "2021-09-01T07:38:10Z")

</div>

These are the set of steps:

> mt = hl.variant\_qc(mt, name=‘variant\_qc’)  
> mt = hl.sample\_qc(mt, name=‘sample\_qc’)

Here is a result of input hail matrix table: `mt.describe()`

```python
----------------------------------------
Global fields:
    'bn': struct {
        n_populations: int32, 
        n_samples: int32, 
        n_variants: int32, 
        n_partitions: int32, 
        pop_dist: array<int32>, 
        fst: array<float64>, 
        mixture: bool
    }
    'cohort_wrapper_type': str
----------------------------------------
Column fields:
    'sample_idx': int32
    'pop': int32
----------------------------------------
Row fields:
    'locus': locus<GRCh38>
    'alleles': array<str>
    'ancestral_af': float64
    'af': array<float64>
    'row_idx': int64
----------------------------------------
Entry fields:
    'GT': call
----------------------------------------
Column key: ['sample_idx']
Row key: ['locus', 'alleles']
----------------------------------------

```

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [September 1, 2021, 1:05pm UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217/4 "2021-09-01T13:05:21Z")

</div>

I verified that this exception occurs when an alleles array is missing. I would guess that is what’s happening here. You can check using:

```nohighlight
mt.aggregate_rows(hl.agg.any(hl.is_missing(mt.alleles)))

```

---

<div class="post-metadata">

**Author:** ![Abhishek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/abhishek/32/570_2.png) [@Abhishek](https://discuss.hail.is/u/Abhishek)\
**Post date:** [September 2, 2021, 2:18pm UTC](https://discuss.hail.is/t/bug-n-alleles-may-not-be-missing/2217/5 "2021-09-02T14:18:34Z")

</div>

Yes, the query resulted in **True** meaning an alleles array is missing.
