Question: Calculate z-scores from GWAS summary stats
4
gravatar for Nandini
5.5 years ago by
Nandini880
Nandini880 wrote:

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

 

summary stats z-scores gwas • 12k views
ADD COMMENTlink modified 5.5 years ago • written 5.5 years ago by Nandini880
6
gravatar for coleman_jonathan
5.5 years ago by
European Union
coleman_jonathan440 wrote:

You are correct. This can be very easily done with basic AWK or R:

 

AWK:

awk '{print $0, $5/$6}' infile > outfile

Outfile will then have this header:

    rs_id   Allele1 Allele2 Freq1   Effect  StdErr  P.value Effect/StdErr

...which can be altered with a text editor of your choosing,

 

R:

Infile<-read.table("infile.txt", head=T)

infile$z-score<-infile$Effect/infile$StdErr

head(Infile, 1)

   rs_id   Allele1 Allele2 Freq1   Effect  StdErr  P.value z-score

 

ADD COMMENTlink modified 5.5 years ago • written 5.5 years ago by coleman_jonathan440

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

ADD REPLYlink modified 5.5 years ago • written 5.5 years ago by Nandini880
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1706 users visited in the last hour