LD matrix
ld_matrix.Rmd
Setup
See the setup process for the PLINK2 executable and reference file in the Clumping vignette.
library(genepi.utils)
# the gwas data
gwas <- GWAS(dat=system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"), map="ns_map", fill_rsid="b37_dbsnp156")
gwas <- as.data.table(gwas)
# check path to reference
which_1000G_reference("GRCh37")
# check path to plink2 executable
which_plink2()
LD matrix
Generate the LD matrix. If we provide a GWAS data.table with the alleles then it will be harmonised with the LD matrix.
# produce LD matrix
obj <- ld_matrix(gwas,
method = "r2",
plink2 = genepi.utils::which_plink2(),
plink_ref = genepi.utils::which_1000G_reference(build="GRCh37"))