The ldscR
package is designed for performing LDSC in R. LDSC remains the most popular and convenient method for estimating additive heritability. This package provides efficient functions that allow for the simultaneous estimation of the genetic covariance matrix across multiple traits, without applying the LDSC Python package (https://github.com/bulik/ldsc) using an entry-by-entry scheme. Additionally, we use block-wise subsampling to estimate the standard errors.
You can install the ldscR
package directly from GitHub using the following command:
# Install the devtools package if you haven't already
if (!requireNamespace("devtools", quietly = TRUE))
install.packages("devtools")
# Install ldscR from GitHub
devtools::install_github("harryyiheyang/ldscR")
Here's an example workflow using ldscR:
First, download and prepare your GWAS summary data. Then, harmonize alleles using the filter_align() function:
library(ldscR)
data_url <- "http://tinyurl.com/nhdfwd8v"
temp_file <- tempfile()
download.file(data_url, temp_file, mode="wb")
gwaslist=readRDS(temp_file)
unlink(temp_file)
data("hapmap3")
gwaslist=filter_align(gwas_data_list=gwaslist,ref_panel=hapmap3[,c("SNP","A1","A2")])
data("EURLDSC")
fitldsc=ldscR(GWAS_List=gwaslist,LDSC=EURLDSC,estimate_SE=T)
Gcov=fitldsc$GCovEst
Ecov=fitldsc$ECovEst
Alternatively, we suggest setting estimate_SE=F
for a quick result when exploring the genetic relationships between multiple traits.
This package is under the MIT License.
For any questions or issues, please contact Yihe Yang at [email protected]