Skip to contents

Extract LD matrix for specific variants in simulated data set

Usage

sim_extract_ld(dat, index, R_LD)

Arguments

dat

Simulation object produced by `sim_mv`

index

vector of indices for snps to extract LD

R_LD

List of eigen-decompositions used in original simulation

Value

An LD matrix. SNP order matches original index order

Examples

data("ld_mat_list")
data("AF")
# Two traits with no causal relationship, non-overlapping GWAS
# Set N = 0 so no summary statistics are produced
set.seed(1)
G <- matrix(0, nrow = 2, ncol = 2)
dat <- sim_mv(N = 0, J = 1000, h2 = c(0.04, 0.03), pi = 0.1,
               G = G,  R_LD = ld_mat_list, af = AF)
#> SNP effects provided for 1000 SNPs and 2 traits.

# extract ld matrix for all variants with p-value for trait 1 less than 1e-5
index <- c(1:20, 500:515)
ld_mat <- sim_extract_ld(dat, index, ld_mat_list)