Harmonise effects across two GWAS datasets. The gwas objects are expected to be in standard format - see standardise_gwas(). Corrects strand for non-palindromic SNPs (flip BETAs). Drop palindromic variants. Drop non-matching variant alleles.
This function is based on the same function in the Slopehunter and TwoSampleMR packages. I have re-written it here to use the standardised column names and use pure data.table syntax for increased processing speed.

harmonise(
  gwas1,
  gwas2,
  gwas1_trait = "incidence",
  gwas2_trait = "progression",
  merge = NULL
)

Arguments

gwas1

a data.frame like object or file path, GWAS 1

gwas2

a data.frame like object or file path, GWAS 2

gwas1_trait

a string, suffix to add to gwas1 column names e.g. progression –> columns chr_progression, bp_progression, ..., etc.

gwas2_trait

a string, suffix to add to gwas2 column names e.g. progression –> columns chr_progression, bp_progression, ..., etc.

merge

a named character vector c(gwas1_col=gwas2_col) of the columns to join on; e.g. c("CHR1"="CHR2","BP1"="BP2"); can be NULL, in which case the gwases must be data.tables and already have keys set

Value

a data.table, the harmonised dataset

References

Slopehunter https://github.com/Osmahmoud/SlopeHunter

TwoSampleMR https://github.com/MRCIEU/TwoSampleMR