Question: Obtain A1 and A2 alleles from plink output
gravatar for cdeboever3
3.3 years ago by
cdeboever30 wrote:

I'm trying to convert plink output to the .sumstats format for use with LD score regression and I don't understand how plink is coding alleles. The .sumstats files look like


rs3131969 A G 0.003 17115.000

We are running GWAS for quantitative traits using plink1.9:

./plink --bfile ../cal/chrom$i --covar sexAgeCovar10.pcs --covar-name age sex C1 C2 C3 C4 --linear standard-beta

How can I convert the A1 column from the .assoc output files to A1 and A2 columns like above?

We are using plink2 for case/control GWAS:

./plink2f --bfile ../cal/chrom$i --covar keep.10pcs --covar-name C1 C2 C3 C4 --glm firth-fallback

Similarly, how can I convert the REF and ALT1 columns from the .hybrid output file to A1 and A2 columns like above?

plink ld score • 2.6k views
ADD COMMENTlink modified 3.2 years ago • written 3.3 years ago by cdeboever30
gravatar for chrchang523
3.3 years ago by
United States
chrchang5237.1k wrote:

With plink 1.9, assuming that the A2 alleles in chrom##.bim are always major (you can double-check by running "./plink --bfile ../cal/chrom## --make-bed" and verifying that the new .bim file is identical to the old one, since plink 1.x automatically flips minor A2 alleles), you can

  1. Create an allele_cols.txt file with just the A1 A2 header line: "echo A1 A2 > allele_cols.txt"
  2. Manually extract the alleles from the .bim file, and append them to allele_cols.txt: "cat chrom##.bim | cut -f 5-6 | tr '\t' ' ' >> allele_cols.txt"
  3. Extract the SNP, NMISS, and STAT columns from the .assoc file, one at a time. (STAT -> Z, NMISS -> N.) "cat plink.assoc.linear | awk '{print $2}' > snp_col.txt", similarly for columns 6 and 8.
  4. Paste the columns together: "paste snp_col.txt allele_cols.txt zcol.txt ncol.txt > my.sumstats"
  5. Change the STAT and NMISS headers, if you didn't do so in step 3.

plink 2.0 is a bit simpler since everything's in one file; you can treat REF as A2 and ALT1 as A1.

ADD COMMENTlink written 3.3 years ago by chrchang5237.1k
Please log in to add an answer.


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