Package: TwoSampleMR 0.6.8

Gibran Hemani

TwoSampleMR: Two Sample MR Functions and Interface to MR Base Database

A package for performing Mendelian randomization using GWAS summary data. It uses the IEU GWAS database <https://gwas.mrcieu.ac.uk/> to automatically obtain data, and a wide range of methods to run the analysis. You can use the MR-Base web app <https://www.mrbase.org/> to try out a limited range of the functionality in this package, but for any serious work we strongly recommend using this R package.

Authors:Gibran Hemani [aut, cre], Philip Haycock [aut], Jie Zheng [aut], Tom Gaunt [aut], Ben Elsworth [aut], Tom Palmer [aut]

TwoSampleMR_0.6.8.tar.gz
TwoSampleMR_0.6.8.zip(r-4.5)TwoSampleMR_0.6.8.zip(r-4.4)TwoSampleMR_0.6.8.zip(r-4.3)
TwoSampleMR_0.6.8.tgz(r-4.4-any)TwoSampleMR_0.6.8.tgz(r-4.3-any)
TwoSampleMR_0.6.8.tar.gz(r-4.5-noble)TwoSampleMR_0.6.8.tar.gz(r-4.4-noble)
TwoSampleMR_0.6.8.tgz(r-4.4-emscripten)TwoSampleMR_0.6.8.tgz(r-4.3-emscripten)
TwoSampleMR.pdf |TwoSampleMR.html
TwoSampleMR/json (API)
NEWS

