Entering edit mode
9.8 years ago
NB
▴
960
Hello,
I need to calculate the z-scores from meta-GWAS summary stats. The association file has the following header
rs_id Allele1 Allele2 Freq1 Effect StdErr P.value
The 'effect' is the Beta coefficent. My understanding is
z-score=Effect/StdErr
Is that correct? Also, are there any R packages that can do this?
Many thanks
thank you, very much! I actually tried awk before but end up with an error
awk: (FILENAME=summary_stats.txt FNR=1) fatal: division by zero attempted
Hi,
Please check following code to fix the issue. Actually, the issue backs to division by zero and also considering heading as string.
awk -v OFS='\t' 'NR==1 {$8="zscore"} NR>1 {$8 = ($6!=0) ? sprintf("%.3f", $5 / $6): "UND"} 1' input file > output file