| bGWAS | R Documentation | 
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
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
)
| 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  | 
| Z_matrices | The path to the folder containing Z-Matrices,  | 
| prior_studies | The IDs of prior GWASs to use for the analysis,  | 
| MR_threshold | The threshold used to select strong instruments for MR, should be lower
than 1e-5,  | 
| MR_ninstruments | The minimum number of strong instruments needed to use a prior GWAS, 
should be between 2 and 8,  | 
| MR_pruning_dist | The distance used for pruning MR instruments (in Kb), should be between 10 and 1000,
 | 
| MR_pruning_LD | The LD threshold used for pruning MR instruments, should be between 0 and 1
(if 0, distance-based pruning is used),  | 
| MR_shrinkage | The p-value threshold used for shrinkage before performing MR, should be between
 | 
| 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,  | 
| prior_shrinkage | The p-value threshold used for shrinkage before calculating the prior,
should be between  | 
| sign_method | The method used to identify significant SNPs, should be  | 
| sign_thresh | The threshold used to identify significant SNPs,  | 
| use_permutations | A logical indicating if BF p-values should be estimated using the permutation
approach,   | 
| 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),  | 
| res_pruning_LD | The LD threshold used for pruning results, should be between 0 and 1
(if 0, distance-based pruning is used),  | 
| save_files | A logical indicating if the results should be saved as files,
 | 
| verbose | A logical indicating if information on progress should be reported,
 | 
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).
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
# 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)
         
         
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.