Introduction

LD score regression is a statistical method used to estimate the heritability of complex traits and to understand the genetic architecture underlying genome-wide association study (GWAS) results. By analyzing the relationship between linkage disequilibrium (LD) scores (which measure the extent to which SNPs are correlated with nearby genetic variants) and GWAS summary statistics, it separates true polygenic signal from confounding biases like population stratification. This approach helps to quantify the contribution of common genetic variants to trait heritability.

This tutorial demonstrates how to estimate narrow-sense heritability and genetic correlation using the LD Score Regression (LDSC) method within the context of a gact database. It also includes examples of partitioning of heritability using different annotation sources. The script makes use of the gcorr and gact libraries to process and analyze GWAS summary statistics.


# Load libraries
library(gcorr)
library(gact)

# Load GAlist
GAlist <- readRDS(file="C:/Users/gact/hsa.0.0.1/GAlist_hsa.0.0.1.rds")

# Check studies in gact database
GAlist$studies

# Select GWAS study IDs
studyIDs <- c("GWAS1","GWAS2","GWAS6")

# Get GWAS summary statistics for studyIDs (e.g. z and n) from gact database
stat <- getMarkerStat(GAlist=GAlist, studyID=studyIDs)

# Get ldscores matched to the ancestry of GWAS data
ldscores <- gact::getLDscores(GAlist=GAlist, ancestry="EUR", version="1000G")

# Estimate narrow sense heritability using ldsc
fit <- ldsc(z=stat$z, n=stat$n, ldscores=ldscores, what="h2")
fit

# Estimate genetic correlation using using ldsc
fit <- ldsc(z=stat$z, n=stat$n, ldscores=ldscores, what="rg")
fit$h2
fit$rg

# Reference sample count for grouped marker-set fits.
Glist <- readRDS(file.path(GAlist$dirs["marker"], "Glist_1000G_eur_filtered.rds"))

# Partition heritability using chromosome sets.
sets <- getMarkerSets(GAlist=GAlist, feature="Chromosomes")
fit <- ldsc(z=stat$z, n=stat$n, ldscores=ldscores, sets=sets, what="h2", residual=TRUE,
  set_model="grouped", reference_sample_size=Glist$n)
fit

# Regulatory tagging scores require the prepared sparse-LD reference.
sets <- getMarkerSets(GAlist=GAlist, feature="Regulatory Categories")
fit <- ldsc(z=stat$z, n=stat$n, Glist=Glist, sets=sets, what="h2", residual=TRUE)
fit

Chromosome groups reuse stored ordinary LD scores. Overlapping regulatory annotations use their annotation-specific tagging scores from sparse LD. The standalone example uses regression; qgg’s Bayesian LDSC prior is not implemented by this interface.