# Missing read depth mean after filter\_entries()

**URL:** https://discuss.hail.is/t/missing-read-depth-mean-after-filter-entries/3689
**Category:** Hail Query & hailctl
**Created:** [December 18, 2023, 2:38pm UTC](https://discuss.hail.is/t/missing-read-depth-mean-after-filter-entries/3689 "2023-12-18T14:38:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![barioux](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/barioux/32/1062_2.png) [@barioux](https://discuss.hail.is/u/barioux)
#### Post date: [December 18, 2023, 2:38pm UTC](https://discuss.hail.is/t/missing-read-depth-mean-after-filter-entries/3689/1 "2023-12-18T14:38:44Z")

</div>

Hi all,

Just wondered if you had a way to calculate the distribution of the mean read depth across all loci. I get ‘nan’ for dp\_stats.mean at mean and std dev as follows after applying filter\_entries.

mt\_filtered = mt.filter\_entries(  
((hl.is\_snp(mt.alleles[0], mt.alleles[1]) & (mt.DP \>= snv\_min\_coverage)) |  
(hl.is\_indel(mt.alleles[0], mt.alleles[1]) & (mt.DP \>= indel\_min\_coverage)))  
)

mt\_filtered.variant\_qc.dp\_stats.summarize()

**dp\_stats.mean** (_float64_ ):

| Non-missing | 63103 (100.00%) |
| --- | --- |
| Missing | 0 |
| Minimum | 7.58 |
| Maximum | 91.90 |
| Mean | nan |
| Std Dev | nan |

Thanks in advance!

---

<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: [December 18, 2023, 7:29pm UTC](https://discuss.hail.is/t/missing-read-depth-mean-after-filter-entries/3689/2 "2023-12-18T19:29:09Z")

</div>

Hi @barioux !

This means that `dp_stats.mean` is `NaN` for at least one variant. You can use [`hl.is_nan`](https://hail.is/docs/0.2/functions/numeric.html#hail.expr.functions.is_nan) with `filter_rows` to filter to a variant with a NaN for its dp\_stats.mean.

`dp_stats.mean` is defined as `hl.agg.stats(mt.DP)`. `hl.agg.stats(...).mean` is usually NaN when every entry is filtered or has a missing `DP` field. [`compute_entry_filter_stats`](https://hail.is/docs/0.2/hail.MatrixTable.html#hail.MatrixTable.compute_entry_filter_stats) can provide insight into which rows contain only filtered entries.

In particular, you probably have a SNP or INDEL where none of the entries have the minimum coverage.
