Giter Site home page Giter Site logo

zhaoxm-lab / mr-pl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sldrcyang/mr-pl

1.0 0.0 0.0 9.81 MB

MR-PL is a one-sample multivariable Mendelian Randomization method based on partial least squares and Lasso regression (MR-PL). MR-PL is capable of considering the correlation among exposures (e.g., imaging features) when the number of exposures is extremely upscaled, while also correcting for winner's curse bias.

Shell 3.39% R 96.61%

mr-pl's Introduction

MR-PL

MR-PL is a one-sample multivariable Mendelian Randomization method, which could take into consideration the correlation among numerous exposures (e.g., brain imaging features) followed by correcting for the winner’s curse bias.

Prepare dependencies

Make sure you have the R package dependencies below installed and accessible in your $PATH.

BiocManager::install('pls')
BiocManager::install('glmnet')
BiocManager::install('hdi')

Input files

  • g_matrix.txt: the genotype matrix of n samples and m snps.
  • exposure_matrix.txt: the exposure matrix of n samples and k exposures.
  • outcome_matrix.txt: the outcome vector of n samples.
  • gwas_assoc.txt: the gwas summary statistics of m snps and k exposures, which is usually derived from a previously published study.

Where the genotype matrix, exposure matrix and outcome are from the same dataset.

Example data are listed in the example/ folder.

Usage

Detail information describes how to perform MR-PL can be found in example.R in the example/ folder.

Briefly, if the gwas summary statistics used to selected instrumental snps is based on the same dataset used for MR analyses, the following can be run

mr_result = mr_pl(g_matrix0, 
                  exposure_matrix0, 
                  outcome, 
                  gwas_assoc, 
                  cutoff = 5e-8, 
                  wcc = TRUE, 
                  c = 20,  #c = 15/25
                  pleiotropy_test = TRUE)

If the gwas summary statistics used to selected IVs is based on another independent dataset, the following can be run

mr_result = mr_pl(g_matrix0, 
                  exposure_matrix0, 
                  outcome, 
                  gwas_assoc, 
                  cutoff = 5e-8, 
                  wcc = FALSE, 
                  c = 0, 
                  pleiotropy_test = TRUE)

Output

mr_result$main_results: exposures with non-zero causal estimate and its corresponding p-value from lasso projection method.

   exposure_name causal_estimate lasso_proj_p
   exposure_1      -0.1908863 1.319257e-15
   exposure_10     -0.1690168 1.085111e-12
   exposure_11     -0.2010710 2.174622e-19
   exposure_12     -0.2086834 5.944588e-30
   exposure_14      0.1851574 3.035465e-18
   exposure_18     -0.1917043 1.215523e-14
   exposure_2       0.1868070 9.948648e-18
   exposure_4      -0.1706325 1.148394e-13
   exposure_6      -0.1796765 1.577770e-16
   exposure_9      -0.1832399 5.285689e-13

mr_result$pleiotropy_test.p: p value of pleiotropy test; if p < 0.05, there exists horizontal pleiotropy, then this MR result should be discarded.

1

mr_result$iv_include: the instrumental snps used for MR analysis (after winner's curse correction).

"snp_256" "snp_208" "snp_795" "snp_76"  "snp_962" ...

mr_result$exposure_include: the exposures used for MR analysis (after winner's curse correction).

"exposure_1"  "exposure_10" "exposure_11" ...

Reproduce

The the reproduce/ folder contains all the codes to reproduce our simulation results, including the baseline simulation and supplementary simulation.

mr-pl's People

Contributors

sldrcyang avatar zhaoxm-lab avatar

Stargazers

Truman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.