Package 'MR.CUE'

Title: Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology
Description: Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology.
Authors: Qing Cheng [aut, cre] (ORCID: <https://orcid.org/0000-0001-5144-4515>)
Maintainer: Qing Cheng <[email protected]>
License: GPL (>= 3)
Version: 1.0
Built: 2026-05-15 09:33:21 UTC
Source: https://github.com/remlapmot/MR.CUE

Help Index


Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology

Description

Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology.

Details

The DESCRIPTION file:

Type: Package
Package: MR.CUE
Title: Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology
Version: 1.0
Authors@R: person("Qing", "Cheng", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5144-4515"))
Description: Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology.
License: GPL (>= 3)
Imports: Rcpp (>= 1.0.8.3), ggplot2, mvtnorm, stats, utils
LinkingTo: BH, Rcpp, RcppArmadillo, RcppDist
Encoding: UTF-8
Repository: https://mrcieu.r-universe.dev
Date/Publication: 2026-03-16 06:57:33 UTC
RemoteUrl: https://github.com/remlapmot/MR.CUE
RemoteRef: suggestions
RemoteSha: eafb841d9ab1437237cbe1ac20519a661a545171
Author: Qing Cheng [aut, cre] (ORCID: <https://orcid.org/0000-0001-5144-4515>)
Maintainer: Qing Cheng <[email protected]>

Index of help topics:

EstRho                  Estimate the Correlation Parameter Rho
EstRhofun               Estimate Rho from Summary Statistic Files
genRawGeno              Generate Raw Genotype Data
genSumStat              Generate Summary Statistics for Simulation
MR.CUE-package          Mendelian randomization accounting for complex
                        correlated horizontal pleiotropy while
                        elucidating shared genetic etiology
MRCUE                   Mendelian Randomization with Correlated
                        pleiotropy Using Empirical priors
MRCUEIndep              MR-CUE for Independent Instruments
MRCUESim                MR-CUE with Simple LD Block Structure
ReadSummaryStat         Read and Match Summary Statistics
RemoveMHCCfun           Remove MHC Region SNPs and Apply QC Filters
summaryQC               Quality Control for Summary Statistics
traceplot               Trace Plot of MCMC Samples

The main user-facing functions are MRCUE, MRCUEIndep, and MRCUESim for Mendelian randomization analysis, and ReadSummaryStat and EstRho for data preparation.

Author(s)

Qing Cheng [aut, cre] (ORCID: <https://orcid.org/0000-0001-5144-4515>)

Maintainer: Qing Cheng <[email protected]>

References

Cheng, Q. et al. (2022) Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology. Nature Communications 13, 6490.


Estimate the Correlation Parameter Rho

Description

Estimates the correlation parameter rho between exposure and outcome using matched summary statistics and LD clumping.

Usage

EstRho(fileexp, fileout, filepan, snpinfo, ld_r2_thresh, lambad, pth)

Arguments

fileexp

Path to exposure summary statistics file.

fileout

Path to outcome summary statistics file.

filepan

Path to reference panel file.

snpinfo

Path to SNP info file.

ld_r2_thresh

LD r-squared threshold for clumping.

lambad

Regularisation parameter for LD matrix estimation.

pth

P-value threshold for instrument selection.

Value

Estimated rho value.


Estimate Rho from Summary Statistic Files

Description

Estimates the correlation parameter rho between exposure and outcome from summary statistic files with LD clumping.

Usage

EstRhofun(fileexposure, fileoutcome, stringname3, ld_r2_thresh, lam, pth,
          block_file)

Arguments

fileexposure

Path to exposure summary statistics file.

fileoutcome

Path to outcome summary statistics file.

stringname3

Path to reference panel file prefix.

ld_r2_thresh

LD r-squared threshold for clumping.

lam

Regularisation parameter for LD matrix estimation.

pth

P-value threshold for instrument selection.

block_file

Path to the LD block definition file.

Value

Estimated rho value.


Generate Raw Genotype Data

Description

Simulates raw genotype data with a specified LD structure for use in simulation studies.

Usage

genRawGeno(maf, L, M, rho, n)

Arguments

maf

Numeric vector of minor allele frequencies.

L

Number of LD blocks.

M

Number of SNPs per block.

rho

Correlation parameter controlling LD decay within blocks.

n

Sample size.

Value

A matrix of simulated genotypes (n rows, L*M columns).


Generate Summary Statistics for Simulation

Description

Simulates GWAS summary statistics with pleiotropy and genetic effects for use in simulation studies.

Usage

genSumStat(x12, n1, n2, M, L, b1, rho_ag, Alrate, h2a, h2t, h2g)

Arguments

x12

Simulated genotype matrix from genRawGeno.

n1

Sample size for exposure.

n2

Sample size for outcome.

M

Number of SNPs per block.

L

Number of LD blocks.

b1

True causal effect.

rho_ag

Correlation between pleiotropic effects.

Alrate

Proportion of pleiotropic SNPs.

h2a

Heritability of pleiotropic effects.

h2t

Heritability of total effects.

h2g

Heritability explained by genetic instruments.

Value

A list of simulated summary statistics.


Mendelian Randomization with Correlated pleiotropy Using Empirical priors

Description

Performs MR-CUE analysis using LD block structure for correlated horizontal pleiotropy modelling.

Usage

MRCUE(F4gammah, F4Gammah, F4se1, F4se2, F4Rblock, rho, coreNum, opts = NULL)

Arguments

F4gammah

Numeric vector of SNP effects on exposure.

F4Gammah

Numeric vector of SNP effects on outcome.

F4se1

Numeric vector of standard errors for exposure effects.

F4se2

Numeric vector of standard errors for outcome effects.

F4Rblock

List of LD correlation matrices by block.

rho

Estimated correlation parameter.

coreNum

Number of CPU cores to use.

opts

Optional list of algorithm parameters.

Value

A list of posterior samples and summary statistics.

References

Cheng, Q. et al. (2022) Nature Communications 13, 6490.


MR-CUE for Independent Instruments

Description

Performs MR-CUE analysis assuming independent instruments (no LD).

Usage

MRCUEIndep(gammah, Gammah, se1, se2, rho, opts = NULL)

Arguments

gammah

Numeric vector of SNP effects on exposure.

Gammah

Numeric vector of SNP effects on outcome.

se1

Numeric vector of standard errors for exposure effects.

se2

Numeric vector of standard errors for outcome effects.

rho

Estimated correlation parameter.

opts

Optional list of algorithm parameters.

Value

A list of posterior samples and summary statistics.

References

Cheng, Q. et al. (2022) Nature Communications 13, 6490.


MR-CUE with Simple LD Block Structure

Description

Performs MR-CUE analysis with a simplified LD block representation.

Usage

MRCUESim(gammah, Gammah, se1, se2, rho, R, block_inf, coreNum, opts = NULL)

Arguments

gammah

Numeric vector of SNP effects on exposure.

Gammah

Numeric vector of SNP effects on outcome.

se1

Numeric vector of standard errors for exposure effects.

se2

Numeric vector of standard errors for outcome effects.

rho

Estimated correlation parameter.

R

LD correlation matrix.

block_inf

Block information matrix.

coreNum

Number of CPU cores to use.

opts

Optional list of algorithm parameters.

Value

A list of posterior samples and summary statistics.

References

Cheng, Q. et al. (2022) Nature Communications 13, 6490.


Read and Match Summary Statistics

Description

Reads exposure and outcome GWAS summary statistics, matches SNPs, and integrates a reference panel for LD calculation.

Usage

ReadSummaryStat(fileexp, fileout, filepan, snpinfo, pva_cutoff, lambad)

Arguments

fileexp

Path to exposure summary statistics file.

fileout

Path to outcome summary statistics file.

filepan

Path to reference panel file (plink binary format).

snpinfo

Path to SNP info file.

pva_cutoff

P-value cutoff for instrument selection.

lambad

Regularisation parameter for LD matrix estimation.

Value

A list of matched summary statistics and LD block information.


Remove MHC Region SNPs and Apply QC Filters

Description

Removes SNPs in the MHC region (chromosome 6) and applies chi-squared bounds for quality control.

Usage

RemoveMHCCfun(mhcstart, mhcend, bh1, bh2, s12, s22, bp, chr, rsname,
              xbound, ybound)

Arguments

mhcstart

Start position of MHC region (bp).

mhcend

End position of MHC region (bp).

bh1

Numeric vector of exposure effect estimates.

bh2

Numeric vector of outcome effect estimates.

s12

Numeric vector of exposure standard errors squared.

s22

Numeric vector of outcome standard errors squared.

bp

Numeric vector of SNP base pair positions.

chr

Numeric vector of chromosome numbers.

rsname

Character vector of SNP identifiers.

xbound

Chi-squared upper bound for exposure QC.

ybound

Chi-squared upper bound for outcome QC.

Value

A list of filtered summary statistics.


Quality Control for Summary Statistics

Description

Filters SNPs in the MHC region and applies chi-squared bounds for quality control of GWAS summary statistics.

Usage

summaryQC(mhcstart, mhcend, bh1, bh2, s12, s22, bp, chr, rsname, avbIndex,
          idx4panel, xbound, ybound)

Arguments

mhcstart

Start position of MHC region (bp).

mhcend

End position of MHC region (bp).

bh1

Numeric vector of exposure effect estimates.

bh2

Numeric vector of outcome effect estimates.

s12

Numeric vector of exposure standard errors squared.

s22

Numeric vector of outcome standard errors squared.

bp

Numeric vector of SNP base pair positions.

chr

Numeric vector of chromosome numbers.

rsname

Character vector of SNP identifiers.

avbIndex

Index of available SNPs.

idx4panel

Index of SNPs in the reference panel.

xbound

Chi-squared upper bound for exposure QC.

ybound

Chi-squared upper bound for outcome QC.

Value

A list of QC-filtered summary statistics.


Trace Plot of MCMC Samples

Description

Creates a trace plot of the posterior samples for the causal effect estimate from an MR-CUE analysis.

Usage

traceplot(bhatpoint)

Arguments

bhatpoint

Numeric vector of posterior samples for the causal effect.

Value

A ggplot2 object.