# Long time to export UK Biobank GWAS result to tsv file

**URL:** <https://discuss.hail.is/t/long-time-to-export-uk-biobank-gwas-result-to-tsv-file/1382>\
**Category:** Hail Query & hailctl\
**Created:** [April 25, 2020, 7:24am UTC](https://discuss.hail.is/t/long-time-to-export-uk-biobank-gwas-result-to-tsv-file/1382 "2020-04-25T07:24:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenll0105](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@chenll0105](https://discuss.hail.is/u/chenll0105)\
**Post date:** [April 25, 2020, 7:24am UTC](https://discuss.hail.is/t/long-time-to-export-uk-biobank-gwas-result-to-tsv-file/1382/1 "2020-04-25T07:24:14Z")

</div>

When I try to use the following code to export chr1 gwas result to tsv file, it takes more than hours.

`gwas.export('chr1_gwas.tsv.bgz', header=True, delimiter='\t')`

The gwas data contains about 7.6 million variants.

I wonder how can I speed up the export process, thanks a lot!

---

<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:** [April 25, 2020, 7:32am UTC](https://discuss.hail.is/t/long-time-to-export-uk-biobank-gwas-result-to-tsv-file/1382/2 "2020-04-25T07:32:54Z")

</div>

Hi! Sorry you’re having a bad experience.

1. Keep in mind that Hail is lazy. Nothing is done until you write `gwas.export`. At that point, Hail performs all the operations that you’ve requested, including the linear regressions!
2. [`Table.export`](https://hail.is/docs/0.2/hail.Table.html?highlight=export#hail.Table.export) with the default `parallel=None` flag performs a very slow file concatenation step! Do you really need a text file? You can use Hail to analyze those 7.6 million GWAS results. Either way, you should write first to Hail’s efficient and fast on-disk format, then read back in and convert to a text file. This will perform all the GWAS code once, store the result to disk, then read it back only so that it can convert it to text and export it.

```auto
gwas.write('chr1_gwas.ht')
hl.read_table('chr1_gwas.ht').export('chr1_gwas.tsv.bgz', header=True, delimiter='\t')

```

1. The UKB is a large dataset! It might take some time to compute linear regression on the biggest chromosome.

---

<div class="post-metadata">

**Author:** ![chenll0105](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@chenll0105](https://discuss.hail.is/u/chenll0105)\
**Post date:** [April 27, 2020, 1:35am UTC](https://discuss.hail.is/t/long-time-to-export-uk-biobank-gwas-result-to-tsv-file/1382/3 "2020-04-27T01:35:46Z")

</div>

Thanks a lot，it does help me out！

```auto
was.read('chr1_gwas.ht').export('chr1_gwas.tsv.bgz', header=True, delimiter='\t')

```

The code below shoud be changed to:

```auto
hl.read_table('chr1_gwas.ht').export('chr1_gwas.tsv.bgz', header=True, delimiter='\t')

```
