ld_matrix: Get LD matrix for list of SNPs

View source: R/ld_matrix.R

ld_matrixR Documentation

Get LD matrix for list of SNPs


This function takes a list of SNPs and searches for them in a specified super-population in the 1000 Genomes phase 3 reference panel. It then creates an LD matrix of r values (signed, and not squared). All LD values are with respect to the major alleles in the 1000G dataset. You can specify whether the allele names are displayed.


  with_alleles = TRUE,
  pop = "EUR",
  access_token = check_access_token(),
  opengwas_jwt = get_opengwas_jwt(),
  bfile = NULL,
  plink_bin = NULL



List of variants (rsids)


Whether to append the allele names to the SNP names. Default: TRUE


Super-population to use as reference panel. Default = "EUR". Options are "EUR", "SAS", "EAS", "AFR", "AMR". 'legacy' also available - which is a previously used verison of the EUR panel with a slightly different set of markers


Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already


Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT.#' @param bfile If this is provided then will use the API. Default = NULL


If this is provided then will use the API. Default = NULL


If NULL and bfile is not NULL then will detect packaged plink binary for specific OS. Otherwise specify path to plink binary. Default = NULL


The data used for generating the LD matrix includes only bi-allelic SNPs with MAF > 0.01, so it's quite possible that a variant you want to include will be absent. If it is absent, it will be automatically excluded from the results.

You can check if your variants are present in the LD reference panel using ld_reflookup()

This function does put load on the OpenGWAS servers, which makes life more difficult for other users, and has been limited to analyse only up to 500 variants at a time. We have implemented a method and made available the LD reference panels to perform the operation locally, see ld_matrix() and related vignettes for details.


Matrix of LD r values

MRCIEU/ieugwasr documentation built on April 20, 2024, 11:31 p.m.