# How do I use hl.import\_vcf to import a VCF that has been partitioned into multiple files?

**URL:** <https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472>\
**Category:** Hail Query & hailctl\
**Created:** [July 11, 2023, 9:47pm UTC](https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472 "2023-07-11T21:47:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgarcia](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mgarcia](https://discuss.hail.is/u/mgarcia)\
**Post date:** [July 11, 2023, 9:47pm UTC](https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472/1 "2023-07-11T21:47:53Z")

</div>

Hi @danking,

One additional question:  
As of now, we are considering using the pVCF that was partitioned into chromosome blocks for our Sample QC step. We are now wondering if the hl.import\_vcf function can import multiple chr block pVCFs or should we merge the individual chr blocks into chromosome pVCFs (one for each chromosome) before importing? Thank you again for your advice.

---

<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:** [July 12, 2023, 12:03pm UTC](https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472/2 "2023-07-12T12:03:58Z")

</div>

Hey @mgarcia , I split this question into a separate topic to facilitate the discovery of your question by other users.

Yes, [`hl.import_vcf`](https://hail.is/docs/0.2/methods/impex.html#hail.methods.import_vcf)’s `path` parameter accepts either a file path, a blob storage URL, or a list of either. You may specify the files individually:

```python
mt = hl.import_vcf(['.../chr1.vcf.bgz', '.../chr2.vcf.bgz', ...])

```

Or you may specify the files using a glob expression:

```python
mt = hl.import_vcf('.../chr*.vcf.bgz')

```

Please also take careful note of the `force_bgz` option if you have block-gzipped data with the normal `gz` extension.

---

<div class="post-metadata">

**Author:** ![mgarcia](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mgarcia](https://discuss.hail.is/u/mgarcia)\
**Post date:** [July 12, 2023, 12:27pm UTC](https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472/3 "2023-07-12T12:27:14Z")

</div>

Hi @danking,

Thank you for your response. Just to clarify, the hl.import\_vcf function can import fractioned chromosome blocks (e.g. a list of 50 pVCFs blocks that together represent chromosome 1)? The UK Biobank pVCFs have each chromosome split into several [blocks](https://biobank.ndph.ox.ac.uk/ukb/refer.cgi?id=837). It would save us a significant amount of time if we could import all of the blocks for each chromosome into a single MT. Thank you!

---

<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:** [July 12, 2023, 12:28pm UTC](https://discuss.hail.is/t/how-do-i-use-hl-import-vcf-to-import-a-vcf-that-has-been-partitioned-into-multiple-files/3472/4 "2023-07-12T12:28:39Z")

</div>

Yes, this is exactly what `import_vcf` is designed for.