# Install 'TwoSampleMR' in R:
install.packages('TwoSampleMR', repos = c('https://mrcieu.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/mrcieu/twosamplemr/issues

On CRAN:

11.17 score 429 stars 1 packages 1.7k scripts 113 exports 112 dependencies

Last updated 2 months agofrom:578c68fa75. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 26 2024
R-4.5-winOKOct 26 2024
R-4.5-linuxOKOct 26 2024
R-4.4-winOKOct 26 2024
R-4.4-macOKOct 26 2024
R-4.3-winOKOct 26 2024
R-4.3-macOKOct 26 2024

Exports:%>%add_metadataadd_rsqallele_frequencyavailable_outcomesclump_datacombine_all_mrresultscombine_datacontingencyconvert_outcome_to_exposuredat_to_MRInputdat_to_RadialMRdefault_parametersdirectionality_testeffective_nenrichmentenrichment_method_listestimate_trait_sdextract_instrumentsextract_outcome_datafishers_combined_testforest_plotforest_plot_1_to_manyformat_1_to_manyformat_aries_mqtlformat_dataformat_gtex_eqtlformat_gwas_catalogformat_metab_qtlsformat_mr_resultsformat_proteomic_qtlsgenerate_odds_ratiosget_p_from_r2nget_population_allele_frequencyget_r_from_bsenget_r_from_lorget_r_from_pnget_seharmonise_dataharmonise_ld_datIsqld_matrixldsc_h2ldsc_rgmake_datmrmr_density_plotmr_egger_regressionmr_egger_regression_bootstrapmr_forest_plotmr_funnel_plotmr_heterogeneitymr_ivwmr_ivw_femr_ivw_mremr_ivw_radialmr_leaveoneoutmr_leaveoneout_plotmr_medianmr_meta_fixedmr_meta_fixed_simplemr_meta_randommr_method_listmr_modemr_moemr_penalised_weighted_medianmr_pleiotropy_testmr_rapsmr_reportmr_ruckermr_rucker_bootstrapmr_rucker_cooksdistancemr_rucker_jackknifemr_scatter_plotmr_signmr_simple_medianmr_simple_modemr_simple_mode_nomemr_singlesnpmr_steigermr_steiger2mr_two_sample_mlmr_uwrmr_wald_ratiomr_weighted_medianmr_weighted_modemr_weighted_mode_nomemr_wrappermv_basicmv_extract_exposuresmv_extract_exposures_localmv_harmonise_datamv_ivwmv_lasso_feature_selectionmv_multiplemv_residualmv_subsetpower_pruneread_exposure_dataread_outcome_datarun_mr_pressorun_mrmixsize.prunesort_1_to_manysplit_exposuresplit_outcomestandardise_unitssteiger_filteringsteiger_sensitivitysubset_on_methodtrimweighted_medianweighted_median_bootstrap

Dependencies:askpassbase64encbitbit64bootbslibcachemclicliprcodetoolscolorspaceCompQuadFormcowplotcpp11crayoncrosstalkcurldata.tabledigestdplyrevaluatefansifarverfastmapfontawesomeforeachfsgenericsggplot2glmnetglueGPArotationgridExtragtablehighrhmshtmltoolshtmlwidgetshttrieugwasrisobanditeratorsjquerylibjsonliteknitrlabelinglaterlatticelazyevallifecyclelme4magrittrMASSmathjaxrMatrixmemoisemetametadatmetaformgcvmimeminqamnormtmr.rapsMRMixMRPRESSOmunsellnlmenloptrnortestnumDerivopensslpbapplypillarpkgconfigplotlyplyrprettyunitsprogresspromisespsychpurrrR6RadialMRrappdirsRColorBrewerRcppRcppEigenreadrreshape2rlangrmarkdownsassscalesshapestringistringrsurvivalsystibbletidyrtidyselecttinytextzdbutf8vctrsviridisLitevroomwithrxfunxml2yaml

Exposure data

Rendered fromexposure.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-03-21
Started: 2020-01-11

Harmonise data

Rendered fromharmonise.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-09-06
Started: 2020-01-11

Introduction

Rendered fromintroduction.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-04-22
Started: 2020-01-11

Major changes to the IEU GWAS resources for 2020

Rendered fromgwas2020.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-08-21
Started: 2020-01-11

Outcome data

Rendered fromoutcome.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-09-06
Started: 2020-01-11

Perform MR

Rendered fromperform_mr.Rmdusingknitr::rmarkdownon Oct 26 2024.

Last update: 2024-09-26
Started: 2020-01-11

Readme and manuals

Help Manual

Help pageTopics
Add meta data to extracted dataadd_metadata
Estimate r-square of each associationadd_rsq
Estimate allele frequency from SNPallele_frequency
Get list of studies with available GWAS summary statistics through APIavailable_outcomes
Perform LD clumping on SNP dataclump_data
Combine all mr resultscombine_all_mrresults
Combine datacombine_data
Obtain 2x2 contingency table from marginal parameters and odds ratiocontingency
Convert outcome data to exposure dataconvert_outcome_to_exposure
Convert TwoSampleMR format to MendelianRandomization formatdat_to_MRInput
Convert dat to RadialMR formatdat_to_RadialMR
List of parameters for use with MR functionsdefault_parameters
Perform MR Steiger test of directionalitydirectionality_test
Estimate the effective sample size in a case control studyeffective_n
Perform enrichment analysisenrichment
Get list of available p-value enrichment methodsenrichment_method_list
Estimate trait SD by obtaining beta estimates from z-scores and finding the ratio with original beta valuesestimate_trait_sd
Find instruments for use in MR from the MR Base databaseextract_instruments
Supply the output from 'read_exposure_data()' and all the SNPs therein will be queried against the requested outcomes in remote database using API.extract_outcome_data
Fisher's combined testfishers_combined_test
Forest plot for multiple exposures and multiple outcomesforest_plot
1-to-many forest plotforest_plot_1_to_many
A basic forest plotforest_plot_basic2
Format MR results for a 1-to-many forest plotformat_1_to_many
Get data from methylation QTL resultsformat_aries_mqtl
Read exposure or outcome dataformat_data
Get data from eQTL catalog into correct formatformat_gtex_eqtl
Get data selected from GWAS catalog into correct formatformat_gwas_catalog
Get data from metabolomic QTL resultsformat_metab_qtls
Format MR results for forest plotformat_mr_results
Get data from proteomic QTL resultsformat_proteomic_qtls
Generate odds ratiosgenerate_odds_ratios
Calculate p-value from R-squared and sample sizeget_p_from_r2n
Estimate the allele frequency in population from case/control summary dataget_population_allele_frequency
Estimate R-squared from beta, standard error and sample sizeget_r_from_bsen
Estimate proportion of variance of liability explained by SNP in general populationget_r_from_lor
Calculate variance explained from p-values and sample sizeget_r_from_pn
Get SE from effect size and p-valueget_se
Harmonise the alleles and effects between the exposure and outcomeharmonise_data
Harmonise LD matrix against summary dataharmonise_ld_dat
I-squared calculationIsq
Get LD matrix for list of SNPsld_matrix
Univariate LDSCldsc_h2
Bivariate LDSCldsc_rg
Convenient function to create a harmonised datasetmake_dat
Perform all Mendelian randomization testsmr
Density plotmr_density_plot
Egger's regression for Mendelian randomizationmr_egger_regression
Run bootstrap to generate standard errors for MRmr_egger_regression_bootstrap
Forest plotmr_forest_plot
Funnel plotmr_funnel_plot
Get heterogeneity statisticsmr_heterogeneity
Inverse variance weighted regressionmr_ivw
Inverse variance weighted regression (fixed effects)mr_ivw_fe
Inverse variance weighted regression (multiplicative random effects model)mr_ivw_mre
Radial IVW analysismr_ivw_radial
Leave one out sensitivity analysismr_leaveoneout
Plot results from leaveoneout analysismr_leaveoneout_plot
MR median estimatorsmr_median
Perform 2 sample IV using fixed effects meta analysis and delta method for standard errorsmr_meta_fixed
Perform 2 sample IV using simple standard errormr_meta_fixed_simple
Perform 2 sample IV using random effects meta analysis and delta method for standard errorsmr_meta_random
Get list of available MR methodsmr_method_list
MR mode estimatorsmr_mode
Mixture of expertsmr_moe
Penalised weighted median MRmr_penalised_weighted_median
Test for horizontal pleiotropy in MR analysismr_pleiotropy_test
Robust adjusted profile scoremr_raps
Generate MR reportmr_report
MR Rucker frameworkmr_rucker
Run rucker with bootstrap estimatesmr_rucker_bootstrap
MR Rucker with outliers automatically detected and removedmr_rucker_cooksdistance
Run rucker with jackknife estimatesmr_rucker_jackknife
Create scatter plot with lines showing the causal estimate for different MR testsmr_scatter_plot
MR sign testmr_sign
Simple median methodmr_simple_median
MR simple mode estimatormr_simple_mode
MR simple mode estimator (NOME)mr_simple_mode_nome
Perform 2 sample MR on each SNP individuallymr_singlesnp
MR Steiger test of directionalitymr_steiger
MR Steiger test of directionalitymr_steiger2
Maximum likelihood MR methodmr_two_sample_ml
Unweighted regressionmr_uwr
Perform 2 sample IV using Wald ratio.mr_wald_ratio
Weighted median methodmr_weighted_median
MR weighted mode estimatormr_weighted_mode
MR weighted mode estimator (NOME)mr_weighted_mode_nome
Perform full set of MR analysesmr_wrapper
Perform basic multivariable MRmv_basic
Extract exposure variables for multivariable MRmv_extract_exposures
Attempt to perform MVMR using local datamv_extract_exposures_local
Harmonise exposure and outcome for multivariable MRmv_harmonise_data
Perform IVW multivariable MRmv_ivw
Apply LASSO feature selection to mvdat objectmv_lasso_feature_selection
Perform IVW multivariable MRmv_multiple
Perform basic multivariable MRmv_residual
Perform multivariable MR on subset of featuresmv_subset
Power prunepower_prune
Read exposure dataread_exposure_data
Read outcome dataread_outcome_data
Wrapper for MR-PRESSOrun_mr_presso
Perform MRMix analysis on harmonised dat objectrun_mrmix
Size prunesize.prune
Sort results for 1-to-many forest plotsort_1_to_many
Split exposure columnsplit_exposure
Split outcome columnsplit_outcome
Try to standardise continuous traits to be in standard deviation unitsstandardise_units
Steiger filtering functionsteiger_filtering
Evaluate the Steiger test's sensitivity to measurement errorsteiger_sensitivity
Subset MR-results on methodsubset_on_method
Trim function to remove leading and trailing blank spacestrim
Weighted median methodweighted_median
Calculate standard errors for weighted median method using bootstrapweighted_median_bootstrap