Skip to contents

This function takes data intrumental variables as produced by format_data() and used to perform MR analysis against a list of outcomes from MR-Base.

Usage

pqtlMR(ivs, ids, mr_plot = FALSE, prefix = "pQTL-combined-", reverse = FALSE)

Arguments

ivs

Instrumental variables from format_data().

ids

A list of MR-Base IDs.

mr_plot

to produce plots.

prefix

a prefix for output files.

reverse

if TRUE, perform reverse MR.

Value

No value is returned but several files.

Details

This function is based on TwoSampleMR.

Note

Adapted from script by Jie Zheng.

References

Zheng J, et al. (2020). Phenome-wide Mendelian randomization mapping the influence of the plasma proteome on complex diseases. Nature Genetics 52(10): 1122-1131.

Examples

library(TwoSampleMR)
#> TwoSampleMR version 0.5.6 
#> [>] New: Option to use non-European LD reference panels for clumping etc
#> [>] Some studies temporarily quarantined to verify effect allele
#> [>] See news(package='TwoSampleMR') and https://gwas.mrcieu.ac.uk for further details
library(pQTLtools)
# Original examples
f <- file.path(find.package("pQTLtools",lib.loc=.libPaths()),"tests","Ins.csv")
ivs <- format_data(read.csv(f))
ids <- c("ieu-a-7","ebi-a-GCST007432")
pqtlMR(ivs, ids, mr_plot=FALSE)
#> Extracting data for 2 SNP(s) from 2 GWAS(s)
#> Harmonising ABO (9OAqi2) and FEV1 || id:ebi-a-GCST007432 (ebi-a-GCST007432)
#> Harmonising LIFR (VnpN0R) and FEV1 || id:ebi-a-GCST007432 (ebi-a-GCST007432)
#> Harmonising ABO (9OAqi2) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
#> Harmonising LIFR (VnpN0R) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
#> Analysing '9OAqi2' on 'ebi-a-GCST007432'
#> Analysing '9OAqi2' on 'ieu-a-7'
#> Analysing 'VnpN0R' on 'ebi-a-GCST007432'
#> Analysing 'VnpN0R' on 'ieu-a-7'
# A bidirectional analysis
f <- file.path(find.package("pQTLtools",lib.loc=.libPaths()),"tests","ms.ins")
ivs <- format_data(read.table(f, header=TRUE), samplesize_col="N")
ids <- "ieu-b-18"
# MR
pqtlMR(ivs, ids, prefix="MS-")
#> Extracting data for 2 SNP(s) from 1 GWAS(s)
#> Finding proxies for 1 SNPs in outcome ieu-b-18
#> Extracting data for 1 SNP(s) from 1 GWAS(s)
#> Harmonising TNFB (Qnps3m) and multiple sclerosis || id:ieu-b-18 (ieu-b-18)
#> Analysing 'Qnps3m' on 'ieu-b-18'
# reverse MR
pqtlMR(ivs, ids, ,prefix="MS_rev-",reverse=TRUE)
#> Extracting data for 2 SNP(s) from 1 GWAS(s)
#> Finding proxies for 1 SNPs in outcome ieu-b-18
#> Extracting data for 1 SNP(s) from 1 GWAS(s)
#> Harmonising TNFB (Qnps3m) and multiple sclerosis || id:ieu-b-18 (ieu-b-18)
#> Analysing 'ieu-b-18' on 'Qnps3m'