# Export\_bgen (to header per shard) empty bgen files

**URL:** <https://discuss.hail.is/t/export-bgen-to-header-per-shard-empty-bgen-files/3508>\
**Category:** Hail Query & hailctl\
**Created:** [July 25, 2023, 11:42pm UTC](https://discuss.hail.is/t/export-bgen-to-header-per-shard-empty-bgen-files/3508 "2023-07-25T23:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwillett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/jwillett/32/990_2.png) [@jwillett](https://discuss.hail.is/u/jwillett)\
**Post date:** [July 25, 2023, 11:42pm UTC](https://discuss.hail.is/t/export-bgen-to-header-per-shard-empty-bgen-files/3508/1 "2023-07-25T23:42:35Z")

</div>

I am exporting processed matrix tables to bgen and have been getting an error on trying to convert the bgen files to pgen that a reasonable fraction are empty. Is this to be expected?

---

<div class="post-metadata">

**Author:** ![jwillett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/jwillett/32/990_2.png) [@jwillett](https://discuss.hail.is/u/jwillett)\
**Post date:** [July 26, 2023, 12:57am UTC](https://discuss.hail.is/t/export-bgen-to-header-per-shard-empty-bgen-files/3508/2 "2023-07-26T00:57:16Z")

</div>

If using the “header\_per\_shard” option for “parallel”, do I merge the shards using cat?

---

<div class="post-metadata">

**Author:** ![jwillett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/jwillett/32/990_2.png) [@jwillett](https://discuss.hail.is/u/jwillett)\
**Post date:** [July 26, 2023, 5:18pm UTC](https://discuss.hail.is/t/export-bgen-to-header-per-shard-empty-bgen-files/3508/3 "2023-07-26T17:18:18Z")

</div>

@danking Do you have guidance?
