# Using VCF non GT column

**URL:** <https://discuss.hail.is/t/using-vcf-non-gt-column/3740>\
**Category:** Hail Query & hailctl\
**Created:** [February 9, 2024, 7:24pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740 "2024-02-09T19:24:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 9, 2024, 7:24pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/1 "2024-02-09T19:24:31Z")

</div>

Hi, I need to read genotypes from a column other than GT in a vcf file. Does any one know how to do it in Hail? Many thanks for you help!

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [February 9, 2024, 7:48pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/2 "2024-02-09T19:48:48Z")

</div>

Hi Tetyana! Sorry for the silence on your other post.

If I understand correctly, I think all you should need to do is

```python
hl.import_vcf(path_to_vcf, call_fields=[genotype_field])

```

It would even work without the `call_fields` argument, but it wouldn’t know to import that field as call-typed data, and would just represent the calls as structs (I think).

Hopefully that works for you. If not, please share here what happened.

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 17, 2024, 6:04pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/3 "2024-02-17T18:04:04Z")

</div>

Hi Patrick, thank you for your response and apologies for delayed follow up. I had issues with installing Hail on prem, but I think I’ve figured out the problem. So, I’ve tried the command you’ve suggested and got the following error: NameError: name ‘GTA’ is not defined  
GTA is the field from which I’d like to read in the genotypes, so the command looked like this:  
data=hl.import\_vcf(path\_to\_vcf, call\_fields=[GTA]). The vcf file was not compressed (can it need to be compressed?). The filed GTA was read with no problems by vcftools.

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [February 18, 2024, 1:26pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/4 "2024-02-18T13:26:17Z")

</div>

Ah, the field name needs to be a string. Try

```python
data=hl.import_vcf(path_to_vcf, call_fields=['GTA'])

```

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 18, 2024, 8:35pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/5 "2024-02-18T20:35:54Z")

</div>

Thank you for the quick response! I was able to read in the vcf with the filed name being a string GTA. But I was not able to do anything with it afterwards. My goal is to read in a filed that is not GT and then export the data in either PLINK or vcf format, so that the non GT filed will become GT (in other words, when PLINK or other program reads the exported file, the data that was in GTA filed will be read in as GT filed). When I tried to export what was read in using the following command: hl.export\_vcf(data,‘test.vcf’), I got the following error Error summary: NoClassDefFoundError: Could not initialize class com.github.luben.zstd.ZstdCompressCtx. I’m not sure if this is because Hail dependencies are not right or if there is something else going on. I’m happy to share the log file from the run.

---

<div class="post-metadata">

**Author:** ![patrick-schultz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/patrick-schultz/32/265_2.png) [@patrick-schultz](https://discuss.hail.is/u/patrick-schultz)\
**Post date:** [February 20, 2024, 4:06pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/6 "2024-02-20T16:06:21Z")

</div>

Not sure what’s going on there. Can you share the log file, as well as the full stack trace that printed with the error? Also, where was this run (e.g. local mac/windows machine, cloud)?

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 20, 2024, 6:20pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/7 "2024-02-20T18:20:42Z")

</div>

![Screenshot 2024-02-20 at 12.13.57 PM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/2X/4/453304bef5dc72cd3683df6f483293de5520d41a.jpeg)

I’m allowed to put only one embedded media per post, here is one screenshot of load the hail (there were some warnings), then of everything that was printed on the screen after the export\_vcf command is coming…Everything was run on BROAD server. Prior to running Hail, Anaconda3 and Java 11 were loaded. Then, I used ipython to run Hail.

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 20, 2024, 6:21pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/8 "2024-02-20T18:21:31Z")

</div>

![Screenshot 2024-02-20 at 12.14.42 PM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/2X/0/016302202f3986c6c66e40361e89e02b0019f631.jpeg)

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 20, 2024, 6:22pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/9 "2024-02-20T18:22:51Z")

</div>

![Screenshot 2024-02-20 at 12.14.51 PM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/2X/3/3a213eea4f61b50ed3d699b35235728de661bef0.jpeg)

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 20, 2024, 6:23pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/10 "2024-02-20T18:23:24Z")

</div>

![Screenshot 2024-02-20 at 12.15.00 PM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/2X/c/cb7af4e6e0586d6f8f1f81fdaad8055290f7ab34.jpeg)

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 20, 2024, 6:24pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/11 "2024-02-20T18:24:01Z")

</div>

[hail-20240218-2027-0.2.127-bb535cd096c5.log](https://discuss.hail.is/uploads/short-url/nbl4XRyIPwx2vf2BUa3O5DDI9F2.log) (87.3 KB)

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 26, 2024, 7:58pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/12 "2024-02-26T19:58:37Z")

</div>

Hi Patrick, I was wondering if you had a chance to look into the issue of outputting a vcf file from Hail?

---

<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:** [February 29, 2024, 4:21pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/13 "2024-02-29T16:21:02Z")

</div>

@Tetyana_Zayats can you share the series of commands you execute after you SSH? That should allow us to reproduce and fix the issue. Thanks!

---

<div class="post-metadata">

**Author:** ![Tetyana\_Zayats](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tetyana_zayats/32/1101_2.png) [@Tetyana\_Zayats](https://discuss.hail.is/u/Tetyana_Zayats)\
**Post date:** [February 29, 2024, 4:41pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/14 "2024-02-29T16:41:25Z")

</div>

sure, it should be something like this:  
ish -l h\_vmem=30G  
cd /path/to/the/folder/with/files  
use Anaconda3  
use Java11  
ipython  
import hail as hl  
data=hl.import.vcf(‘path/file/name’,call\_fields=‘GTA’)  
hl.export\_vcf(data,‘test.vcf’)

---

<div class="post-metadata">

**Author:** ![chrisvittal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/chrisvittal/32/327_2.png) [@chrisvittal](https://discuss.hail.is/u/chrisvittal)\
**Post date:** [March 4, 2024, 10:17pm UTC](https://discuss.hail.is/t/using-vcf-non-gt-column/3740/15 "2024-03-04T22:17:41Z")

</div>

This kind of error generally indicates something wrong in your environment. We bundle zstd so I am confused as to what may be happening.

Could you run the following on the cluster, and provide the command’s output:

First, run `pip show hail`.  
There should be a `Location` line present, for example, this is what I get when I run the command.

```python
$ pip show hail
Name: hail
Version: 0.2.128
Summary: Scalable library for exploring and analyzing genomic data.
Home-page: https://hail.is
Author: Hail Team
Author-email: hail@broadinstitute.org
License: 
Location: /Users/cvittal/src/hail/hail/venv/hail-3.10/lib/python3.10/site-packages
Requires: aiodns, aiohttp, ... # output elided
Required-by: benchmark-hail

```

Change directory to the folder listed in the `Location` field, so for me that would be `/Users/cvittal/src/hail/hail/venv/hail-3.10/lib/python3.10/site-packages`.

Then, ensure the existence of `hail/backend/hail-all-spark.jar` (relative to `site-packages`).

Finally, run `jar tf hail/backend/hail-all-spark.jar | sort | tee $HOME/jar-tf-hail.out`, and share that output here. That last command will have saved the output to `$HOME/jar-tf-hail.out` so you should be able to copy it off of the server.
