bGWAS: bGWAS - main function

View source: R/bGWAS.R

bGWASR Documentation

bGWAS - main function

Description

Performs a Bayesian GWAS from Summary Statistics, using publicly available results to calculate the prior effects of the SNPs and compare it to observed z-scores

Usage

bGWAS(
  name,
  GWAS,
  Z_matrices = "~/ZMatrices/",
  prior_studies = NULL,
  MR_threshold = 1e-06,
  MR_ninstruments = 3,
  MR_pruning_dist = 500,
  MR_pruning_LD = 0,
  MR_shrinkage = 1,
  stepwise_threshold = NULL,
  prior_shrinkage = NULL,
  sign_method = "p",
  sign_thresh = 5e-08,
  use_permutations = FALSE,
  res_pruning_dist = 500,
  res_pruning_LD = 0,
  save_files = FALSE,
  verbose = TRUE
)

Arguments

name

The name of the analysis (character)

GWAS

The path to the conventional GWAS of interest, the ID of the GWAS from the list of studies available (prior GWASs), or a data.frame (character, numeric or data.frame)

Z_matrices

The path to the folder containing Z-Matrices, default="~/ZMatrices/" (character)

prior_studies

The IDs of prior GWASs to use for the analysis, default=NULL, will include all the prior GWASs available (numeric vector)

MR_threshold

The threshold used to select strong instruments for MR, should be lower than 1e-5, default=1e-6 (numeric)

MR_ninstruments

The minimum number of strong instruments needed to use a prior GWAS, should be between 2 and 8, default=3 (numeric)

MR_pruning_dist

The distance used for pruning MR instruments (in Kb), should be between 10 and 1000, default=500 (numeric)

MR_pruning_LD

The LD threshold used for pruning MR instruments, should be between 0 and 1 (if 0, distance-based pruning is used), default=0 (numeric)

MR_shrinkage

The p-value threshold used for shrinkage before performing MR, should be between MR_threshold and 1 (no shrinkage), default=1 (numeric)

stepwise_threshold

The p-value threshold used for inclusion/exclusion of Prior GWASs during the stepwise selection approach, should be between 0.05 and 0.0005, default=NULL will use 0.05 divided by the number of Prior GWASs tested (numeric)

prior_shrinkage

The p-value threshold used for shrinkage before calculating the prior, should be between MR_threshold and 1, default=NULL will use MR_shrinkage (numeric)

sign_method

The method used to identify significant SNPs, should be "p" for p-value or "fdr" for false discovery rate, default="p" (character)

sign_thresh

The threshold used to identify significant SNPs, default="5e-8" (numeric)

use_permutations

A logical indicating if BF p-values should be estimated using the permutation approach, default=FALSE

res_pruning_dist

The distance used for pruning results (in Kb), should be between 10 and 1000, (if set to NULL, no pruning is done), default=500 (numeric)

res_pruning_LD

The LD threshold used for pruning results, should be between 0 and 1 (if 0, distance-based pruning is used), default=0 (numeric)

save_files

A logical indicating if the results should be saved as files, default=FALSE

verbose

A logical indicating if information on progress should be reported, default=TRUE

Details

Name and GWAS are required arguments. If GWAS is a path to a file (regular or .gz) or a data.frame, it should contain the following columns :
SNPID (rs numbers) should be : rs, rsid, snp, snpid, rnpid
A1 should be : a1, alt, alts
A2 should be : a2, a0, ref
Z should be : z, Z, zscore
If Z is not present, it can be calculated from BETA and SE.
BETA should be : b, beta, beta1
SE should be : se, std
Note: in order to get rescaled (prior/posterior/corrected) effects, BETA and SE should be provided.

Z-Matrix files, containing Z-scores for all prior GWASs should be downloaded separately and stored in "~/ZMatrices" or in the folder specified with the argument Z_matrices.
See [here](https://github.com/n-mounier/bGWAS) for more informations.

Use list_priorGWASs() to see all the prior GWASs available. Using one of them as your conventionnal GWAS (argument GWAS = numeric ID) will automatically remove it from the list of prior GWASs used to build the prior.

Use select_priorGWASs() to automatically select the prior GWASs to be included/excluded when building the prior (argument prior_studies).

Value

bGWAS() returns an object of class "bGWAS".
Additionnaly, if save_files=T, several files are created in the folder ./name/ :

  • "PriorGWASs.tsv" - contains information about all prior GWASs (general info + status (used/excluded) + MR coefficients)

  • "CoefficientsByChromosome.csv" - contains the MR estimates when masking the focal chromosome (22 coefficients / prior GWASs used for prior estimation)

  • "PriorBFp.csv" - contains BF and p-values, prior, posterior and direct effects estimates for all SNPs

  • "SignificantSNPs.csv" - contains BF and p-values, prior, posterior and direct effects estimates for a subset of significant SNPs

Examples

# Permorm bGWAS, using a small conventional GWAS included in the package (data.frame) 
# and selecting a subset of studies for the prior
## Not run: top
data("SmallGWAS_Timmers2019")
MyStudies = select_priorGWASs(include_traits=c("Blood Pressure", "Education"),  
                              include_files=c("cardiogram_gwas_results.txt", 
                                             "All_ancestries_SNP_gwas_mc_merge_nogc.tbl.uniq.gz"))
# 6 Prior GWASs used
list_priorGWASs(MyStudies) 

 A = bGWAS(name="Test_UsingSmallDataFrame",
          GWAS = SmallGWAS_Timmers2019,
          prior_studies=MyStudies,
          MR_threshold = 1e-6,
          stepwise_threshold=0.05,
          save_files=T)
          
## End(Not run)
          
# Permorm bGWAS, using a conventional GWAS from the list of prior GWASs
## Not run: MyGWAS = 3
list_priorGWASs(MyGWAS)
# Coronary Artery Disease GWAS (CARDIoGRAM)
B = bGWAS(name = "Test_UsingGWASfromPriorGWASs",
         GWAS = MyGWAS)
         
## End(Not run)
         
         

n-mounier/bGWAS documentation built on Oct. 11, 2023, 1:39 a.m.