Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master locuscompare #14

Open
wants to merge 38 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0c6cbc5
deleted: error.png
boxiangliu Jan 3, 2019
31e9190
added new webpage to select genome
boxiangliu Jan 3, 2019
80314df
added a switch between hg19 and hg38.
boxiangliu Jan 3, 2019
26c9b2b
Removed convert_unit(), parse_coordinate(),
boxiangliu Jan 3, 2019
7693835
renamed: sort1_and_ldl.R -> utils/pleiotropy/sort1_and_ldl.R
boxiangliu Jan 8, 2019
0aeef21
Merge branch 'master' of github.com:boxiangliu/locuscompare
boxiangliu Jan 8, 2019
28e8f8d
modified: ui.R
boxiangliu Jan 8, 2019
69192e4
modified: locuscompare.R
boxiangliu Jan 8, 2019
11ade8a
Merge branch 'master' of github.com:boxiangliu/locuscompare
boxiangliu Jan 8, 2019
28ef215
Modified server.R and ui.R to recognize mQTL and sQTL files
boxiangliu Jan 8, 2019
283fa3d
URLs in about.md page does not work
boxiangliu Jan 18, 2019
4692676
URLs in about.md page does not work.
boxiangliu Jan 18, 2019
7df94f0
URLs in about.md does not work.
boxiangliu Jan 18, 2019
5698db5
updating about.md
boxiangliu Jan 18, 2019
0f81d49
updated about.md
boxiangliu Jan 18, 2019
642f663
added gencode v38 bed file
boxiangliu Apr 14, 2019
6fff233
Merge branch 'master' of github.com:boxiangliu/locuscompare
boxiangliu Apr 14, 2019
432caaf
added sample_size_vs_clpp.R
boxiangliu Apr 14, 2019
c653539
updated fig1/
boxiangliu Apr 14, 2019
ff57d28
updated utility functions
boxiangliu Apr 14, 2019
3be3095
added utils/mysql/liftOver_gencode.sh
boxiangliu Apr 14, 2019
d350763
Fixed hg38 gene coordinate error
boxiangliu Apr 14, 2019
c8e56ee
updated about.md
Apr 15, 2019
769c6a3
fixed a small error in get_study(), genome() -> genome
boxiangliu Apr 21, 2019
7ea7451
Merge branch 'master' of github.com:boxiangliu/locuscompare
boxiangliu Apr 21, 2019
8f5f953
updated server.R to restrict the window size on Single Locus Mode.
boxiangliu May 1, 2019
34ae7e2
Upload GTEx v8 sex-stratified QTLs
Nov 27, 2019
217f744
Fixed missing bracket
Nov 27, 2019
7938b4a
Merge pull request #7 from mikegloudemans/master
boxiangliu Dec 4, 2019
0c406fd
updated .gitignore
boxiangliu Aug 30, 2020
c0a34e6
Mike made updates for more QTL types
zaczap Oct 29, 2020
caca10f
Merge branch 'master' of https://github.com/boxiangliu/locuscompare
zaczap Jan 29, 2021
782f6b2
updated ui.R
zaczap Jan 29, 2021
821ca98
Update README.md
boxiangliu Sep 18, 2022
11d5a8c
modified: about.md
zaczap Sep 18, 2022
5a8297d
Merge branch 'master' of https://github.com/boxiangliu/locuscompare
zaczap Sep 18, 2022
7f0fc41
Update README.md
boxiangliu Nov 24, 2022
18bc7a0
update
wangpage Apr 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data/gtex
data/ld
data/population
data/qtl
data/SMR
.DS_Store
._*
.Rproj.user
Expand All @@ -22,3 +23,4 @@ locuscompare.Rproj
tmp/
README.html
.httr-oauth
maintenance/
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
LocusCompare is an interactive visualization tool for comparing two genetic association datasets. For instance, it can be used to visualize the colocalization between a GWAS dataset to an eQTL dataset, which is particularly useful for fine-mapping studies.

