Skip to contents

LD prune simulated data

Usage

sim_ld_prune(dat, pvalue, R_LD, r2_thresh = 0.1, pval_thresh = 1)

Arguments

dat

Data object produced by sim_mv

pvalue

Either a vector used to prioritize variants or an integer. If pvalue is an integer, i, variants will be priorized by the p-value for trait i. If pvalue is missing, variants will be prioritized randomly.

R_LD

LD pattern used to generate dat

r2_thresh

r^2 threshold for pruning

pval_thresh

p-value threshold for pruning (see details)

Value

A vector of indices corresponding to the LD-pruned variant set.

Details

Given results from sim_mv, and a vector of p-values, the function will return a list of variants that have p < pval_thresh and which mutually have squared correlation less than r2_thresh.

Examples

data("ld_mat_list")
data("AF")

# Two traits with no causal relationship, non-overlapping GWAS
set.seed(1)
G <- matrix(0, nrow = 2, ncol = 2)
dat <- sim_mv(N = 10000, 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.

# prune on p-value for first trait
pvals <- 2*pnorm(-abs(dat$beta_hat/dat$se_beta_hat))
prune_set_1 <- sim_ld_prune(dat, pvalue = pvals[,1], R_LD = ld_mat_list, pval_thresh = 1e-5)
# Above is equivalent to
prune_set_1 <- sim_ld_prune(dat, pvalue = 1, R_LD = ld_mat_list, pval_thresh = 1e-5)
#> Prioritizing variants based on p-value for trait 1