# Import VCF with FORMAT 'DP' (coverage )

**URL:** <https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790>\
**Category:** Hail Query & hailctl\
**Created:** [August 18, 2022, 2:06pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790 "2022-08-18T14:06:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Alexey](https://discuss.hail.is/u/Alexey)\
**Post date:** [August 18, 2022, 2:06pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790/1 "2022-08-18T14:06:18Z")

</div>

Hello everyone

Currently i face one problem. I am truing to Import VCF with standard FORMAT set like call\_fields=[‘GT’,‘AD’,‘DP’,‘GQ’,‘PL’]

I am doing in in Jupiter notebook, on my local machine. I am trying download 1K genomes… For this i am using following command

vcfs = [f"data/1kg/ALL.chr{contig}.phase3\_shapeit2\_mvncall\_integrated\_v5b.20130502.genotypes.vcf.gz" for contig in range(1, 23)]  
hl.import\_vcf(vcfs,force\_bgz=True,call\_fields=[‘DP’]).write(‘Haill\_mt/1kg\_Full.mt’, overwrite=True)

Then it gave me an error:

Hail version: 0.2.97-937922d7f46c  
Error summary: HailException: Can only convert a header line with type ‘String’ to a call type. Found ‘Integer’.

Obviously problem occur only with ‘DP’ (coverage ). When i truing other FORMAT settings like this call\_fields=[‘AO’,‘RO’,‘GT’,‘AD’,‘GQ’,‘PL’,‘PGT’], the script is running.

vcfs = [f"data/1kg/ALL.chr{contig}.phase3\_shapeit2\_mvncall\_integrated\_v5b.20130502.genotypes.vcf.gz" for contig in range(1, 23)]  
hl.import\_vcf(vcfs,force\_bgz=True,call\_fields=[‘AO’,‘RO’,‘GT’,‘AD’,‘GQ’,‘PL’,‘PGT’]).write(‘Haill\_mt/1kg\_Full.mt’, overwrite=True)

Of course, i can calculate DP with equitation DP=AO+RO. Then i can add DP to MatrixTable afterwards

But i wounder, is it possible to add DP to Matrix Table at import\_vcf step?

---

<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:** [August 18, 2022, 2:21pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790/2 "2022-08-18T14:21:28Z")

</div>

call\_fields refers to fields of type “call” (genotype call). GT is the only field of these with a call type.

If you run `import_vcf` without the call\_fields argument and run `mt.describe()` afterwards, what does that print?

---

<div class="post-metadata">

**Author:** ![Alexey](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Alexey](https://discuss.hail.is/u/Alexey)\
**Post date:** [August 18, 2022, 2:28pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790/3 "2022-08-18T14:28:18Z")

</div>

Hi @tpoterba

Here is result for `mt.describe()`

* * *

## Global fields: None

## Column fields: ‘s’: str

## Row fields: ‘locus’: locus ‘alleles’: array ‘rsid’: str ‘qual’: float64 ‘filters’: set ‘info’: struct { CIEND: array, CIPOS: array, CS: str, END: int32, IMPRECISE: bool, MC: array, MEINFO: array, MEND: int32, MLEN: int32, MSTART: int32, SVLEN: array, SVTYPE: str, TSD: str, AC: array, AF: array, NS: int32, AN: int32, EAS\_AF: array, EUR\_AF: array, AFR\_AF: array, AMR\_AF: array, SAS\_AF: array, DP: int32, AA: str, VT: array, EX\_TARGET: bool, MULTI\_ALLELIC: bool }

## Entry fields: ‘GT’: call

## Column key: [‘s’] Row key: [‘locus’, ‘alleles’]

---

<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:** [August 18, 2022, 2:30pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790/4 "2022-08-18T14:30:18Z")

</div>

The only FORMAT field that VCF has is “GT”. It seems like DP doesn’t exist in this VCF.

---

<div class="post-metadata">

**Author:** ![Alexey](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Alexey](https://discuss.hail.is/u/Alexey)\
**Post date:** [August 18, 2022, 2:35pm UTC](https://discuss.hail.is/t/import-vcf-with-format-dp-coverage/2790/5 "2022-08-18T14:35:36Z")

</div>

Hi @tpoterba

It have to be added at previous steps? For example at step BAM to VCF?