## Usage
Please see the [FAQ page](https://github.com/boxiangliu/locuscompare/wiki/1.-FAQ) and the [documentation page](https://github.com/boxiangliu/locuscompare/wiki)
Please see the [FAQ page](https://github.com/boxiangliu/locuscompare/wiki/FAQ) and the [documentation page](https://github.com/boxiangliu/locuscompare/wiki)


## Questions
For questions and bug reports, please open an issue [here](https://github.com/boxiangliu/locuscompare/issues).

## 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
17 changes: 12 additions & 5 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Introduction
<img src="logo.png" width="600"/>

LocusCompare is a suite of tools and datasets to visualize the colocalization of summary statistics from pairs of association datasets (e.g. GWAS and eQTL). These tools and datasets inclue:
LocusCompare is a suite of tools and datasets to visualize the colocalization of summary statistics from pairs of association datasets (e.g. GWAS and eQTL). These tools and datasets include:

- Colocalization statistics between more than 200 GWAS and 48 GTEx (version 7) tissues
- Interactive LocusCompare plot to visualize a single locus
Expand All @@ -13,13 +13,14 @@ LocusCompare is a suite of tools and datasets to visualize the colocalization of
## Documentations
For instructions please follow these links:

- [Documentation](https://github.com/boxiangliu/locuscompare/wiki)
- [Frequently Asked Questions](https://github.com/boxiangliu/locuscompare/wiki/FAQ)
- [Report a bug](https://github.com/boxiangliu/locuscompare/issues)

- <a href="https://www.github.com/boxiangliu/locuscompare/wiki" target="_blank">Documentation</a>
- <a href="https://www.github.com/boxiangliu/locuscompare/wiki/FAQ" target="_blank">Frequently Asked Questions</a>
- <a href="https://www.github.com/boxiangliu/locuscompare/issues" target="_blank">Bug reports</a>

To download stand-alone version:

- [LocusCompareR](https://github.com/boxiangliu/locuscomparer)
- <a href="https://www.github.com/boxiangliu/locuscomparer" target="_blank">LocusCompareR</a>


## License
Expand All @@ -28,4 +29,10 @@ GPL v3 or later
## Developers
- Boxiang Liu (author, maintainer)
- Mike Gloudemans (author, maintainer)
- Abhiram Rao (author)
- Stephen Montgomery (author)

## 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
Binary file removed error.png
Binary file not shown.
4 changes: 2 additions & 2 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ source('locuscompare.R')
source('config/config.R')
library(digest)
library(utils)
library(googlesheets)
library(googlesheets4)
library(promises)
library(future)
plan(multiprocess)
plan (multisession)
library(mailR)
library(shinycssloaders)
library(googledrive)
Expand Down
68 changes: 38 additions & 30 deletions locuscompare.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ get_chr=function(eqtl_fn){
as.integer(str_replace(unique(fread(eqtl_fn)$chr),'chr',''))
}

get_position=function(x){
get_position=function(x,genome){
stopifnot('rsid' %in% colnames(x))
res = dbGetQuery(
conn = locuscompare_pool,
statement = sprintf(
"select rsid, chr, pos
from tkg_p3v5a
where rsid in ('%s')",paste0(x$rsid,collapse="','")
conn = locuscompare_pool,
statement = sprintf(
"select rsid, chr, pos
from %s
where rsid in ('%s')",
genome,
paste0(x$rsid,collapse="','")
)
)
y=merge(x,res,by='rsid')
Expand Down Expand Up @@ -187,39 +189,44 @@ assign_size=function(merged,snp){
}

make_combined_plot=function(merged,title1,title2,ld,snp=NULL){
if (is.null(snp)){
snp=merged[which.min(pval1+pval2),rsid]
} else {
if(!snp%in%merged$rsid){
stop(sprintf('%s not found in %s',snp,in_fn1))
}
}
print(sprintf('INFO - %s',snp))

color=assign_color(merged$rsid,snp,ld)
shape=assign_shape(merged)
size=assign_size(merged)
merged[,label:=ifelse(rsid==snp,rsid,'')]

p1=make_locuscatter(merged,title1,title2,ld,color,shape,size)
p2=make_locuszoom(merged[,list(rsid,logp=logp1,label)],title1,ld,color,shape,size)
p2=p2+theme(axis.text.x=element_blank(),axis.title.x=element_blank())
p3=make_locuszoom(merged[,list(rsid,logp=logp2,label)],title2,ld,color,shape,size)
p4=plot_grid(p2,p3,align='v',nrow=2)
p5=plot_grid(p1,p4)
return(p5)
if (is.null(snp)){
snp=merged[which.min(pval1+pval2),rsid]
} else {
if(!snp%in%merged$rsid){
stop(sprintf('%s not found in %s',snp,in_fn1))
}
}
print(sprintf('INFO - %s',snp))

color=assign_color(merged$rsid,snp,ld)
shape=assign_shape(merged)
size=assign_size(merged)
merged[,label:=ifelse(rsid==snp,rsid,'')]

theme_set(theme_light(base_size=14))
p1=make_locuscatter(merged,title1,title2,ld,color,shape,size)
p2=make_locuszoom(merged[,list(rsid,logp=logp1,label)],title1,ld,color,shape,size)
p2=p2+theme(axis.text.x=element_blank(),axis.title.x=element_blank())
p3=make_locuszoom(merged[,list(rsid,logp=logp2,label)],title2,ld,color,shape,size)
p4=plot_grid(p2,p3,align='v',nrow=2)
p5=plot_grid(p1,p4)
return(p5)
}




make_locuscatter=function(merged,title1,title2,ld,color,shape,size,legend=TRUE){
p = ggplot(merged,aes(logp1,logp2))+
geom_point(aes(fill=rsid,size=rsid,shape=rsid),alpha=0.8)+
xlab(paste(title1,' -log10(P)'))+ylab(paste(title2,' -log10(P)'))+
scale_fill_manual(values=color,guide='none')+
scale_shape_manual(values=shape,guide='none')+
scale_size_manual(values=size,guide='none')+
geom_text(aes(label=label),hjust = 1.1)

geom_text(aes(label=label),hjust = 1.1)+
theme(panel.background = element_rect(fill = "white"),axis.line = element_line(color = "black", size = 0.5),
axis.line.x = element_line(color = "black", size = 0.5),
axis.line.y = element_line(color = "black", size = 0.5))
if (legend){
legend_box=data.frame(x=0.8,y=seq(0.4,0.2,-0.05))
p1=ggdraw(p)+geom_rect(data=legend_box,aes(xmin=x,xmax=x+0.05,ymin=y,ymax=y+0.05),color='black',fill=rev(c('blue4','skyblue','darkgreen','orange','red')))+
Expand Down Expand Up @@ -247,7 +254,8 @@ make_locuszoom=function(metal,title,ld,color,shape,size,y_string='logp'){
geom_text(aes(label=label),hjust = 1.1)+
xlab(paste0('chr',chr,' (Mb)'))+
ylab(paste(title,'\n-log10(P)'))+
theme(plot.margin=unit(c(0.5, 1, 0.5, 0.5), "lines"))
theme(panel.background = element_rect(fill = "white"),plot.margin=unit(c(0.5, 1, 0.5, 0.5), "lines"), axis.line = element_line(color = "black", size = 0.5),
axis.line.x = element_line(color = "black", size = 0.5), axis.line.y = element_line(color = "black", size = 0.5))
return(p)
}

Expand Down