# Query vcf header usiung tiledbvcf

**URL:** <https://forum.tiledb.com/t/query-vcf-header-usiung-tiledbvcf/570>\
**Category:** Uncategorized\
**Created:** [May 15, 2023, 6:05pm UTC](https://forum.tiledb.com/t/query-vcf-header-usiung-tiledbvcf/570 "2023-05-15T18:05:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vibhorgupta31](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/vibhorgupta31/32/268_2.png) [@Vibhorgupta31](https://forum.tiledb.com/u/Vibhorgupta31)\
**Post date:** [May 15, 2023, 6:05pm UTC](https://forum.tiledb.com/t/query-vcf-header-usiung-tiledbvcf/570/1 "2023-05-15T18:05:03Z")

</div>

Hi,

I am new to the tileDB, and I just started to use tileDBvcf for a project. I wanted to know, how can I use tileDBVCF to query the metadata / vcf header data of a vcf file for eg information about refrence genome, info attribute, etc. I tried to look for it, but no results were obtained. Can anyone please help me with this?

---

<div class="post-metadata">

**Author:** ![George\_Powley](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/george_powley/32/223_2.png) [@George\_Powley](https://forum.tiledb.com/u/George_Powley)\
**Post date:** [May 15, 2023, 7:34pm UTC](https://forum.tiledb.com/t/query-vcf-header-usiung-tiledbvcf/570/2 "2023-05-15T19:34:45Z")

</div>

Hello,

The VCF header for every sample is stored in the TileDB-VCF dataset. Here’s some python code that reads the VCF header for a sample using the TileDB Python API:

```python
import tiledb

def get_vcf_header(dataset_uri, sample):
    uri = tiledb.Group(dataset_uri)["vcf_headers"].uri
    with tiledb.open(uri) as A:
        return A.df[sample].header[0]

dataset_uri = " __PATH_TO_VCF_DATASET__"
sample = " __SAMPLE_NAME__"

vcf_header = get_vcf_header(dataset_uri, sample)
print(vcf_header)

```

You may need to install the TileDB Python module in your environment.

```auto
pip install tiledb

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Vibhorgupta31](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/vibhorgupta31/32/268_2.png) [@Vibhorgupta31](https://forum.tiledb.com/u/Vibhorgupta31)\
**Post date:** [May 17, 2023, 2:31am UTC](https://forum.tiledb.com/t/query-vcf-header-usiung-tiledbvcf/570/3 "2023-05-17T02:31:13Z")

</div>

> [@George\_Powley](#):
>
> ```auto
> import tiledb
> 
> def get_vcf_header(dataset_uri, sample):
> uri = tiledb.Group(dataset_uri)["vcf_headers"].uri
> with tiledb.open(uri) as A:
> return A.df[sample].header[0]
> 
> dataset_uri = " __PATH_TO_VCF_DATASET__"
> sample = " __SAMPLE_NAME__"
> 
> vcf_header = get_vcf_header(dataset_uri, sample)
> print(vcf_header)
> 
> ```

Yes, this works

Thankyou very much for the help
