# Local\_to\_global: local alleles not strictly increasing: \[0,2,1\]

**URL:** https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958
**Category:** Hail Query & hailctl
**Created:** [November 30, 2022, 11:27pm UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958 "2022-11-30T23:27:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jennifer](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@Jennifer](https://discuss.hail.is/u/Jennifer)
#### Post date: [November 30, 2022, 11:27pm UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/1 "2022-11-30T23:27:09Z")

</div>

Hello,

I’m using the function hl.vds.local\_to\_global() to convert LAD to AD, and got this error “Error summary: HailException: local\_to\_global: local alleles not strictly increasing: [0,2,1]”. Do you know what would be the cause? Thanks!

Here is my command in case helpful.

```python
mt = vds.variant_data.annotate_entries(
    AD = hl.vds.local_to_global(vds.variant_data.LAD, 
                                vds.variant_data.LA, 
                                n_alleles=hl.len(vds.variant_data.alleles), 
                                fill_value=0, 
                                number='R')
)

```

---

<div class="post-metadata">

### Author: ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)
#### Post date: [November 30, 2022, 11:59pm UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/2 "2022-11-30T23:59:22Z")

</div>

Hmm. I’m not sure what the issue is. Let me tag in our VDS expert, @tpoterba .

---

<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: [December 1, 2022, 12:45am UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/3 "2022-12-01T00:45:31Z")

</div>

is this an AoU VDS? Can you share the script so we know any transormatinos that occurred between the read and error?

---

<div class="post-metadata">

### Author: ![Jennifer](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@Jennifer](https://discuss.hail.is/u/Jennifer)
#### Post date: [December 1, 2022, 12:53am UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/4 "2022-12-01T00:53:57Z")

</div>

> [@tpoterba](#):
>
> transormatinos

Yes, this is an AoU VDS. The script is simple. Just read vds and then transform. Thanks for checking!  
vds = hl.vds.read\_vds(vds\_path)  
mt = vds.variant\_data.annotate\_entries(  
AD = hl.vds.local\_to\_global(vds.variant\_data.LAD,  
vds.variant\_data.LA,  
n\_alleles=hl.len(vds.variant\_data.alleles),  
fill\_value=0,  
number=‘R’)  
)

---

<div class="post-metadata">

### Author: ![Jennifer](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@Jennifer](https://discuss.hail.is/u/Jennifer)
#### Post date: [December 2, 2022, 3:17pm UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/5 "2022-12-02T15:17:58Z")

</div>

In case it is helpful, I can successfully convert LGT to GT in the same vds using hl.experimental.lgt\_to\_gt().

---

<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: [December 2, 2022, 3:30pm UTC](https://discuss.hail.is/t/local-to-global-local-alleles-not-strictly-increasing-0-2-1/2958/6 "2022-12-02T15:30:29Z")

</div>

I think this is a bug in `hl.vds.local_to_global` – I was too strict making this check in order to generate slightly faster code.

Here’s a tracking issue:

> <https://github.com/hail-is/hail/issues/12534>
>
> Nothing in the VDS representation disallows unsorted LA.

I hope to have some time to make a patch this afternoon
