Export GWAS summary statistics to a .txt file

Hi there,

I used Hail’s “hl.agg.linreg” function to run GWAS and would like to export the summary statistics into a .txt file. Specifically, here’s my code for GWAS:

mt = mt.annotate_rows(gwas = hl.agg.linreg(mt.quant_pheno, [1, mt.GT.n_alt_alleles()]))

And here’s my code to export the output:

mt.gwas.flatten().export(‘EA_hail.txt’)

I only have ~6000 SNPs in the summary statistics, but it took about 5 minutes to generate the output. Also, the “flatten” function didn’t work properly, as the statistics were clumped together instead of showing up in separate columns when I read the .txt file into R. May I ask if there’s any mistake in my code? Also, how could I improve the speed of exporting output? Thank you very much!

Best,
Ethan

Thank you for your question, EZXYZ! Our apologies for getting back to you after awhile.

A few follow up questions:

  1. I am assuming that you are exporting everything in gwas regardless of magnitude of point estimates or significance threshold?
  2. If you were to export the mt, I would suggest first saving the gwas annotated rows of your summary statistics into a Hail table and then export without flattening the data into the table. Happy to help further if I possibly got your question wrong.

Thanks!

Great, this really helps, thanks!