pqtlMR: Basic pQTL-MR analysis

View source: R/pqtlMR.R

pqtlMRR Documentation

Basic pQTL-MR analysis

Description

This function takes exposure and outcome data as produced by format_data() and used to perform MR analysis against a list of outcomes; in the latter case it can be data from MR-Base, e.g., outcome <- extract_outcome_data(snps=with(exposure,SNP),outcomes=c("ieu-a-7","ebi-a-GCST007432")).

Usage

pqtlMR(
  exposure,
  outcome,
  mr_plot = FALSE,
  prefix = "pQTL-combined-",
  reverse = FALSE
)

Arguments

exposure

exposure data.

outcome

the counterpart for outcome.

mr_plot

to produce plots.

prefix

a prefix for output files.

reverse

if TRUE, perform reverse MR.

Details

Adapted from \insertCitezheng20;textualpQTLtools, this function is analogous to run_TwoSampleMR().

Value

No value is returned but several files.

Note

Adapted from script by Jie Zheng.

References

\insertAllCited

Examples

fi <- file.path(find.package("pQTLtools",lib.loc=.libPaths()),"tests","Ins.csv")
exposure <- TwoSampleMR::format_data(read.csv(fi),type="exposure")
fo <- file.path(find.package("pQTLtools",lib.loc=.libPaths()),"tests","Out.csv")
outcome <- TwoSampleMR::format_data(read.csv(fo),type="outcome")
pQTLtools::pqtlMR(exposure, outcome, prefix="IL6R-")
pQTLtools::pqtlMR(exposure, outcome, prefix="IL6R_rev-",reverse=TRUE)
unlink(c("IL6R*","pQTL-combined*"))
# Phenotype,SNP,effect_allele,other_allele,eaf,beta,se,pval
# ABO,rs505922,C,T,0.313,1.298,0.014,1.2e-1828
# LIFR,rs635634,T,C,0.180,-0.300,0.032,6.00E-21
# f <- file.path(find.package("pQTLtools",lib.loc=.libPaths()),"tests","ms.ins")
# exposure <- format_data(read.table(f, header=TRUE), samplesize_col="N")
# SNP Phenotype effect_allele other_allele eaf beta se pval N
# rs1800693 TNFB T C 0.6033 0.0282  0.0136 0.0389045   11787
# rs2364485 TNFB A C 0.1645 6514963 0.1759 1.62181e-20 11344
# https://raw.githubusercontent.com/MRCIEU/epigraphdb-pqtl/master/scripts/MR-pQTL-script.R


jinghuazhao/pQTLtools documentation built on Oct. 22, 2024, 12:56 a.m.