MRlap: MRlap - main function

View source: R/MRlap.R

MRlapR Documentation

MRlap - main function

Description

Performs cross-trait LD score regression, IVW-MR analysis and provide a correction that simultaneously accounts for biases due to the overlap between the exposure and outcome samples, the use of weak instruments and Winner’s curse.

Usage

MRlap(
  exposure,
  exposure_name = NULL,
  outcome,
  outcome_name = NULL,
  ld,
  hm3,
  do_pruning = TRUE,
  user_SNPsToKeep = "",
  MR_threshold = 5e-08,
  MR_pruning_dist = 500,
  MR_pruning_LD = 0,
  MR_reverse = 0.001,
  MR_plink = NULL,
  MR_bfile = NULL,
  save_logfiles = FALSE,
  verbose = TRUE
)

Arguments

exposure

The path to the file containing the GWAS summary statistics for the exposure, or a data.frame (character, or data.frame)

exposure_name

The name of the exposure trait, default="exposure" (character)

outcome

The path to the file containing the GWAS summary statistics for the exposure, or a data.frame (character, or data.frame)

outcome_name

The name of the outcome trait, default="outcome" (character)

ld

The path to the folder in which the LD scores used in the analysis are located. Expects LD scores formated as required by the original LD score regression software. (character)

hm3

The path to a file of SNPs with alt, ref alleles and rsid used to allign alleles across traits (character)

do_pruning

A logical indicating MRlap should identify lead SNPs via pruning (if FALSE, the user should provide with user_SNPsToKeep, and all the MR_[...] parameters will be ignored), default=TRUE

user_SNPsToKeep

A vector of SNP RSIDs to use as the instrumental variables (only used if do_pruning==FALSE), default="" (character)

MR_threshold

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

MR_pruning_dist

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

MR_pruning_LD

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

MR_reverse

The p-value used to exclude MR instruments that are more strongly associated with the outcome than with the exposure,default=1e-3 (numeric)

MR_plink

The path to to Plink v1.90 binary (if left as NULL will not use local installation if LD pruning), default="" (character)

MR_bfile

The path to appropriate BIM/BED reference panel files on your server, default="" (character)

save_logfiles

A logical indicating if log files from LDSC should be saved, default=FALSE

verbose

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

Details

exposure and outcome are required arguments. The input file / data.frame should contain the following columns (lower or upper case) :
SNPID (rs numbers) should be : rs, rsid, snp, snpid, rnpid
CHR (chromosome) should be : chr
POS (position) should be : pos
ALT (effect allele) should be : a1, alt, alts
REF (reference allele) should be : a2, a0, ref
Z (z-score) should be : Z, zscore
N (sample size) should be : N
If Z is not present, it can be calculated from BETA and SE.
BETA should be : b, beta, beta1, or
SE should be : se, std
If (at least) one of the datasets is coming from a case-control GWAS:* The Sample size column should correspond to the total sample size.


n-mounier/MRlap documentation built on Jan. 11, 2025, 8:37 a.m.