Repository navigation
R GWAS IV: Data analysis
We are now ready to do our first GWAS. We will use the clean binary data that we created (gwas-data.clean). In the covs.txt you downloaded we got two phenotypes. One quantitative trait q and one disease trait c. The covs.txt is a small file so you can open it and have a look. It has 7 columns for each individual (row):
- FID (Family name)
- IID (Individual name)
- q (the quantative trait)
- c (the disease trait. 1=healthy, 2=ill)
- age (age of individual)
- bmi (well...)
- sex (gender, 1=male, 2=female)
In our first GWAS we will use the disease trait. The argument we will use is the --assoc argument. That argument tells PLINK to do an association analysis. PLINK can do two types of regressions: either linear regressions or logistic regressions and we don’t need to specify which one we want to use. That is specified in the values of the phenotype. A dichotomous phenotype (leading to a logistic regression) can only take the values 1 for unaffected, 2 for affected and -9 for missing.
We will also need to tell PLINK what phenotype we want to analyse and where to find it.
The --pheno command tells PLINK which file contains the phenotype (in our case covs.txt).
The --pheno-name tells PLINK what column in that file contains the phenotype (in our case c).
There are also commands for adding covariates to the model, --covar and --covar-name that works similarly to the --pheno, --pheno-name, but we wont bother with this.
Now, run PLINK with the following command to do an association analysis on the disease trait:
plink --bfile gwas-data.clean --assoc --pheno covs.txt --pheno-name c --out diseasetrait
The result will be stored in a diseasetrait.assoc file. There will be about 720.000 rows in this file, but you can probably open it in a text editor (and maybe even in Excel) and take a look. You will see that there is one row per SNP and there are 10 columns for chromosome, SNP, position (BP) from the .map file, code for A1 (minor allele), frequency of A1 in affected individuals, frequency of A1 in unaffected individuals, the code for A2 (major allele), the chi-square test statistic, the p-value and the Odds Ratio. The Odds Ratio tells you how the odds of being affected changes if you add one more minor allele.
As you can see, the SNPs in the result file are sorted on the chromosome and position. This means that we can’t see yet where our best results are. We will do this later in R.
The second GWAS is going to be on the quantitative trait (q in covs.txt).
Run PLINK with the following command to do an association analysis on the quantitative trait:
plink --bfile gwas-data.clean --assoc --pheno covs.txt --pheno-name q --out quanttrait
The results are printed into a .qassoc file with one row per SNP and 9 columns containing chromosome, SNP, position, number of missing genotypes for the SNP, the estimated effect (BETA), the standard error of BETA, the R^2 value, the test statistic and the p-value. As for the disease trait GWAS, the results are sorted based on position in the genome and we can’t see the top results yet.