Export for linreg_multi_pheno or linreg3


We are trying to do a small scale phewas and we tried linreg_multi_pheno. I was wondering if there’s an export function for it? If not what would you suggest to do if we want to look at the results? convert it to pandas?


Hi Wendy,
You can certainly export to a file. Here’s how:

                    'variant = v, pvals = va.linreg.pval.mkString(",")')

This’ll give you something like:

variant  pval
1:1:A:T  0.05,0.001,0.9
1:2:T:G  0.1,0.4,0.3

I’ll think about a better way to get results out and post here when I have something. Someone else has also asked for this.

Thanks Tim! This would work for now!


Hi Tim,

We have got
Error summary: HailException: No function found with name `mkString’ and argument types (Array[Double], String)
:1:variant = v, pvals = va.linreg.pval.mkString(“,”)

is the mkString function in Hail 0.1-38882df?


Hi Wendy, pval is an Array[Double] but mkString takes an Array[String], so try substituting:

va.linreg.pval.map(p => str(p)).mkString(",")

Could you help me here with the syntax of HQL to filter the linreg vds with all phenotype pval < 0.05?


something like

vds.filter_variants_expr('va.linreg.pval.forall(p => p < 0.05)')

Thanks! Just to beat the dead horse again:
If I want to filter by the first pheno p-val, is it something like this?
vds.filter_variants_expr(‘va.linreg.pval.forall(p => p[0]< 0.05)’)

the forall checks that the predicate is true for every element of the array. If you just care about the first, you don’t need the forall:

 vds.filter_variants_expr('va.linreg.pval[0] < 0.05')

Got it. Thanks for your quick reply!