The exposure data and outcome data are now obtained, e.g.:
ao <- available_outcomes() #> API: public: http://gwas-api.mrcieu.ac.uk/ bmi_exp_dat <- extract_instruments(outcomes = 'ieu-a-2') chd_out_dat <- extract_outcome_data(snps = bmi_exp_dat$SNP, outcomes = 'ieu-a-7') #> Extracting data for 79 SNP(s) from 1 GWAS(s)
but it is important to harmonise the effects. This means that the effect of a SNP on the exposure and the effect of that SNP on the outcome must each correspond to the same allele.
Note: The IEU GWAS database contains data that is already harmonised, meaning that the non-effect allele is aligned to the human genome reference sequence (build 37). It’s still recommended to harmonise, but in principle everything should be on the forward strand and effect alleles always relating to the same allele. Some discrepancies could arise if there are multi-allelic variants that are represented as different bi-allelic variants in different studies.
To harmonise the exposure and outcome data, do the following:
dat <- harmonise_data( exposure_dat = bmi_exp_dat, outcome_dat = chd_out_dat ) #> Harmonising Body mass index || id:ieu-a-2 (ieu-a-2) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
This creates a new data frame that has the exposure data and outcome data combined.
If there were 3 exposure traits and 3 outcome traits then there will be 9 sets of harmonisations being performed - harmonising the SNP effects of exposure trait 1 against outcome trait 1; exposure trait 1 against outcome trait 2; and so on.
Recent GWASs typically present the effects of a SNP in reference to the allele on the forward strand. But as reference panels are updated the forward strand sometimes changes, and GWASs from a few years ago aren’t guaranteed to be using forward strand conventions.
Some examples are shown below:
exposure effect = 0.5 effect allele = A other allele = G outcome effect = 0.05 effect allele = A other allele = G
Here the effect allele on the exposure and the outcome is the same
exposure effect = 0.5 effect allele = A other allele = G outcome effect = -0.05 effect allele = C other allele = T
Here the outcome GWAS is presenting the effect for the alternate allele on the reverse strand. We need to flip the outcome effect to 0.05 to correspond to the same allele as the exposure GWAS on the forward strand.
exposure effect = 0.5 effect allele = A other allele = G outcome effect = -0.05 effect allele = A other allele = C
Here the alleles do not correspond for the same SNP, so this SNP will be discarded from the analysis.
exposure effect = 0.5 effect allele = A other allele = T effect allele frequency = 0.11 outcome effect = -0.05 effect allele = A other allele = T effect allele frequency = 0.91
Here the alleles correspond, but it is a palindromic SNP, such that the alleles on the forward strand are the same as on the reverse strand (A/T on forward is T/A on the reverse). However, the allele frequency of the effect allele gives us information - if the outcome effect allele (A) were on the forward strand we would expect it to have a low allele frequency, but given it has a high frequency (0.91) we infer that the outcome GWAS is presenting the effect on the reverse strand for the alternative allele. We would flip the effect to 0.05 for the outcome GWAS.
exposure effect = 0.5 effect allele = A other allele = T effect allele frequency = 0.50 outcome effect = -0.05 effect allele = A other allele = T effect allele frequency = 0.50
This is similar to the above, except the allele frequency no longer gives us information about the strand. We would discard this SNP. This is done for any palindromic SNPs that have minor allele frequency above 0.42.
There are three options to harmonising the data.
- Assume all alleles are presented on the forward strand
- Try to infer the forward strand alleles using allele frequency information
- Correct the strand for non-palindromic SNPs, but drop all palindromic SNPs
By default, the
harmonise_data function uses option 2,
but this can be modified using the
harmonise_data(exposure_dat, outcome_dat, action = 3).
After data harmonisation, users may find that their dataset contains duplicate exposure-outcome summary sets. This can arise, for example, when a GWAS consortium has released multiple results from separate GWAS analyses for the same trait. For example, there are multiple GWAS summary datasets for body mass index and coronary heart disease:
ao[ao$trait == "Body mass index", c("trait", "id", "pmid", "author", "sample_size", "nsnp")] #> # A tibble: 24 × 6 #> trait id pmid author sample_size nsnp #> <chr> <chr> <int> <chr> <int> <int> #> 1 Body mass index ebi-a-GCST90103751 35051171 Wong HS 21930 6.37e6 #> 2 Body mass index ebi-a-GCST90095039 35399580 Fern<U+00E1>n… 330793 2.40e6 #> 3 Body mass index ebi-a-GCST90095034 35399580 Fern<U+00E1>n… 56161 8.76e6 #> 4 Body mass index ebi-a-GCST90029007 29892013 Loh PR 532396 1.20e7 #> 5 Body mass index ebi-a-GCST90025994 34226706 Barton AR 457756 4.24e6 #> 6 Body mass index ebi-a-GCST90018947 34594039 Sakaue S 359983 1.91e7 #> 7 Body mass index ebi-a-GCST90018727 34594039 Sakaue S 163835 1.25e7 #> 8 Body mass index ieu-a-94 23754948 Randall JC 60586 2.74e6 #> 9 Body mass index ieu-a-2 25673413 Locke AE 339224 2.56e6 #> 10 Body mass index ieu-a-95 23754948 Randall JC 73137 2.74e6 #> # ℹ 14 more rows ao[ao$trait == "Coronary heart disease", c("trait", "id", "pmid", "author", "ncase", "ncontrol", "nsnp")] #> # A tibble: 5 × 7 #> trait id pmid author ncase ncontrol nsnp #> <chr> <chr> <int> <chr> <int> <int> <int> #> 1 Coronary heart disease ieu-a-7 26343387 Nikpay 60801 123504 9.46e6 #> 2 Coronary heart disease ieu-a-9 23202125 Delouk… 63746 130681 7.91e4 #> 3 Coronary heart disease ebi-a-GCST000998 21378990 Schunk… 22233 64762 2.42e6 #> 4 Coronary heart disease ieu-a-8 21378990 Schunk… 22233 64762 2.42e6 #> 5 Coronary heart disease ieu-a-6 21378988 Peden 15420 15062 5.40e5
There are therefore multiple potential combinations of body mass index and coronary heart disease, which would likely lead to duplicate MR analyses. We recommend that users prune their datasets so that only the exposure-outcome combination with the highested expected power is retained. This can be done by selecting the exposure-outcome summary set with the largest sample size for the outcome, using the power_prune function:
dat <- power_prune(dat, method = 1, dist.outcome = "binary")
This drops the duplicate exposure-outcome sets with the smaller outcome sample size (number of cases for binary outcomes). Remaining duplicates are then dropped on the basis of the exposure sample size. However, if there are a large number of SNPs available to instrument an exposure, the outcome GWAS with the better SNP coverage may provide better power than the outcome GWAS with the larger sample size. This can occur, for example, if the larger outcome GWAS has used a targeted genotyping array. In such instances, it may be better to prune studies on the basis of instrument strength (i.e. variation in exposure explained by the instrumental SNPs) as well as sample size. This can be done by setting the method argument to 2:
dat <- power_prune(dat, method = 2, dist.outcome = "binary")
This procedure drops duplicate exposure-outcome sets on the basis of instrument strength and sample size, and assumes that the SNP-exposure effects correspond to a continuous trait with a normal distribution (i.e. exposure should not be binary). The SNP-outcome effects can correspond to either a binary or continuous trait (default behaviour is to assume a binary distribution). If the exposure is binary then method 1 should be used.