boxiangliu / locuscomparer

LocusCompareR is a R package with visualization tools for comparing two genetic association datasets.
106 stars 18 forks source link
colocalization eqtl gwas

LocusCompareR

1. Installation

LocusCompareR is an R package for visualization of GWAS-eQTL colocalization events.

Use the following commands to install LocusCompareR. If you don't have devtools, uncomment the first line to install it.

# install.packages("devtools")
devtools::install_github("boxiangliu/locuscomparer")

2. Example

To illustrate the use of locuscompare, we use the GWAS dataset from Nikpay et al. (2015) and the coronary artery eQTL dataset from GTEx v7 at the PHACTR1 locus:

library(locuscomparer)
gwas_fn = system.file('extdata','gwas.tsv', package = 'locuscomparer')
eqtl_fn = system.file('extdata','eqtl.tsv', package = 'locuscomparer')
locuscompare(in_fn1 = gwas_fn, in_fn2 = eqtl_fn, title1 = 'CAD GWAS', title2 = 'Coronary Artery eQTL')

The output from the main function is a figure like the following:

The labeled SNP is the lead SNP (in this case for both studies), and other SNPs are colored according to their LD $r^2$ with the lead SNP.

3. Using your own dataset:

The input to locuscompare::main() is a two-column tab-delimited text file with two columns:

  1. rsid
  2. pval

Here is an example file:

rsid    pval
rs62156064  0.564395
rs7562234   0.399642
rs11677377  0.34308
rs35076156  0.625237

You can download the example files below: GWAS and eQTL datasets.

Then run the following commands:

library(locuscomparer)
gwas_fn = 'path/to/gwas.tsv'
eqtl_fn = 'path/to/eqtl.tsv'
locuscompare(in_fn1 = gwas_fn, in_fn2 = eqtl_fn, title = 'GWAS', title2 = 'eQTL')

4. Documentations

To view documentation for each function, type ?[function name] in the R console.

LocusCompareR current export the following functions:

Data munging

Plotting

Data loading

5. Citation

If you use locuscompare, please cite the following paper: https://www.nature.com/articles/s41588-019-0404-0

Boxiang Liu, Michael J. Gloudemans, Abhiram S. Rao, Erik Ingelsson & Stephen B. Montgomery (2019) Abundant associations with gene expression complicate GWAS follow-up, Nature Genetics