Export for linreg_multi_pheno or linreg3


#1

Hi,

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?

Thanks,
Wendy


#2

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

vds.export_variants('file.txt.bgz', 
                    '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.


#3

Thanks Tim! This would work for now!

Best,
Wendy


#4

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?

Thanks,
Wendy


#5

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

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


#6

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

Thanks!
Jerry


#7

something like

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

#8

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)’)


#9

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')

#10

Got it. Thanks for your quick reply!