Skip to contents
library(GwasDataImport)
#> API: public: http://gwas-api.mrcieu.ac.uk/
#> API: private: http://ieu-db-interface.epi.bris.ac.uk:8082/
library(data.table)

There are three ways to determine the build of a dataset:

  • determine_build - Lookup build against a selected number of HM3 SNPs, matching by rsid
  • determine_build_position - Lookup build against a selected number of HM3 SNPs, matching by chromosome and position
  • determine_build_biomart - Lookup positions on biomaRt

The liftover_gwas() function determines the build using each of those options, and then performs the liftover automatically.

filename <-
  system.file(package = "GwasDataImport", "extdata/pos_0002.txt.gz")
dat <- data.table::fread(filename)
a <-
  liftover_gwas(
    dat,
    to = 38,
    chr_col = "CHROM",
    pos_col = "POS",
    snp_col = "RSID",
    ea_col = "ALT",
    oa_col = "REF"
  )
#> Using rsid
#> Lifting build: 37 to 38
#> Loading chainfile
#> Converting chromosome codings
#> Organising
#> Lifting
#> Organising again
#> Reordering
#> Removing duplicates
#> Done