Based on the ieugwasr function (see reference)

ld_matrix(
  dat,
  colmap = NULL,
  method = "r",
  plink2 = genepi.utils::which_plink2(),
  plink_ref = genepi.utils::which_1000G_reference(build = "GRCh37"),
  ukbb_ref = NULL
)

Arguments

dat

data.frame like object, or file path, with at least column rsid; if columns ea,oa,beta,eaf are provided then the variants will be return harmonised to the reference panel (effect allele, data = major allele, reference)

colmap

a list, mapping to columns list(rsid=?,ea=?,oa=?,beta=?,eaf=?) where ? can be a character vector in the case of harmonised datasets. Warning - it is assumed that harmonised datasets are indeed harmonised, if not, any unharmonised variants will be inappropriately removed.

method

a string, either r or r2

a string, path to the plink executable

a string, path to the pfile genome reference

ukbb_ref

path to a UKBB reference file

Value

an LD matrix if only variants provided, else if alleles provided a list(dat=harmonised data, ld_mat=ld_matrix)