# Cannot run 'sample\_qc' function when PL field is missing

**URL:** <https://discuss.hail.is/t/cannot-run-sample-qc-function-when-pl-field-is-missing/1898>\
**Category:** Hail Query & hailctl\
**Created:** [January 26, 2021, 1:49am UTC](https://discuss.hail.is/t/cannot-run-sample-qc-function-when-pl-field-is-missing/1898 "2021-01-26T01:49:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jialiwang1211](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/jialiwang1211/32/532_2.png) [@jialiwang1211](https://discuss.hail.is/u/jialiwang1211)\
**Post date:** [January 26, 2021, 1:49am UTC](https://discuss.hail.is/t/cannot-run-sample-qc-function-when-pl-field-is-missing/1898/1 "2021-01-26T01:49:12Z")

</div>

Hi developer,

I was trying to use` sample_qc` function to compute QC some metrics. The ‘PL’ field of my vcf are all missing, but the ‘GQ’ field are not missing. The error message is: `HailException: PL cannot have missing elements.`

My understanding is that the `gq_stats` from the ` sample_qc` function are computed from ‘GQ’ field. But why Hail complains missing elements in PL field? How am I able to compute `gq_stats` when my vcf only contains ‘GQ’ but not ‘PL’?

Thanks!

---

<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:** [January 26, 2021, 3:57am UTC](https://discuss.hail.is/t/cannot-run-sample-qc-function-when-pl-field-is-missing/1898/2 "2021-01-26T03:57:41Z")

</div>

Hey @jialiwang1211 !

I’m sorry you’re having trouble with Hail. The issue is almost certainly not with `sample_qc`. Are you using `split_multi_hts`? Hail assumes that either:

- the PL field is missing, or
- the PL field is an array of _not_ missing values.

It sounds like you have a PL field that is an array of missing values. You can fix this by running this after you read or import your data:

```auto
mt = mt.annotate(PL = hl.null(mt.PL.dtype))

```

Also, be aware that split\_multi\_hts cannot recalculate an appropriate GQ if the PL field is missing.

---

<div class="post-metadata">

**Author:** ![jialiwang1211](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/jialiwang1211/32/532_2.png) [@jialiwang1211](https://discuss.hail.is/u/jialiwang1211)\
**Post date:** [January 26, 2021, 1:32pm UTC](https://discuss.hail.is/t/cannot-run-sample-qc-function-when-pl-field-is-missing/1898/3 "2021-01-26T13:32:49Z")

</div>

Hi @danking,

Thank you for your prompt reply!  
Yes I was using `split_multi_hts`, and yes the PL field in my vcf is an array of missing values.

The problem is fixed by using the code:

```
mt = hl.variant_qc(hl.split_multi_hts(mt.drop('PL')), name='qc')

```

Note that I need to drop the PL field in the multi\_hts step, otherwise the GQ field becomes NA.

Thanks!
