Hl.agg.linreg() output question

Hi there,

I know that this might be a stupid question, but when I used hl.agg.linreg() to run GWAS on alternative allele and a set of covariates, I’m not sure about which element in the output array corresponds to the alternative allele. Specifically, I used the following code to run GWAS:

mt = mt.annotate_rows(gwas=hl.agg.linreg(mt.quant_pheno,
[1, mt.covar.isMale, mt.covar.YEAR, mt.covar.isAxiom,
mt.covar.PC1, mt.covar.PC2, mt.covar.PC3, mt.covar.PC4,
mt.covar.PC5, mt.covar.PC6, mt.covar.PC7, mt.covar.PC8,
mt.covar.PC9, mt.covar.PC10, mt.GT.n_alt_alleles()]))

For each SNP in the summary statistics, the effect size, se, and p-value estimates are all stored in an array with 15 elements. In this case, I wonder which element in the array corresponds to the estimated coefficient for alternative allele? Thank you very much!

The betas (and every other array) are in the same order as the independent variables – in this case, the beta on GT.n_alt_alleles() is in the last position, which you can access with betas[-1].

You also might prefer to run hl.linear_regression_rows – it’s faster and makes the simple GWAS case a little easier.

Sounds good, thank you very much!