setwd("/Users/nmounier/Documents/SGG/Projects/Packaging/bGWAS") knitr::opts_chunk$set(echo = TRUE, fig.path = "doc/Figures/README-", out.width = "100%") # for tibbles... options(pillar.neg=F, # do no print neg number in red pillar.subtle=F, # turn off highliting of significant digits tibble.width = 170) # default=95, increase it to make it readable A = readRDS("inst/Data/A.RDS") # automatically updates manual devtools::build_manual() system("mv ../bGWAS_1.0.3.pdf doc/bGWAS-manual.pdf") # remove.packages("bGWAS")
# https://shields.io/ #TRAVIS CI buil cat( badger::badge_travis("n-mounier/bGWAS"), #version #badger::badge_github_version("n-mounier/bGWAS", "informational") badger::badge_custom("version", suppressMessages(badger::ver_devel("n-mounier/bGWAS")), "informational", "https://github.com/n-mounier/bGWAS"), #lifecycle badger::badge_lifecycle("maturing", "9cf"), #last commit: badger::badge_last_commit("n-mounier/bGWAS"), #license badger::badge_custom("license", "GPL-2.0", "lightgrey", "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html") #DOI #badger::badge_custom("poster", "10.5281/zenodo.3403093", "blueviolet", "https://doi.org/10.5281/zenodo.3403093") )
<!---
library(hexSticker) imgurl <- "inst/Figures/PriorEstimation.jpg" sticker(imgurl, package="bGWAS", p_size=8, p_color="#B4CE4E", h_fill="white", h_color="#A7E4F8", s_x=1, s_y=.8, s_width=.75, filename="inst/Figures/logo.png", dpi=2000) --->
:arrow_right: ESHG poster is available here.
:information_source: bGWAS
has been updated to version 1.0.3.
This update should solve the compatibility issues that arose with more recent R versions, but does not affect the analyses results. Note that you might need to update some packages to be able to continue using bGWAS
.
:warning: 28/10/2019 : The variance of the prior effects has been modified. If you used a previous version of the package, please re-run your analysis using this new version to get more accurate results.
Check the NEWS to learn more about what has been modified!
:warning: If you downloaded the Z-Matrix files before 20/08/2019, they are now obsolete and you will not be able to use them with the newest version of the package.
Note: some Prior GWASs have been removed, you can find more details here.
bGWAS is an R-package to perform a Bayesian GWAS (Genome Wide Association Study), using summary statistics from a conventional GWAS as input. The aim of the approach is to increase power by leveraging information from related traits and by comparing the observed Z-scores from the focal phenotype (provided as input) to prior effects. These prior effects are directly estimated from publicly available GWASs (currently, a set of 38 studies, last update 20-08-2019 - hereinafter referred to as "prior GWASs" or "risk factors"). Only prior GWASs having a significant causal effect on the focal phenotype, identified using a multivariable Mendelian Randomization (MR) approach, are used to calculate the prior effects. Causal effects are estimated masking the focal chromosome to ensure independence, and the prior effects are estimated as described in the figure below.
Observed and prior effects are compared using Bayes Factors. Significance is assessed by calculating the probability of observing a value larger than the observed BF (P-value) given the prior distribution. This is done by decomposing the analytical form of the BFs and using an approximation for most BFs to make the computation faster. Prior, posterior and direct effects, alongside BFs and p-values are returned. Note that prior, posterior and direct effects are estimated on the Z-score scale, but are automatically rescaled to beta scale if possible.
The principal functions available are:
bGWAS()
main function that calculates prior effects from prior GWASs, compares them to observed Z-scores and returns an object of class bGWAS
list_priorGWASs()
directly returns information about the prior GWASs that can be used to calculate prior effects
select_priorGWASs()
allows a quick selection of prior GWASs (to include/exclude specific studies when calculating prior effects)
extract_results_bGWAS()
returns results (prior, posterior and direct estimate / standard-error + p-value from BF for SNPs) from an object of class bGWAS
manhattan_plot_bGWAS()
creates a Manhattan Plot from an object of class bGWAS
extract_MRcoeffs_bGWAS()
returns multivariable MR coefficients (1 estimate using all chromosomes + 22 estimates with 1 chromosome masked) from an object of class bGWAS
coefficients_plot_bGWAS()
creates a Coefficients Plot (causal effect of each prior GWASs on the focal phenotype) from an object of class bGWAS
heatmap_bGWAS()
creates a heatmap to represent, for each significant SNP, the contribution of each prior GWAS to the estimated prior effect from an object of class bGWAS
All the functions available and more details about their usage can be found in the manual.
You can install the current version of bGWAS
with:
# Directly install the package from github # install.packages("remotes") remotes::install_github("n-mounier/bGWAS") library(bGWAS)
To run the analysis with bGWAS
two inputs are needed:
Can be a regular (space/tab/comma-separated) file or a gzipped file (.gz) or a data.frame
. Must contain the following columns, which can have alternative names:
rs
or rsid
, snp
, snpid
, rnpid
a1
or alt
, alts
a2
or a0
, ref
z
or Z
, zscore
b
or beta
, beta1
se
or std
These files should be downloaded separately and stored in ~/ZMatrices
or in the folder specified when launching the analysis. These files contains the Z-scores for all prior GWASs :
You can download these files using this link or following the instructions below. Please note that your input GWAS will be merged with the Z-Matrix files (using rsid and alleles to align effects), and that the results reported will use the Z-Matrix files chr:pos information (GRCh37 - since UK10K data has been used to imputed the prior GWASs).
wget https://drive.switch.ch/index.php/s/jvSwoIxRgCKUSI8/download -O ZMatrices.tar.gz tar xzvf ZMatrices.tar.gz
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.