knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Here we'll perform colocalisation analysis for a particular region, and plot the regions as well. We'll do the same analysis two ways:
We'll use the example of LDL cholesterol ieu-a-300 and coronary heart disease ieu-a-7.
Load libraries:
suppressPackageStartupMessages(suppressWarnings({ library(gwasglue) library(dplyr) library(gassocplot) library(coloc) }))
First find a region that we know to be associated with LDL cholesterol.
top <- ieugwasr::tophits('ieu-a-300') %>% arrange(p) top
Choose the best signal and create a range
chrpos <- paste0(top$chr[1], ":", top$position[1] - 90000, "-", top$position[1] + 90000) chrpos
Extract, harmonise and format the data
out <- ieugwasr_to_coloc(id1='ieu-a-300', id2='ieu-a-7', chrompos=chrpos)
Run colocalisation analysis
res <- coloc::coloc.abf(out[[1]], out[[2]])
Plot
temp <- coloc_to_gassocplot(out) gassocplot::stack_assoc_plot(temp$markers, temp$z, temp$corr, traits=temp$traits)
Let's do the same with the vcf files (and the indexes). Download from here:
Set a region to plot:
chrpos <- "19:11112306-11292306"
Extract region from vcf files and convert to coloc object
vout <- gwasvcf_to_coloc("ieu-a-300.vcf.gz", "ieu-a-7.vcf.gz", chrpos)
Run colocalisation analysis
vres <- coloc::coloc.abf(vout[[1]], vout[[2]])
Plot
library(gassocplot) temp <- coloc_to_gassocplot(vout) gassocplot::stack_assoc_plot(temp$markers, temp$z, temp$corr, traits=temp$traits)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.