Perform LD clumping on a dataframe based on p-value threshold
finemap_pval_LD.RdThis function performs linkage disequilibrium (LD) clumping on a given dataframe of genetic association results. The function filters the dataframe based on the provided p-value threshold and then applies the LD clumping for different values of r2. If clumping fails, the function returns a dataframe with NA values in the SNP and test columns.
Arguments
- df
A data frame containing genetic association results with at least the following columns:
pval(p-value) andrsid(SNP identifier).- bfile
A character string specifying the prefix for the PLINK binary files (e.g.,
.bed,.bim,.fam).- pval_threshold
A numeric value specifying the p-value threshold for filtering SNPs. Default is
5E-8.- clump_r2
A numeric vector specifying the r2 threshold(s) for LD clumping. Default is
0.001. The function will perform clumping for each r2 value.
Value
A tibble with columns SNP, test, and LD, where:
SNP: the SNPs selected after clumping.test: a character string indicating the test, always "p_ld".LD: the r2 threshold used for clumping.
Examples
# Example usage
if (FALSE) { # \dontrun{
result <- finemap_pval_LD(
df = my_data,
bfile = "path_to_bfile",
pval_threshold = 5E-8,
clump_r2 = c(0.01, 0.1)
)
} # }