LD score

suppressMessages(library(tidyverse))
work.dir ="~/Downloads/ldscore/"

ld score regression

## read ld-score in chr 22 calculated by Yanyu Liang using the GTEx V8 SNP set
ldscore = read.table(paste0(work.dir,"chr22.l2.ldscore.gz"),header=T,as.is=T)
head(ldscore)
## plot ldscore to get a sense of variability
hist(ldscore$L2,xlab="LD Score" , main ="Histogram of LD score")
plot(ldscore$BP, ldscore$L2,xlab="Chr 22 Position",ylab="LD Score", main = "LD Score across chr 22")
ind = 1:5000; ind = ind + 10000;plot(ldscore$BP[ind], ldscore$L2[ind],xlab="Chr 22 Position",ylab="LD Score")
## read GWAS result for height from the GIANT consortium (chr22 only)
giant = read.table(paste0(work.dir,"gwas_giant_chr22.txt"),header=T, as.is=T)
names(giant) = c("variant_id",      "panel_variant_id",        "chromosome",      "position",        "effect_allele",   "non_effect_allele",       "frequency",       "pvalue",  "zscore",  "effect_size",     "standard_error",  "sample_size",     "n_cases")
tempo = inner_join(giant,ldscore,by=c("panel_variant_id"="SNP") )
## plot Chi2 vs LD score
plot(tempo$zscore^2~ tempo$L2)
ggplot(tempo, aes(L2, zscore^2)) + geom_point(alpha=0.5,size=3) +geom_smooth(method="lm") 
fit = lm(tempo$zscore^2~ tempo$L2)
summary(fit)

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The source code is licensed under MIT.

Suggest changes

If you find any mistakes (including typos) or want to suggest changes, please feel free to edit the source file of this page on Github and create a pull request.

Citation

For attribution, please cite this work as

R package build (2021). L8-LD-score. BIOS 25328 Cancer Genomics Class Notes. /post/2021/02/18/l8-ld-score/

BibTeX citation

@misc{
  title = "L8-LD-score",
  author = "R package build",
  year = "2021",
  journal = "BIOS 25328 Cancer Genomics Class Notes",
  note = "/post/2021/02/18/l8-ld-score/"
}